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

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

Issue 914263005: Subzero: switch from llvm-objdump to objdump for lit tests (for LLVM merge) (Closed) Base URL: https://chromium.googlesource.com/native_client/pnacl-subzero.git@master
Patch Set: fix some line wrap Created 5 years, 10 months 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
« no previous file with comments | « tests_lit/llvm2ice_tests/switch-opt.ll ('k') | tests_lit/llvm2ice_tests/undef.ll » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 ; Tests various aspects of i1 related lowering. 1 ; Tests various aspects of i1 related lowering.
2 2
3 ; RUN: %p2i -i %s -a -O2 --verbose none \ 3 ; RUN: %p2i -i %s --assemble --disassemble -a -O2 --verbose none \
4 ; RUN: | llvm-mc -triple=i686-none-nacl -filetype=obj \ 4 ; RUN: | FileCheck %s
5 ; RUN: | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s 5 ; RUN: %p2i -i %s --assemble --disassemble -a -Om1 --verbose none \
6 ; RUN: %p2i -i %s -a -Om1 --verbose none \ 6 ; RUN: | FileCheck %s
7 ; RUN: | llvm-mc -triple=i686-none-nacl -filetype=obj \
8 ; RUN: | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s
9 7
10 ; Test that and with true uses immediate 1, not -1. 8 ; Test that and with true uses immediate 1, not -1.
11 define internal i32 @testAndTrue(i32 %arg) { 9 define internal i32 @testAndTrue(i32 %arg) {
12 entry: 10 entry:
13 %arg_i1 = trunc i32 %arg to i1 11 %arg_i1 = trunc i32 %arg to i1
14 %result_i1 = and i1 %arg_i1, true 12 %result_i1 = and i1 %arg_i1, true
15 %result = zext i1 %result_i1 to i32 13 %result = zext i1 %result_i1 to i32
16 ret i32 %result 14 ret i32 %result
17 } 15 }
18 ; CHECK-LABEL: testAndTrue 16 ; CHECK-LABEL: testAndTrue
19 ; CHECK: and {{.*}}, 1 17 ; CHECK: and {{.*}},0x1
20 18
21 ; Test that or with true uses immediate 1, not -1. 19 ; Test that or with true uses immediate 1, not -1.
22 define internal i32 @testOrTrue(i32 %arg) { 20 define internal i32 @testOrTrue(i32 %arg) {
23 entry: 21 entry:
24 %arg_i1 = trunc i32 %arg to i1 22 %arg_i1 = trunc i32 %arg to i1
25 %result_i1 = or i1 %arg_i1, true 23 %result_i1 = or i1 %arg_i1, true
26 %result = zext i1 %result_i1 to i32 24 %result = zext i1 %result_i1 to i32
27 ret i32 %result 25 ret i32 %result
28 } 26 }
29 ; CHECK-LABEL: testOrTrue 27 ; CHECK-LABEL: testOrTrue
30 ; CHECK: or {{.*}}, 1 28 ; CHECK: or {{.*}},0x1
31 29
32 ; Test that xor with true uses immediate 1, not -1. 30 ; Test that xor with true uses immediate 1, not -1.
33 define internal i32 @testXorTrue(i32 %arg) { 31 define internal i32 @testXorTrue(i32 %arg) {
34 entry: 32 entry:
35 %arg_i1 = trunc i32 %arg to i1 33 %arg_i1 = trunc i32 %arg to i1
36 %result_i1 = xor i1 %arg_i1, true 34 %result_i1 = xor i1 %arg_i1, true
37 %result = zext i1 %result_i1 to i32 35 %result = zext i1 %result_i1 to i32
38 ret i32 %result 36 ret i32 %result
39 } 37 }
40 ; CHECK-LABEL: testXorTrue 38 ; CHECK-LABEL: testXorTrue
41 ; CHECK: xor {{.*}}, 1 39 ; CHECK: xor {{.*}},0x1
42 40
43 ; Test that trunc to i1 masks correctly. 41 ; Test that trunc to i1 masks correctly.
44 define internal i32 @testTrunc(i32 %arg) { 42 define internal i32 @testTrunc(i32 %arg) {
45 entry: 43 entry:
46 %arg_i1 = trunc i32 %arg to i1 44 %arg_i1 = trunc i32 %arg to i1
47 %result = zext i1 %arg_i1 to i32 45 %result = zext i1 %arg_i1 to i32
48 ret i32 %result 46 ret i32 %result
49 } 47 }
50 ; CHECK-LABEL: testTrunc 48 ; CHECK-LABEL: testTrunc
51 ; CHECK: and {{.*}}, 1 49 ; CHECK: and {{.*}},0x1
52 50
53 ; Test zext to i8. 51 ; Test zext to i8.
54 define internal i32 @testZextI8(i32 %arg) { 52 define internal i32 @testZextI8(i32 %arg) {
55 entry: 53 entry:
56 %arg_i1 = trunc i32 %arg to i1 54 %arg_i1 = trunc i32 %arg to i1
57 %result_i8 = zext i1 %arg_i1 to i8 55 %result_i8 = zext i1 %arg_i1 to i8
58 %result = zext i8 %result_i8 to i32 56 %result = zext i8 %result_i8 to i32
59 ret i32 %result 57 ret i32 %result
60 } 58 }
61 ; CHECK-LABEL: testZextI8 59 ; CHECK-LABEL: testZextI8
62 ; match the trunc instruction 60 ; match the trunc instruction
63 ; CHECK: and {{.*}}, 1 61 ; CHECK: and {{.*}},0x1
64 ; match the zext i1 instruction (NOTE: no mov need between i1 and i8). 62 ; match the zext i1 instruction (NOTE: no mov need between i1 and i8).
65 ; CHECK: and {{.*}}, 1 63 ; CHECK: and {{.*}},0x1
66 64
67 ; Test zext to i16. 65 ; Test zext to i16.
68 define internal i32 @testZextI16(i32 %arg) { 66 define internal i32 @testZextI16(i32 %arg) {
69 entry: 67 entry:
70 %arg_i1 = trunc i32 %arg to i1 68 %arg_i1 = trunc i32 %arg to i1
71 %result_i16 = zext i1 %arg_i1 to i16 69 %result_i16 = zext i1 %arg_i1 to i16
72 %result = zext i16 %result_i16 to i32 70 %result = zext i16 %result_i16 to i32
73 ret i32 %result 71 ret i32 %result
74 } 72 }
75 ; CHECK-LABEL: testZextI16 73 ; CHECK-LABEL: testZextI16
76 ; match the trunc instruction 74 ; match the trunc instruction
77 ; CHECK: and {{.*}}, 1 75 ; CHECK: and {{.*}},0x1
78 ; match the zext i1 instruction (note 32-bit reg is used because it's shorter). 76 ; match the zext i1 instruction (note 32-bit reg is used because it's shorter).
79 ; CHECK: movzx [[REG:e.*]], {{[a-d]l|byte ptr}} 77 ; CHECK: movzx [[REG:e.*]],{{[a-d]l|BYTE PTR}}
80 ; CHECK: and [[REG]], 1 78 ; CHECK: and [[REG]],0x1
81 79
82 ; Test zext to i32. 80 ; Test zext to i32.
83 define internal i32 @testZextI32(i32 %arg) { 81 define internal i32 @testZextI32(i32 %arg) {
84 entry: 82 entry:
85 %arg_i1 = trunc i32 %arg to i1 83 %arg_i1 = trunc i32 %arg to i1
86 %result_i32 = zext i1 %arg_i1 to i32 84 %result_i32 = zext i1 %arg_i1 to i32
87 ret i32 %result_i32 85 ret i32 %result_i32
88 } 86 }
89 ; CHECK-LABEL: testZextI32 87 ; CHECK-LABEL: testZextI32
90 ; match the trunc instruction 88 ; match the trunc instruction
91 ; CHECK: and {{.*}}, 1 89 ; CHECK: and {{.*}},0x1
92 ; match the zext i1 instruction 90 ; match the zext i1 instruction
93 ; CHECK: movzx 91 ; CHECK: movzx
94 ; CHECK: and {{.*}}, 1 92 ; CHECK: and {{.*}},0x1
95 93
96 ; Test zext to i64. 94 ; Test zext to i64.
97 define internal i64 @testZextI64(i32 %arg) { 95 define internal i64 @testZextI64(i32 %arg) {
98 entry: 96 entry:
99 %arg_i1 = trunc i32 %arg to i1 97 %arg_i1 = trunc i32 %arg to i1
100 %result_i64 = zext i1 %arg_i1 to i64 98 %result_i64 = zext i1 %arg_i1 to i64
101 ret i64 %result_i64 99 ret i64 %result_i64
102 } 100 }
103 ; CHECK-LABEL: testZextI64 101 ; CHECK-LABEL: testZextI64
104 ; match the trunc instruction 102 ; match the trunc instruction
105 ; CHECK: and {{.*}}, 1 103 ; CHECK: and {{.*}},0x1
106 ; match the zext i1 instruction 104 ; match the zext i1 instruction
107 ; CHECK: movzx 105 ; CHECK: movzx
108 ; CHECK: and {{.*}}, 1 106 ; CHECK: and {{.*}},0x1
109 ; CHECK: mov {{.*}}, 0 107 ; CHECK: mov {{.*}},0x0
110 108
111 ; Test sext to i8. 109 ; Test sext to i8.
112 define internal i32 @testSextI8(i32 %arg) { 110 define internal i32 @testSextI8(i32 %arg) {
113 entry: 111 entry:
114 %arg_i1 = trunc i32 %arg to i1 112 %arg_i1 = trunc i32 %arg to i1
115 %result_i8 = sext i1 %arg_i1 to i8 113 %result_i8 = sext i1 %arg_i1 to i8
116 %result = sext i8 %result_i8 to i32 114 %result = sext i8 %result_i8 to i32
117 ret i32 %result 115 ret i32 %result
118 } 116 }
119 ; CHECK-LABEL: testSextI8 117 ; CHECK-LABEL: testSextI8
120 ; match the trunc instruction 118 ; match the trunc instruction
121 ; CHECK: and {{.*}}, 1 119 ; CHECK: and {{.*}},0x1
122 ; match the sext i1 instruction 120 ; match the sext i1 instruction
123 ; CHECK: shl [[REG:.*]], 7 121 ; CHECK: shl [[REG:.*]],0x7
124 ; CHECK-NEXT: sar [[REG]], 7 122 ; CHECK-NEXT: sar [[REG]],0x7
125 123
126 ; Test sext to i16. 124 ; Test sext to i16.
127 define internal i32 @testSextI16(i32 %arg) { 125 define internal i32 @testSextI16(i32 %arg) {
128 entry: 126 entry:
129 %arg_i1 = trunc i32 %arg to i1 127 %arg_i1 = trunc i32 %arg to i1
130 %result_i16 = sext i1 %arg_i1 to i16 128 %result_i16 = sext i1 %arg_i1 to i16
131 %result = sext i16 %result_i16 to i32 129 %result = sext i16 %result_i16 to i32
132 ret i32 %result 130 ret i32 %result
133 } 131 }
134 ; CHECK-LABEL: testSextI16 132 ; CHECK-LABEL: testSextI16
135 ; match the trunc instruction 133 ; match the trunc instruction
136 ; CHECK: and {{.*}}, 1 134 ; CHECK: and {{.*}},0x1
137 ; match the sext i1 instruction 135 ; match the sext i1 instruction
138 ; CHECK: movzx e[[REG:.*]], {{[a-d]l|byte ptr}} 136 ; CHECK: movzx e[[REG:.*]],{{[a-d]l|BYTE PTR}}
139 ; CHECK-NEXT: shl [[REG]], 15 137 ; CHECK-NEXT: shl [[REG]],0xf
140 ; CHECK-NEXT: sar [[REG]], 15 138 ; CHECK-NEXT: sar [[REG]],0xf
141 139
142 ; Test sext to i32. 140 ; Test sext to i32.
143 define internal i32 @testSextI32(i32 %arg) { 141 define internal i32 @testSextI32(i32 %arg) {
144 entry: 142 entry:
145 %arg_i1 = trunc i32 %arg to i1 143 %arg_i1 = trunc i32 %arg to i1
146 %result_i32 = sext i1 %arg_i1 to i32 144 %result_i32 = sext i1 %arg_i1 to i32
147 ret i32 %result_i32 145 ret i32 %result_i32
148 } 146 }
149 ; CHECK-LABEL: testSextI32 147 ; CHECK-LABEL: testSextI32
150 ; match the trunc instruction 148 ; match the trunc instruction
151 ; CHECK: and {{.*}}, 1 149 ; CHECK: and {{.*}},0x1
152 ; match the sext i1 instruction 150 ; match the sext i1 instruction
153 ; CHECK: movzx [[REG:.*]], 151 ; CHECK: movzx [[REG:.*]],
154 ; CHECK-NEXT: shl [[REG]], 31 152 ; CHECK-NEXT: shl [[REG]],0x1f
155 ; CHECK-NEXT: sar [[REG]], 31 153 ; CHECK-NEXT: sar [[REG]],0x1f
156 154
157 ; Test sext to i64. 155 ; Test sext to i64.
158 define internal i64 @testSextI64(i32 %arg) { 156 define internal i64 @testSextI64(i32 %arg) {
159 entry: 157 entry:
160 %arg_i1 = trunc i32 %arg to i1 158 %arg_i1 = trunc i32 %arg to i1
161 %result_i64 = sext i1 %arg_i1 to i64 159 %result_i64 = sext i1 %arg_i1 to i64
162 ret i64 %result_i64 160 ret i64 %result_i64
163 } 161 }
164 ; CHECK-LABEL: testSextI64 162 ; CHECK-LABEL: testSextI64
165 ; match the trunc instruction 163 ; match the trunc instruction
166 ; CHECK: and {{.*}}, 1 164 ; CHECK: and {{.*}},0x1
167 ; match the sext i1 instruction 165 ; match the sext i1 instruction
168 ; CHECK: movzx [[REG:.*]], 166 ; CHECK: movzx [[REG:.*]],
169 ; CHECK-NEXT: shl [[REG]], 31 167 ; CHECK-NEXT: shl [[REG]],0x1f
170 ; CHECK-NEXT: sar [[REG]], 31 168 ; CHECK-NEXT: sar [[REG]],0x1f
171 169
172 ; Test fptosi float to i1. 170 ; Test fptosi float to i1.
173 define internal i32 @testFptosiFloat(float %arg) { 171 define internal i32 @testFptosiFloat(float %arg) {
174 entry: 172 entry:
175 %arg_i1 = fptosi float %arg to i1 173 %arg_i1 = fptosi float %arg to i1
176 %result = sext i1 %arg_i1 to i32 174 %result = sext i1 %arg_i1 to i32
177 ret i32 %result 175 ret i32 %result
178 } 176 }
179 ; CHECK-LABEL: testFptosiFloat 177 ; CHECK-LABEL: testFptosiFloat
180 ; CHECK: cvttss2si 178 ; CHECK: cvttss2si
181 ; CHECK: and {{.*}}, 1 179 ; CHECK: and {{.*}},0x1
182 ; CHECK: movzx [[REG:.*]], 180 ; CHECK: movzx [[REG:.*]],
183 ; CHECK-NEXT: shl [[REG]], 31 181 ; CHECK-NEXT: shl [[REG]],0x1f
184 ; CHECK-NEXT: sar [[REG]], 31 182 ; CHECK-NEXT: sar [[REG]],0x1f
185 183
186 ; Test fptosi double to i1. 184 ; Test fptosi double to i1.
187 define internal i32 @testFptosiDouble(double %arg) { 185 define internal i32 @testFptosiDouble(double %arg) {
188 entry: 186 entry:
189 %arg_i1 = fptosi double %arg to i1 187 %arg_i1 = fptosi double %arg to i1
190 %result = sext i1 %arg_i1 to i32 188 %result = sext i1 %arg_i1 to i32
191 ret i32 %result 189 ret i32 %result
192 } 190 }
193 ; CHECK-LABEL: testFptosiDouble 191 ; CHECK-LABEL: testFptosiDouble
194 ; CHECK: cvttsd2si 192 ; CHECK: cvttsd2si
195 ; CHECK: and {{.*}}, 1 193 ; CHECK: and {{.*}},0x1
196 ; CHECK: movzx [[REG:.*]], 194 ; CHECK: movzx [[REG:.*]],
197 ; CHECK-NEXT: shl [[REG]], 31 195 ; CHECK-NEXT: shl [[REG]],0x1f
198 ; CHECK-NEXT: sar [[REG]], 31 196 ; CHECK-NEXT: sar [[REG]],0x1f
OLDNEW
« no previous file with comments | « tests_lit/llvm2ice_tests/switch-opt.ll ('k') | tests_lit/llvm2ice_tests/undef.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698