Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(537)

Side by Side Diff: tests_lit/llvm2ice_tests/sdiv.ll

Issue 2448193008: Subzero, MIPS32: Enable MIPS support in lit tests (Closed)
Patch Set: Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 ; This checks the correctness of the lowering code for the small 1 ; This checks the correctness of the lowering code for the small
2 ; integer variants of sdiv and srem. 2 ; integer variants of sdiv and srem.
3 3
4 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 | FileCheck %s 4 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 | FileCheck %s
5 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 | FileCheck %s 5 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 | FileCheck %s
6 6
7 ; RUN: %if --need=target_MIPS32 --need=allow_dump \
8 ; RUN: --command %p2i --filetype=asm --assemble --disassemble --target \
9 ; RUN: mips32 -i %s --args -O2 -allow-externally-defined-symbols \
10 ; RUN: | %if --need=target_MIPS32 --need=allow_dump \
11 ; RUN: --command FileCheck --check-prefix MIPS32 %s
12
7 define internal i32 @sdiv_i8(i32 %a.i32, i32 %b.i32) { 13 define internal i32 @sdiv_i8(i32 %a.i32, i32 %b.i32) {
8 entry: 14 entry:
9 %a = trunc i32 %a.i32 to i8 15 %a = trunc i32 %a.i32 to i8
10 %b = trunc i32 %b.i32 to i8 16 %b = trunc i32 %b.i32 to i8
11 %res = sdiv i8 %a, %b 17 %res = sdiv i8 %a, %b
12 %res.i32 = zext i8 %res to i32 18 %res.i32 = zext i8 %res to i32
13 ret i32 %res.i32 19 ret i32 %res.i32
14 ; CHECK-LABEL: sdiv_i8 20 ; CHECK-LABEL: sdiv_i8
15 ; CHECK: cbw 21 ; CHECK: cbw
16 ; CHECK: idiv 22 ; CHECK: idiv
23 ; MIPS32-LABEL: sdiv_i8
24 ; MIPS32: div
25 ; MIPS32: teq
26 ; MIPS32: mflo
27 ; MIPS32: andi {{.*}},0xff
17 } 28 }
18 29
19 define internal i32 @sdiv_i16(i32 %a.i32, i32 %b.i32) { 30 define internal i32 @sdiv_i16(i32 %a.i32, i32 %b.i32) {
20 entry: 31 entry:
21 %a = trunc i32 %a.i32 to i16 32 %a = trunc i32 %a.i32 to i16
22 %b = trunc i32 %b.i32 to i16 33 %b = trunc i32 %b.i32 to i16
23 %res = sdiv i16 %a, %b 34 %res = sdiv i16 %a, %b
24 %res.i32 = zext i16 %res to i32 35 %res.i32 = zext i16 %res to i32
25 ret i32 %res.i32 36 ret i32 %res.i32
26 ; CHECK-LABEL: sdiv_i16 37 ; CHECK-LABEL: sdiv_i16
27 ; CHECK: cwd 38 ; CHECK: cwd
28 ; CHECK: idiv 39 ; CHECK: idiv
40 ; MIPS32-LABEL: sdiv_i16
41 ; MIPS32: div
42 ; MIPS32: teq
43 ; MIPS32: mflo
44 ; MIPS32: andi {{.*}},0xffff
29 } 45 }
30 46
31 define internal i32 @sdiv_i32(i32 %a, i32 %b) { 47 define internal i32 @sdiv_i32(i32 %a, i32 %b) {
32 entry: 48 entry:
33 %res = sdiv i32 %a, %b 49 %res = sdiv i32 %a, %b
34 ret i32 %res 50 ret i32 %res
35 ; CHECK-LABEL: sdiv_i32 51 ; CHECK-LABEL: sdiv_i32
36 ; CHECK: cdq 52 ; CHECK: cdq
37 ; CHECK: idiv 53 ; CHECK: idiv
54 ; MIPS32-LABEL: sdiv_i32
55 ; MIPS32: div
56 ; MIPS32: teq
57 ; MIPS32: mflo
38 } 58 }
39 59
40 define internal i32 @srem_i8(i32 %a.i32, i32 %b.i32) { 60 define internal i32 @srem_i8(i32 %a.i32, i32 %b.i32) {
41 entry: 61 entry:
42 %a = trunc i32 %a.i32 to i8 62 %a = trunc i32 %a.i32 to i8
43 %b = trunc i32 %b.i32 to i8 63 %b = trunc i32 %b.i32 to i8
44 %res = srem i8 %a, %b 64 %res = srem i8 %a, %b
45 %res.i32 = zext i8 %res to i32 65 %res.i32 = zext i8 %res to i32
46 ret i32 %res.i32 66 ret i32 %res.i32
47 ; CHECK-LABEL: srem_i8 67 ; CHECK-LABEL: srem_i8
48 ; CHECK: cbw 68 ; CHECK: cbw
49 ; CHECK: idiv 69 ; CHECK: idiv
70 ; MIPS32-LABEL: srem_i8
71 ; MIPS32: div
72 ; MIPS32: teq
73 ; MIPS32: mfhi
74 ; MIPS32: andi {{.*}},0xff
50 } 75 }
51 76
52 define internal i32 @srem_i16(i32 %a.i32, i32 %b.i32) { 77 define internal i32 @srem_i16(i32 %a.i32, i32 %b.i32) {
53 entry: 78 entry:
54 %a = trunc i32 %a.i32 to i16 79 %a = trunc i32 %a.i32 to i16
55 %b = trunc i32 %b.i32 to i16 80 %b = trunc i32 %b.i32 to i16
56 %res = srem i16 %a, %b 81 %res = srem i16 %a, %b
57 %res.i32 = zext i16 %res to i32 82 %res.i32 = zext i16 %res to i32
58 ret i32 %res.i32 83 ret i32 %res.i32
59 ; CHECK-LABEL: srem_i16 84 ; CHECK-LABEL: srem_i16
60 ; CHECK: cwd 85 ; CHECK: cwd
61 ; CHECK: idiv 86 ; CHECK: idiv
87 ; MIPS32-LABEL: srem_i16
88 ; MIPS32: div
89 ; MIPS32: teq
90 ; MIPS32: mfhi
91 ; MIPS32: andi {{.*}},0xffff
62 } 92 }
63 93
64 define internal i32 @srem_i32(i32 %a, i32 %b) { 94 define internal i32 @srem_i32(i32 %a, i32 %b) {
65 entry: 95 entry:
66 %res = srem i32 %a, %b 96 %res = srem i32 %a, %b
67 ret i32 %res 97 ret i32 %res
68 ; CHECK-LABEL: srem_i32 98 ; CHECK-LABEL: srem_i32
69 ; CHECK: cdq 99 ; CHECK: cdq
70 ; CHECK: idiv 100 ; CHECK: idiv
101 ; MIPS32-LABEL: srem_i32
102 ; MIPS32: div
103 ; MIPS32: teq
104 ; MIPS32: mfhi
71 } 105 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698