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

Side by Side Diff: tests_lit/llvm2ice_tests/8bit.pnacl.ll

Issue 2448193008: Subzero, MIPS32: Enable MIPS support in lit tests (Closed)
Patch Set: Addressed review comments 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
« no previous file with comments | « tests_lit/llvm2ice_tests/64bit.pnacl.ll ('k') | tests_lit/llvm2ice_tests/adv-switch-opt.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 ; This tries to be a comprehensive test of i8 operations. 1 ; This tries to be a comprehensive test of i8 operations.
2 2
3 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 \ 3 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 \
4 ; RUN: -allow-externally-defined-symbols | FileCheck %s 4 ; RUN: -allow-externally-defined-symbols | FileCheck %s
5 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -Om1 \ 5 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -Om1 \
6 ; RUN: -allow-externally-defined-symbols | FileCheck %s 6 ; RUN: -allow-externally-defined-symbols | FileCheck %s
7 7
8 ; The following tests i8 srem/urem lowering on x86-64, specifically that the %ah 8 ; The following tests i8 srem/urem lowering on x86-64, specifically that the %ah
9 ; result gets copied into %al/%bl/%cl/%dl before moved into its final register. 9 ; result gets copied into %al/%bl/%cl/%dl before moved into its final register.
10 ; This extra copy is forced by excluding al/bl/cl/dl by default (-reg-exclude), 10 ; This extra copy is forced by excluding al/bl/cl/dl by default (-reg-exclude),
11 ; but allowing them to be used if absolutely necessary (-reg-reserve). 11 ; but allowing them to be used if absolutely necessary (-reg-reserve).
12 12
13 ; RUN: %p2i --target=x8664 --filetype=obj --disassemble -i %s --args -O2 \ 13 ; RUN: %p2i --target=x8664 --filetype=obj --disassemble -i %s --args -O2 \
14 ; RUN: -reg-exclude=al,bl,cl,dl -reg-reserve \ 14 ; RUN: -reg-exclude=al,bl,cl,dl -reg-reserve \
15 ; RUN: -allow-externally-defined-symbols | FileCheck %s --check-prefix=REM 15 ; RUN: -allow-externally-defined-symbols | FileCheck %s --check-prefix=REM
16 16
17 ; RUN: %if --need=target_MIPS32 --need=allow_dump \
18 ; RUN: --command %p2i --filetype=asm --assemble --disassemble --target \
19 ; RUN: mips32 -i %s --args -O2 -allow-externally-defined-symbols \
20 ; RUN: | %if --need=target_MIPS32 --need=allow_dump \
21 ; RUN: --command FileCheck --check-prefix MIPS32 %s
22
17 declare void @useInt(i32 %x) 23 declare void @useInt(i32 %x)
18 24
19 define internal i32 @add8Bit(i32 %a, i32 %b) { 25 define internal i32 @add8Bit(i32 %a, i32 %b) {
20 entry: 26 entry:
21 %a_8 = trunc i32 %a to i8 27 %a_8 = trunc i32 %a to i8
22 %b_8 = trunc i32 %b to i8 28 %b_8 = trunc i32 %b to i8
23 %add = add i8 %b_8, %a_8 29 %add = add i8 %b_8, %a_8
24 %ret = zext i8 %add to i32 30 %ret = zext i8 %add to i32
25 ret i32 %ret 31 ret i32 %ret
26 } 32 }
27 ; CHECK-LABEL: add8Bit 33 ; CHECK-LABEL: add8Bit
28 ; CHECK: add {{[abcd]l}} 34 ; CHECK: add {{[abcd]l}}
35 ; MIPS32-LABEL: add8Bit
36 ; MIPS32: addu
37 ; MIPS32: andi {{.*}},0xff
38 ; MIPS32: move
39 ; MIPS32: jr
40 ; MIPS32: nop
29 41
30 define internal i32 @add8BitConst(i32 %a) { 42 define internal i32 @add8BitConst(i32 %a) {
31 entry: 43 entry:
32 %a_8 = trunc i32 %a to i8 44 %a_8 = trunc i32 %a to i8
33 %add = add i8 %a_8, 123 45 %add = add i8 %a_8, 123
34 %ret = zext i8 %add to i32 46 %ret = zext i8 %add to i32
35 ret i32 %ret 47 ret i32 %ret
36 } 48 }
37 ; CHECK-LABEL: add8BitConst 49 ; CHECK-LABEL: add8BitConst
38 ; CHECK: add {{[abcd]l}} 50 ; CHECK: add {{[abcd]l}}
51 ; MIPS32-LABEL: add8BitConst
52 ; MIPS32: li
53 ; MIPS32: addu
54 ; MIPS32: andi {{.*}},0xff
55 ; MIPS32: move
56 ; MIPS32: jr
57 ; MIPS32: nop
39 58
40 define internal i32 @sub8Bit(i32 %a, i32 %b) { 59 define internal i32 @sub8Bit(i32 %a, i32 %b) {
41 entry: 60 entry:
42 %a_8 = trunc i32 %a to i8 61 %a_8 = trunc i32 %a to i8
43 %b_8 = trunc i32 %b to i8 62 %b_8 = trunc i32 %b to i8
44 %sub = sub i8 %b_8, %a_8 63 %sub = sub i8 %b_8, %a_8
45 %ret = zext i8 %sub to i32 64 %ret = zext i8 %sub to i32
46 ret i32 %ret 65 ret i32 %ret
47 } 66 }
48 ; CHECK-LABEL: sub8Bit 67 ; CHECK-LABEL: sub8Bit
49 ; CHECK: sub {{[abcd]l}} 68 ; CHECK: sub {{[abcd]l}}
69 ; MIPS32-LABEL: sub8Bit
70 ; MIPS32: subu
71 ; MIPS32: andi {{.*}},0xff
72 ; MIPS32: move
73 ; MIPS32: jr
74 ; MIPS32: nop
50 75
51 define internal i32 @sub8BitConst(i32 %a) { 76 define internal i32 @sub8BitConst(i32 %a) {
52 entry: 77 entry:
53 %a_8 = trunc i32 %a to i8 78 %a_8 = trunc i32 %a to i8
54 %sub = sub i8 %a_8, 123 79 %sub = sub i8 %a_8, 123
55 %ret = zext i8 %sub to i32 80 %ret = zext i8 %sub to i32
56 ret i32 %ret 81 ret i32 %ret
57 } 82 }
58 ; CHECK-LABEL: sub8BitConst 83 ; CHECK-LABEL: sub8BitConst
59 ; CHECK: sub {{[abcd]l}} 84 ; CHECK: sub {{[abcd]l}}
85 ; MIPS32-LABEL: sub8BitConst
86 ; MIPS32: li
87 ; MIPS32: subu
88 ; MIPS32: andi {{.*}},0xff
89 ; MIPS32: move
90 ; MIPS32: jr
91 ; MIPS32: nop
60 92
61 define internal i32 @mul8Bit(i32 %a, i32 %b) { 93 define internal i32 @mul8Bit(i32 %a, i32 %b) {
62 entry: 94 entry:
63 %a_8 = trunc i32 %a to i8 95 %a_8 = trunc i32 %a to i8
64 %b_8 = trunc i32 %b to i8 96 %b_8 = trunc i32 %b to i8
65 %mul = mul i8 %b_8, %a_8 97 %mul = mul i8 %b_8, %a_8
66 %ret = zext i8 %mul to i32 98 %ret = zext i8 %mul to i32
67 ret i32 %ret 99 ret i32 %ret
68 } 100 }
69 ; CHECK-LABEL: mul8Bit 101 ; CHECK-LABEL: mul8Bit
70 ; CHECK: mul {{[abcd]l|BYTE PTR}} 102 ; CHECK: mul {{[abcd]l|BYTE PTR}}
103 ; MIPS32-LABEL: mul8Bit
104 ; MIPS32: mul
105 ; MIPS32: andi {{.*}},0xff
106 ; MIPS32: move
107 ; MIPS32: jr
108 ; MIPS32: nop
71 109
72 define internal i32 @mul8BitConst(i32 %a) { 110 define internal i32 @mul8BitConst(i32 %a) {
73 entry: 111 entry:
74 %a_8 = trunc i32 %a to i8 112 %a_8 = trunc i32 %a to i8
75 %mul = mul i8 %a_8, 56 113 %mul = mul i8 %a_8, 56
76 %ret = zext i8 %mul to i32 114 %ret = zext i8 %mul to i32
77 ret i32 %ret 115 ret i32 %ret
78 } 116 }
79 ; CHECK-LABEL: mul8BitConst 117 ; CHECK-LABEL: mul8BitConst
80 ; 8-bit imul only accepts r/m, not imm 118 ; 8-bit imul only accepts r/m, not imm
81 ; CHECK: mov {{.*}},0x38 119 ; CHECK: mov {{.*}},0x38
82 ; CHECK: mul {{[abcd]l|BYTE PTR}} 120 ; CHECK: mul {{[abcd]l|BYTE PTR}}
121 ; MIPS32-LABEL: mul8BitConst
122 ; MIPS32: li
123 ; MIPS32: mul
124 ; MIPS32: andi {{.*}},0xff
125 ; MIPS32: move
126 ; MIPS32: jr
127 ; MIPS32: nop
83 128
84 define internal i32 @udiv8Bit(i32 %a, i32 %b) { 129 define internal i32 @udiv8Bit(i32 %a, i32 %b) {
85 entry: 130 entry:
86 %a_8 = trunc i32 %a to i8 131 %a_8 = trunc i32 %a to i8
87 %b_8 = trunc i32 %b to i8 132 %b_8 = trunc i32 %b to i8
88 %udiv = udiv i8 %b_8, %a_8 133 %udiv = udiv i8 %b_8, %a_8
89 %ret = zext i8 %udiv to i32 134 %ret = zext i8 %udiv to i32
90 ret i32 %ret 135 ret i32 %ret
91 } 136 }
92 ; CHECK-LABEL: udiv8Bit 137 ; CHECK-LABEL: udiv8Bit
93 ; CHECK: div {{[abcd]l|BYTE PTR}} 138 ; CHECK: div {{[abcd]l|BYTE PTR}}
139 ; MIPS32-LABEL: udiv8Bit
140 ; MIPS32: divu
141 ; MIPS32: teq
142 ; MIPS32: mflo
143 ; MIPS32: andi {{.*}},0xff
144 ; MIPS32: jr
145 ; MIPS32: nop
94 146
95 define internal i32 @udiv8BitConst(i32 %a) { 147 define internal i32 @udiv8BitConst(i32 %a) {
96 entry: 148 entry:
97 %a_8 = trunc i32 %a to i8 149 %a_8 = trunc i32 %a to i8
98 %udiv = udiv i8 %a_8, 123 150 %udiv = udiv i8 %a_8, 123
99 %ret = zext i8 %udiv to i32 151 %ret = zext i8 %udiv to i32
100 ret i32 %ret 152 ret i32 %ret
101 } 153 }
102 ; CHECK-LABEL: udiv8BitConst 154 ; CHECK-LABEL: udiv8BitConst
103 ; CHECK: div {{[abcd]l|BYTE PTR}} 155 ; CHECK: div {{[abcd]l|BYTE PTR}}
156 ; MIPS32-LABEL: udiv8BitConst
157 ; MIPS32: li
158 ; MIPS32: divu
159 ; MIPS32: teq
160 ; MIPS32: mflo
161 ; MIPS32: andi {{.*}},0xff
162 ; MIPS32: jr
163 ; MIPS32: nop
104 164
105 define internal i32 @urem8Bit(i32 %a, i32 %b) { 165 define internal i32 @urem8Bit(i32 %a, i32 %b) {
106 entry: 166 entry:
107 %a_8 = trunc i32 %a to i8 167 %a_8 = trunc i32 %a to i8
108 %b_8 = trunc i32 %b to i8 168 %b_8 = trunc i32 %b to i8
109 %urem = urem i8 %b_8, %a_8 169 %urem = urem i8 %b_8, %a_8
110 %ret = zext i8 %urem to i32 170 %ret = zext i8 %urem to i32
111 ret i32 %ret 171 ret i32 %ret
112 } 172 }
113 ; CHECK-LABEL: urem8Bit 173 ; CHECK-LABEL: urem8Bit
114 ; CHECK: div {{[abcd]l|BYTE PTR}} 174 ; CHECK: div {{[abcd]l|BYTE PTR}}
115 ; REM-LABEL: urem8Bit 175 ; REM-LABEL: urem8Bit
116 ; REM: div 176 ; REM: div
117 ; REM-NEXT: mov {{[abcd]}}l,ah 177 ; REM-NEXT: mov {{[abcd]}}l,ah
178 ; MIPS32-LABEL: urem8Bit
179 ; MIPS32: divu
180 ; MIPS32: teq
181 ; MIPS32: mfhi
182 ; MIPS32: andi {{.*}},0xff
183 ; MIPS32: jr
184 ; MIPS32: nop
118 185
119 define internal i32 @urem8BitConst(i32 %a) { 186 define internal i32 @urem8BitConst(i32 %a) {
120 entry: 187 entry:
121 %a_8 = trunc i32 %a to i8 188 %a_8 = trunc i32 %a to i8
122 %urem = urem i8 %a_8, 123 189 %urem = urem i8 %a_8, 123
123 %ret = zext i8 %urem to i32 190 %ret = zext i8 %urem to i32
124 ret i32 %ret 191 ret i32 %ret
125 } 192 }
126 ; CHECK-LABEL: urem8BitConst 193 ; CHECK-LABEL: urem8BitConst
127 ; CHECK: div {{[abcd]l|BYTE PTR}} 194 ; CHECK: div {{[abcd]l|BYTE PTR}}
128 ; REM-LABEL: urem8BitConst 195 ; REM-LABEL: urem8BitConst
196 ; MIPS32-LABEL: urem8BitConst
197 ; MIPS32: li
198 ; MIPS32: divu
199 ; MIPS32: teq
200 ; MIPS32: mfhi
201 ; MIPS32: andi {{.*}},0xff
202 ; MIPS32: jr
203 ; MIPS32: nop
129 204
130 205
131 define internal i32 @sdiv8Bit(i32 %a, i32 %b) { 206 define internal i32 @sdiv8Bit(i32 %a, i32 %b) {
132 entry: 207 entry:
133 %a_8 = trunc i32 %a to i8 208 %a_8 = trunc i32 %a to i8
134 %b_8 = trunc i32 %b to i8 209 %b_8 = trunc i32 %b to i8
135 %sdiv = sdiv i8 %b_8, %a_8 210 %sdiv = sdiv i8 %b_8, %a_8
136 %ret = zext i8 %sdiv to i32 211 %ret = zext i8 %sdiv to i32
137 ret i32 %ret 212 ret i32 %ret
138 } 213 }
139 ; CHECK-LABEL: sdiv8Bit 214 ; CHECK-LABEL: sdiv8Bit
140 ; CHECK: idiv {{[abcd]l|BYTE PTR}} 215 ; CHECK: idiv {{[abcd]l|BYTE PTR}}
216 ; MIPS32-LABEL: sdiv8Bit
217 ; MIPS32: div
218 ; MIPS32: teq
219 ; MIPS32: mflo
220 ; MIPS32: andi {{.*}},0xff
221 ; MIPS32: jr
222 ; MIPS32: nop
141 223
142 define internal i32 @sdiv8BitConst(i32 %a) { 224 define internal i32 @sdiv8BitConst(i32 %a) {
143 entry: 225 entry:
144 %a_8 = trunc i32 %a to i8 226 %a_8 = trunc i32 %a to i8
145 %sdiv = sdiv i8 %a_8, 123 227 %sdiv = sdiv i8 %a_8, 123
146 %ret = zext i8 %sdiv to i32 228 %ret = zext i8 %sdiv to i32
147 ret i32 %ret 229 ret i32 %ret
148 } 230 }
149 ; CHECK-LABEL: sdiv8BitConst 231 ; CHECK-LABEL: sdiv8BitConst
150 ; CHECK: idiv {{[abcd]l|BYTE PTR}} 232 ; CHECK: idiv {{[abcd]l|BYTE PTR}}
233 ; MIPS32-LABEL: sdiv8BitConst
234 ; MIPS32: li
235 ; MIPS32: div
236 ; MIPS32: teq
237 ; MIPS32: mflo
238 ; MIPS32: andi {{.*}},0xff
239 ; MIPS32: jr
240 ; MIPS32: nop
151 241
152 define internal i32 @srem8Bit(i32 %a, i32 %b) { 242 define internal i32 @srem8Bit(i32 %a, i32 %b) {
153 entry: 243 entry:
154 %a_8 = trunc i32 %a to i8 244 %a_8 = trunc i32 %a to i8
155 %b_8 = trunc i32 %b to i8 245 %b_8 = trunc i32 %b to i8
156 %srem = srem i8 %b_8, %a_8 246 %srem = srem i8 %b_8, %a_8
157 %ret = zext i8 %srem to i32 247 %ret = zext i8 %srem to i32
158 ret i32 %ret 248 ret i32 %ret
159 } 249 }
160 ; CHECK-LABEL: srem8Bit 250 ; CHECK-LABEL: srem8Bit
161 ; CHECK: idiv {{[abcd]l|BYTE PTR}} 251 ; CHECK: idiv {{[abcd]l|BYTE PTR}}
162 ; REM-LABEL: srem8Bit 252 ; REM-LABEL: srem8Bit
163 ; REM: idiv 253 ; REM: idiv
164 ; REM-NEXT: mov {{[abcd]}}l,ah 254 ; REM-NEXT: mov {{[abcd]}}l,ah
255 ; MIPS32-LABEL: srem8Bit
256 ; MIPS32: div
257 ; MIPS32: teq
258 ; MIPS32: mfhi
259 ; MIPS32: andi {{.*}},0xff
260 ; MIPS32: jr
261 ; MIPS32: nop
165 262
166 define internal i32 @srem8BitConst(i32 %a) { 263 define internal i32 @srem8BitConst(i32 %a) {
167 entry: 264 entry:
168 %a_8 = trunc i32 %a to i8 265 %a_8 = trunc i32 %a to i8
169 %srem = srem i8 %a_8, 123 266 %srem = srem i8 %a_8, 123
170 %ret = zext i8 %srem to i32 267 %ret = zext i8 %srem to i32
171 ret i32 %ret 268 ret i32 %ret
172 } 269 }
173 ; CHECK-LABEL: srem8BitConst 270 ; CHECK-LABEL: srem8BitConst
174 ; CHECK: idiv {{[abcd]l|BYTE PTR}} 271 ; CHECK: idiv {{[abcd]l|BYTE PTR}}
175 ; REM-LABEL: srem8BitConst 272 ; REM-LABEL: srem8BitConst
273 ; MIPS32-LABEL: srem8BitConst
274 ; MIPS32: li
275 ; MIPS32: div
276 ; MIPS32: teq
277 ; MIPS32: mfhi
278 ; MIPS32: andi {{.*}},0xff
279 ; MIPS32: jr
280 ; MIPS32: nop
176 281
177 define internal i32 @shl8Bit(i32 %a, i32 %b) { 282 define internal i32 @shl8Bit(i32 %a, i32 %b) {
178 entry: 283 entry:
179 %a_8 = trunc i32 %a to i8 284 %a_8 = trunc i32 %a to i8
180 %b_8 = trunc i32 %b to i8 285 %b_8 = trunc i32 %b to i8
181 %shl = shl i8 %b_8, %a_8 286 %shl = shl i8 %b_8, %a_8
182 %ret = zext i8 %shl to i32 287 %ret = zext i8 %shl to i32
183 ret i32 %ret 288 ret i32 %ret
184 } 289 }
185 ; CHECK-LABEL: shl8Bit 290 ; CHECK-LABEL: shl8Bit
186 ; CHECK: shl {{[abd]l|BYTE PTR}},cl 291 ; CHECK: shl {{[abd]l|BYTE PTR}},cl
292 ; MIPS32-LABEL: shl8Bit
293 ; MIPS32: sllv
294 ; MIPS32: andi {{.*}},0xff
295 ; MIPS32: move
296 ; MIPS32: jr
297 ; MIPS32: nop
187 298
188 define internal i32 @shl8BitConst(i32 %a, i32 %b) { 299 define internal i32 @shl8BitConst(i32 %a, i32 %b) {
189 entry: 300 entry:
190 %a_8 = trunc i32 %a to i8 301 %a_8 = trunc i32 %a to i8
191 %shl = shl i8 %a_8, 6 302 %shl = shl i8 %a_8, 6
192 %ret = zext i8 %shl to i32 303 %ret = zext i8 %shl to i32
193 ret i32 %ret 304 ret i32 %ret
194 } 305 }
195 ; CHECK-LABEL: shl8BitConst 306 ; CHECK-LABEL: shl8BitConst
196 ; CHECK: shl {{[abcd]l|BYTE PTR}},0x6 307 ; CHECK: shl {{[abcd]l|BYTE PTR}},0x6
308 ; MIPS32-LABEL: shl8BitConst
309 ; MIPS32: li
310 ; MIPS32: sllv
311 ; MIPS32: andi {{.*}},0xff
312 ; MIPS32: move
313 ; MIPS32: jr
314 ; MIPS32: nop
197 315
198 define internal i32 @lshr8Bit(i32 %a, i32 %b) { 316 define internal i32 @lshr8Bit(i32 %a, i32 %b) {
199 entry: 317 entry:
200 %a_8 = trunc i32 %a to i8 318 %a_8 = trunc i32 %a to i8
201 %b_8 = trunc i32 %b to i8 319 %b_8 = trunc i32 %b to i8
202 %lshr = lshr i8 %b_8, %a_8 320 %lshr = lshr i8 %b_8, %a_8
203 %ret = zext i8 %lshr to i32 321 %ret = zext i8 %lshr to i32
204 ret i32 %ret 322 ret i32 %ret
205 } 323 }
206 ; CHECK-LABEL: lshr8Bit 324 ; CHECK-LABEL: lshr8Bit
207 ; CHECK: shr {{[abd]l|BYTE PTR}},cl 325 ; CHECK: shr {{[abd]l|BYTE PTR}},cl
326 ; MIPS32-LABEL: lshr8Bit
327 ; MIPS32: srlv
328 ; MIPS32: andi {{.*}},0xff
329 ; MIPS32: move
330 ; MIPS32: jr
331 ; MIPS32: nop
208 332
209 define internal i32 @lshr8BitConst(i32 %a, i32 %b) { 333 define internal i32 @lshr8BitConst(i32 %a, i32 %b) {
210 entry: 334 entry:
211 %a_8 = trunc i32 %a to i8 335 %a_8 = trunc i32 %a to i8
212 %lshr = lshr i8 %a_8, 6 336 %lshr = lshr i8 %a_8, 6
213 %ret = zext i8 %lshr to i32 337 %ret = zext i8 %lshr to i32
214 ret i32 %ret 338 ret i32 %ret
215 } 339 }
216 ; CHECK-LABEL: lshr8BitConst 340 ; CHECK-LABEL: lshr8BitConst
217 ; CHECK: shr {{[abcd]l|BYTE PTR}},0x6 341 ; CHECK: shr {{[abcd]l|BYTE PTR}},0x6
342 ; MIPS32-LABEL: lshr8BitConst
343 ; MIPS32: li
344 ; MIPS32: srlv
345 ; MIPS32: andi {{.*}},0xff
346 ; MIPS32: move
347 ; MIPS32: jr
348 ; MIPS32: nop
218 349
219 define internal i32 @ashr8Bit(i32 %a, i32 %b) { 350 define internal i32 @ashr8Bit(i32 %a, i32 %b) {
220 entry: 351 entry:
221 %a_8 = trunc i32 %a to i8 352 %a_8 = trunc i32 %a to i8
222 %b_8 = trunc i32 %b to i8 353 %b_8 = trunc i32 %b to i8
223 %ashr = ashr i8 %b_8, %a_8 354 %ashr = ashr i8 %b_8, %a_8
224 %ret = zext i8 %ashr to i32 355 %ret = zext i8 %ashr to i32
225 ret i32 %ret 356 ret i32 %ret
226 } 357 }
227 ; CHECK-LABEL: ashr8Bit 358 ; CHECK-LABEL: ashr8Bit
228 ; CHECK: sar {{[abd]l|BYTE PTR}},cl 359 ; CHECK: sar {{[abd]l|BYTE PTR}},cl
360 ; MIPS32-LABEL: ashr8Bit
361 ; MIPS32: sra
362 ; MIPS32: andi {{.*}},0xff
363 ; MIPS32: move
364 ; MIPS32: jr
365 ; MIPS32: nop
229 366
230 define internal i32 @ashr8BitConst(i32 %a, i32 %b) { 367 define internal i32 @ashr8BitConst(i32 %a, i32 %b) {
231 entry: 368 entry:
232 %a_8 = trunc i32 %a to i8 369 %a_8 = trunc i32 %a to i8
233 %ashr = ashr i8 %a_8, 6 370 %ashr = ashr i8 %a_8, 6
234 %ret = zext i8 %ashr to i32 371 %ret = zext i8 %ashr to i32
235 ret i32 %ret 372 ret i32 %ret
236 } 373 }
237 ; CHECK-LABEL: ashr8BitConst 374 ; CHECK-LABEL: ashr8BitConst
238 ; CHECK: sar {{[abcd]l|BYTE PTR}},0x6 375 ; CHECK: sar {{[abcd]l|BYTE PTR}},0x6
376 ; MIPS32-LABEL: ashr8BitConst
377 ; MIPS32: li
378 ; MIPS32: srav
379 ; MIPS32: andi {{.*}},0xff
380 ; MIPS32: move
381 ; MIPS32: jr
382 ; MIPS32: nop
239 383
240 define internal i32 @icmp8Bit(i32 %a, i32 %b) { 384 define internal i32 @icmp8Bit(i32 %a, i32 %b) {
241 entry: 385 entry:
242 %a_8 = trunc i32 %a to i8 386 %a_8 = trunc i32 %a to i8
243 %b_8 = trunc i32 %b to i8 387 %b_8 = trunc i32 %b to i8
244 %icmp = icmp ne i8 %b_8, %a_8 388 %icmp = icmp ne i8 %b_8, %a_8
245 %ret = zext i1 %icmp to i32 389 %ret = zext i1 %icmp to i32
246 ret i32 %ret 390 ret i32 %ret
247 } 391 }
248 ; CHECK-LABEL: icmp8Bit 392 ; CHECK-LABEL: icmp8Bit
249 ; CHECK: cmp {{[abcd]l|BYTE PTR}} 393 ; CHECK: cmp {{[abcd]l|BYTE PTR}}
394 ; MIPS32-LABEL: icmp8Bit
395 ; MIPS32: sll {{.*}},0x18
396 ; MIPS32: sll {{.*}},0x18
397 ; MIPS32: xor
398 ; MIPS32: sltu
399 ; MIPS32: andi {{.*}},0x1
400 ; MIPS32: move
401 ; MIPS32: jr
402 ; MIPS32: nop
250 403
251 define internal i32 @icmp8BitConst(i32 %a) { 404 define internal i32 @icmp8BitConst(i32 %a) {
252 entry: 405 entry:
253 %a_8 = trunc i32 %a to i8 406 %a_8 = trunc i32 %a to i8
254 %icmp = icmp ne i8 %a_8, 123 407 %icmp = icmp ne i8 %a_8, 123
255 %ret = zext i1 %icmp to i32 408 %ret = zext i1 %icmp to i32
256 ret i32 %ret 409 ret i32 %ret
257 } 410 }
258 ; CHECK-LABEL: icmp8BitConst 411 ; CHECK-LABEL: icmp8BitConst
259 ; CHECK: cmp {{[abcd]l|BYTE PTR}} 412 ; CHECK: cmp {{[abcd]l|BYTE PTR}}
413 ; MIPS32-LABEL: icmp8BitConst
414 ; MIPS32: li
415 ; MIPS32: sll {{.*}},0x18
416 ; MIPS32: sll {{.*}},0x18
417 ; MIPS32: xor
418 ; MIPS32: sltu
419 ; MIPS32: andi {{.*}},0x1
420 ; MIPS32: move
421 ; MIPS32: jr
422 ; MIPS32: nop
260 423
261 define internal i32 @icmp8BitConstSwapped(i32 %a) { 424 define internal i32 @icmp8BitConstSwapped(i32 %a) {
262 entry: 425 entry:
263 %a_8 = trunc i32 %a to i8 426 %a_8 = trunc i32 %a to i8
264 %icmp = icmp ne i8 123, %a_8 427 %icmp = icmp ne i8 123, %a_8
265 %ret = zext i1 %icmp to i32 428 %ret = zext i1 %icmp to i32
266 ret i32 %ret 429 ret i32 %ret
267 } 430 }
268 ; CHECK-LABEL: icmp8BitConstSwapped 431 ; CHECK-LABEL: icmp8BitConstSwapped
269 ; CHECK: cmp {{[abcd]l|BYTE PTR}} 432 ; CHECK: cmp {{[abcd]l|BYTE PTR}}
433 ; MIPS32-LABEL: icmp8BitConstSwapped
434 ; MIPS32: li
435 ; MIPS32: sll {{.*}},0x18
436 ; MIPS32: sll {{.*}},0x18
437 ; MIPS32: xor v0,v0,a0
438 ; MIPS32: sltu
439 ; MIPS32: andi {{.*}},0x1
440 ; MIPS32: jr
441 ; MIPS32: nop
270 442
271 define internal i32 @icmp8BitMem(i32 %a, i32 %b_iptr) { 443 define internal i32 @icmp8BitMem(i32 %a, i32 %b_iptr) {
272 entry: 444 entry:
273 %a_8 = trunc i32 %a to i8 445 %a_8 = trunc i32 %a to i8
274 %bptr = inttoptr i32 %b_iptr to i8* 446 %bptr = inttoptr i32 %b_iptr to i8*
275 %b_8 = load i8, i8* %bptr, align 1 447 %b_8 = load i8, i8* %bptr, align 1
276 %icmp = icmp ne i8 %b_8, %a_8 448 %icmp = icmp ne i8 %b_8, %a_8
277 %ret = zext i1 %icmp to i32 449 %ret = zext i1 %icmp to i32
278 ret i32 %ret 450 ret i32 %ret
279 } 451 }
280 ; CHECK-LABEL: icmp8BitMem 452 ; CHECK-LABEL: icmp8BitMem
281 ; CHECK: cmp {{[abcd]l|BYTE PTR}} 453 ; CHECK: cmp {{[abcd]l|BYTE PTR}}
454 ; MIPS32-LABEL: icmp8BitMem
455 ; MIPS32: lb
456 ; MIPS32: sll {{.*}},0x18
457 ; MIPS32: sll {{.*}},0x18
458 ; MIPS32: xor
459 ; MIPS32: sltu
460 ; MIPS32: andi {{.*}},0x1
461 ; MIPS32: move
462 ; MIPS32: jr
463 ; MIPS32: nop
282 464
283 define internal i32 @icmp8BitMemSwapped(i32 %a, i32 %b_iptr) { 465 define internal i32 @icmp8BitMemSwapped(i32 %a, i32 %b_iptr) {
284 entry: 466 entry:
285 %a_8 = trunc i32 %a to i8 467 %a_8 = trunc i32 %a to i8
286 %bptr = inttoptr i32 %b_iptr to i8* 468 %bptr = inttoptr i32 %b_iptr to i8*
287 %b_8 = load i8, i8* %bptr, align 1 469 %b_8 = load i8, i8* %bptr, align 1
288 %icmp = icmp ne i8 %a_8, %b_8 470 %icmp = icmp ne i8 %a_8, %b_8
289 %ret = zext i1 %icmp to i32 471 %ret = zext i1 %icmp to i32
290 ret i32 %ret 472 ret i32 %ret
291 } 473 }
292 ; CHECK-LABEL: icmp8BitMemSwapped 474 ; CHECK-LABEL: icmp8BitMemSwapped
293 ; CHECK: cmp {{[abcd]l|BYTE PTR}} 475 ; CHECK: cmp {{[abcd]l|BYTE PTR}}
476 ; MIPS32-LABEL: icmp8BitMemSwapped
477 ; MIPS32: lb
478 ; MIPS32: sll {{.*}},0x18
479 ; MIPS32: sll {{.*}},0x18
480 ; MIPS32: xor
481 ; MIPS32: sltu
482 ; MIPS32: andi {{.*}},0x1
483 ; MIPS32: move
484 ; MIPS32: jr
485 ; MIPS32: nop
294 486
295 define internal i32 @selectI8Var(i32 %a, i32 %b) { 487 define internal i32 @selectI8Var(i32 %a, i32 %b) {
296 entry: 488 entry:
297 %a_8 = trunc i32 %a to i8 489 %a_8 = trunc i32 %a to i8
298 %b_8 = trunc i32 %b to i8 490 %b_8 = trunc i32 %b to i8
299 %cmp = icmp slt i8 %a_8, %b_8 491 %cmp = icmp slt i8 %a_8, %b_8
300 %ret = select i1 %cmp, i8 %a_8, i8 %b_8 492 %ret = select i1 %cmp, i8 %a_8, i8 %b_8
301 %ret_ext = zext i8 %ret to i32 493 %ret_ext = zext i8 %ret to i32
302 ; Create a "fake" use of %cmp to prevent O2 bool folding. 494 ; Create a "fake" use of %cmp to prevent O2 bool folding.
303 %d1 = zext i1 %cmp to i32 495 %d1 = zext i1 %cmp to i32
304 call void @useInt(i32 %d1) 496 call void @useInt(i32 %d1)
305 ret i32 %ret_ext 497 ret i32 %ret_ext
306 } 498 }
307 ; CHECK-LABEL: selectI8Var 499 ; CHECK-LABEL: selectI8Var
308 ; CHECK: cmp 500 ; CHECK: cmp
309 ; CHECK: setl 501 ; CHECK: setl
310 ; CHECK: mov {{[a-d]l}} 502 ; CHECK: mov {{[a-d]l}}
503 ; MIPS32-LABEL: selectI8Var
504 ; MIPS32: addiu
505 ; MIPS32: sw
506 ; MIPS32: sw
507 ; MIPS32: move
508 ; MIPS32: move
509 ; MIPS32: sll {{.*}},0x18
510 ; MIPS32: sll {{.*}},0x18
511 ; MIPS32: slt
512 ; MIPS32: move
513 ; MIPS32: movn
514 ; MIPS32: andi {{.*}},0xff
515 ; MIPS32: move
516 ; MIPS32: andi {{.*}},0x1
517 ; MIPS32: move
518 ; MIPS32: jal
519 ; MIPS32: nop
520 ; MIPS32: move
521 ; MIPS32: lw
522 ; MIPS32: lw
523 ; MIPS32: addiu
524 ; MIPS32: jr
525 ; MIPS32: nop
311 526
312 define internal i32 @testPhi8(i32 %arg, i32 %arg2, i32 %arg3, i32 %arg4, i32 %ar g5, i32 %arg6, i32 %arg7, i32 %arg8, i32 %arg9, i32 %arg10) { 527 define internal i32 @testPhi8(i32 %arg, i32 %arg2, i32 %arg3, i32 %arg4, i32 %ar g5, i32 %arg6, i32 %arg7, i32 %arg8, i32 %arg9, i32 %arg10) {
313 entry: 528 entry:
314 %trunc = trunc i32 %arg to i8 529 %trunc = trunc i32 %arg to i8
315 %trunc2 = trunc i32 %arg2 to i8 530 %trunc2 = trunc i32 %arg2 to i8
316 %trunc3 = trunc i32 %arg3 to i8 531 %trunc3 = trunc i32 %arg3 to i8
317 %trunc4 = trunc i32 %arg4 to i8 532 %trunc4 = trunc i32 %arg4 to i8
318 %trunc5 = trunc i32 %arg5 to i8 533 %trunc5 = trunc i32 %arg5 to i8
319 %cmp1 = icmp sgt i32 %arg, 0 534 %cmp1 = icmp sgt i32 %arg, 0
320 br i1 %cmp1, label %next, label %target 535 br i1 %cmp1, label %next, label %target
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 define i32 @load_i8(i32 %addr_arg) { 568 define i32 @load_i8(i32 %addr_arg) {
354 entry: 569 entry:
355 %addr = inttoptr i32 %addr_arg to i8* 570 %addr = inttoptr i32 %addr_arg to i8*
356 %ret = load i8, i8* %addr, align 1 571 %ret = load i8, i8* %addr, align 1
357 %ret2 = sub i8 %ret, 0 572 %ret2 = sub i8 %ret, 0
358 %ret_ext = zext i8 %ret2 to i32 573 %ret_ext = zext i8 %ret2 to i32
359 ret i32 %ret_ext 574 ret i32 %ret_ext
360 } 575 }
361 ; CHECK-LABEL: load_i8 576 ; CHECK-LABEL: load_i8
362 ; CHECK: mov {{[a-d]l}},BYTE PTR 577 ; CHECK: mov {{[a-d]l}},BYTE PTR
578 ; MIPS32-LABEL: load_i8
579 ; MIPS32: lb
580 ; MIPS32: li
581 ; MIPS32: subu
582 ; MIPS32: andi {{.*}},0xff
583 ; MIPS32: move
584 ; MIPS32: jr
585 ; MIPS32: nop
363 586
364 define i32 @load_i8_global(i32 %addr_arg) { 587 define i32 @load_i8_global(i32 %addr_arg) {
365 entry: 588 entry:
366 %addr = bitcast [1 x i8]* @global8 to i8* 589 %addr = bitcast [1 x i8]* @global8 to i8*
367 %ret = load i8, i8* %addr, align 1 590 %ret = load i8, i8* %addr, align 1
368 %ret2 = sub i8 %ret, 0 591 %ret2 = sub i8 %ret, 0
369 %ret_ext = zext i8 %ret2 to i32 592 %ret_ext = zext i8 %ret2 to i32
370 ret i32 %ret_ext 593 ret i32 %ret_ext
371 } 594 }
372 ; CHECK-LABEL: load_i8_global 595 ; CHECK-LABEL: load_i8_global
373 ; CHECK: mov {{[a-d]l}},{{(BYTE PTR)?}} 596 ; CHECK: mov {{[a-d]l}},{{(BYTE PTR)?}}
597 ; MIPS32-LABEL: load_i8_global
598 ; MIPS32: lui
599 ; MIPS32: addiu
600 ; MIPS32: lb
601 ; MIPS32: li
602 ; MIPS32: subu
603 ; MIPS32: andi {{.*}},0xff
604 ; MIPS32: jr
605 ; MIPS32: nop
374 606
375 define void @store_i8(i32 %addr_arg, i32 %val) { 607 define void @store_i8(i32 %addr_arg, i32 %val) {
376 entry: 608 entry:
377 %val_trunc = trunc i32 %val to i8 609 %val_trunc = trunc i32 %val to i8
378 %addr = inttoptr i32 %addr_arg to i8* 610 %addr = inttoptr i32 %addr_arg to i8*
379 store i8 %val_trunc, i8* %addr, align 1 611 store i8 %val_trunc, i8* %addr, align 1
380 ret void 612 ret void
381 } 613 }
382 ; CHECK-LABEL: store_i8 614 ; CHECK-LABEL: store_i8
383 ; CHECK: mov BYTE PTR {{.*}},{{[a-d]l}} 615 ; CHECK: mov BYTE PTR {{.*}},{{[a-d]l}}
616 ; MIPS32-LABEL: store_i8
617 ; MIPS32: sb
618 ; MIPS32: jr
619 ; MIPS32: nop
384 620
385 define void @store_i8_const(i32 %addr_arg) { 621 define void @store_i8_const(i32 %addr_arg) {
386 entry: 622 entry:
387 %addr = inttoptr i32 %addr_arg to i8* 623 %addr = inttoptr i32 %addr_arg to i8*
388 store i8 123, i8* %addr, align 1 624 store i8 123, i8* %addr, align 1
389 ret void 625 ret void
390 } 626 }
391 ; CHECK-LABEL: store_i8_const 627 ; CHECK-LABEL: store_i8_const
392 ; CHECK: mov BYTE PTR {{.*}},0x7b 628 ; CHECK: mov BYTE PTR {{.*}},0x7b
629 ; MIPS32-LABEL: store_i8_const
630 ; MIPS32: li
631 ; MIPS32: sb
632 ; MIPS32: jr
633 ; MIPS32: nop
OLDNEW
« no previous file with comments | « tests_lit/llvm2ice_tests/64bit.pnacl.ll ('k') | tests_lit/llvm2ice_tests/adv-switch-opt.ll » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698