OLD | NEW |
1 ; This tries to be a comprehensive test of i64 operations, in | 1 ; This tries to be a comprehensive test of i64 operations, in |
2 ; particular the patterns for lowering i64 operations into constituent | 2 ; particular the patterns for lowering i64 operations into constituent |
3 ; i32 operations on x86-32. | 3 ; i32 operations on x86-32. |
4 | 4 |
5 ; TODO(jvoung): fix extra "CALLTARGETS" run. The llvm-objdump symbolizer | 5 ; TODO(jvoung): fix extra "CALLTARGETS" run. The llvm-objdump symbolizer |
6 ; doesn't know how to symbolize non-section-local functions. | 6 ; doesn't know how to symbolize non-section-local functions. |
7 ; The newer LLVM 3.6 one does work, but watch out for other bugs. | 7 ; The newer LLVM 3.6 one does work, but watch out for other bugs. |
8 | 8 |
9 ; RUN: %llvm2ice -O2 --verbose none %s \ | 9 ; RUN: %llvm2ice -O2 --verbose none %s \ |
10 ; RUN: | FileCheck --check-prefix=CALLTARGETS %s | 10 ; RUN: | FileCheck --check-prefix=CALLTARGETS %s |
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
120 ; OPTM1-NEXT: mov dword ptr [esp + 12], 305419896 | 120 ; OPTM1-NEXT: mov dword ptr [esp + 12], 305419896 |
121 ; OPTM1-NEXT: call -4 | 121 ; OPTM1-NEXT: call -4 |
122 | 122 |
123 define internal i64 @return64BitArg(i64 %a) { | 123 define internal i64 @return64BitArg(i64 %a) { |
124 entry: | 124 entry: |
125 ret i64 %a | 125 ret i64 %a |
126 } | 126 } |
127 ; CHECK-LABEL: return64BitArg | 127 ; CHECK-LABEL: return64BitArg |
128 ; CHECK: mov {{.*}}, dword ptr [esp + 4] | 128 ; CHECK: mov {{.*}}, dword ptr [esp + 4] |
129 ; CHECK: mov {{.*}}, dword ptr [esp + 8] | 129 ; CHECK: mov {{.*}}, dword ptr [esp + 8] |
130 ; CHECK: ret | |
131 ; | 130 ; |
132 ; OPTM1-LABEL: return64BitArg | 131 ; OPTM1-LABEL: return64BitArg |
133 ; OPTM1: mov {{.*}}, dword ptr [esp + 4] | 132 ; OPTM1: mov {{.*}}, dword ptr [esp + 4] |
134 ; OPTM1: mov {{.*}}, dword ptr [esp + 8] | 133 ; OPTM1: mov {{.*}}, dword ptr [esp + 8] |
135 ; OPTM1: ret | |
136 | 134 |
137 define internal i64 @return64BitConst() { | 135 define internal i64 @return64BitConst() { |
138 entry: | 136 entry: |
139 ret i64 -2401053092306725256 | 137 ret i64 -2401053092306725256 |
140 } | 138 } |
141 ; CHECK-LABEL: return64BitConst | 139 ; CHECK-LABEL: return64BitConst |
142 ; CHECK: mov eax, 305419896 | 140 ; CHECK: mov eax, 305419896 |
143 ; CHECK: mov edx, 3735928559 | 141 ; CHECK: mov edx, 3735928559 |
144 ; CHECK: ret | |
145 ; | 142 ; |
146 ; OPTM1-LABEL: return64BitConst | 143 ; OPTM1-LABEL: return64BitConst |
147 ; OPTM1: mov eax, 305419896 | 144 ; OPTM1: mov eax, 305419896 |
148 ; OPTM1: mov edx, 3735928559 | 145 ; OPTM1: mov edx, 3735928559 |
149 ; OPTM1: ret | |
150 | 146 |
151 define internal i64 @add64BitSigned(i64 %a, i64 %b) { | 147 define internal i64 @add64BitSigned(i64 %a, i64 %b) { |
152 entry: | 148 entry: |
153 %add = add i64 %b, %a | 149 %add = add i64 %b, %a |
154 ret i64 %add | 150 ret i64 %add |
155 } | 151 } |
156 ; CHECK-LABEL: add64BitSigned | 152 ; CHECK-LABEL: add64BitSigned |
157 ; CHECK: add | 153 ; CHECK: add |
158 ; CHECK: adc | 154 ; CHECK: adc |
159 ; CHECK: ret | |
160 ; | 155 ; |
161 ; OPTM1-LABEL: add64BitSigned | 156 ; OPTM1-LABEL: add64BitSigned |
162 ; OPTM1: add | 157 ; OPTM1: add |
163 ; OPTM1: adc | 158 ; OPTM1: adc |
164 ; OPTM1: ret | |
165 | 159 |
166 define internal i64 @add64BitUnsigned(i64 %a, i64 %b) { | 160 define internal i64 @add64BitUnsigned(i64 %a, i64 %b) { |
167 entry: | 161 entry: |
168 %add = add i64 %b, %a | 162 %add = add i64 %b, %a |
169 ret i64 %add | 163 ret i64 %add |
170 } | 164 } |
171 ; CHECK-LABEL: add64BitUnsigned | 165 ; CHECK-LABEL: add64BitUnsigned |
172 ; CHECK: add | 166 ; CHECK: add |
173 ; CHECK: adc | 167 ; CHECK: adc |
174 ; CHECK: ret | |
175 ; | 168 ; |
176 ; OPTM1-LABEL: add64BitUnsigned | 169 ; OPTM1-LABEL: add64BitUnsigned |
177 ; OPTM1: add | 170 ; OPTM1: add |
178 ; OPTM1: adc | 171 ; OPTM1: adc |
179 ; OPTM1: ret | |
180 | 172 |
181 define internal i64 @sub64BitSigned(i64 %a, i64 %b) { | 173 define internal i64 @sub64BitSigned(i64 %a, i64 %b) { |
182 entry: | 174 entry: |
183 %sub = sub i64 %a, %b | 175 %sub = sub i64 %a, %b |
184 ret i64 %sub | 176 ret i64 %sub |
185 } | 177 } |
186 ; CHECK-LABEL: sub64BitSigned | 178 ; CHECK-LABEL: sub64BitSigned |
187 ; CHECK: sub | 179 ; CHECK: sub |
188 ; CHECK: sbb | 180 ; CHECK: sbb |
189 ; CHECK: ret | |
190 ; | 181 ; |
191 ; OPTM1-LABEL: sub64BitSigned | 182 ; OPTM1-LABEL: sub64BitSigned |
192 ; OPTM1: sub | 183 ; OPTM1: sub |
193 ; OPTM1: sbb | 184 ; OPTM1: sbb |
194 ; OPTM1: ret | |
195 | 185 |
196 define internal i64 @sub64BitUnsigned(i64 %a, i64 %b) { | 186 define internal i64 @sub64BitUnsigned(i64 %a, i64 %b) { |
197 entry: | 187 entry: |
198 %sub = sub i64 %a, %b | 188 %sub = sub i64 %a, %b |
199 ret i64 %sub | 189 ret i64 %sub |
200 } | 190 } |
201 ; CHECK-LABEL: sub64BitUnsigned | 191 ; CHECK-LABEL: sub64BitUnsigned |
202 ; CHECK: sub | 192 ; CHECK: sub |
203 ; CHECK: sbb | 193 ; CHECK: sbb |
204 ; CHECK: ret | |
205 ; | 194 ; |
206 ; OPTM1-LABEL: sub64BitUnsigned | 195 ; OPTM1-LABEL: sub64BitUnsigned |
207 ; OPTM1: sub | 196 ; OPTM1: sub |
208 ; OPTM1: sbb | 197 ; OPTM1: sbb |
209 ; OPTM1: ret | |
210 | 198 |
211 define internal i64 @mul64BitSigned(i64 %a, i64 %b) { | 199 define internal i64 @mul64BitSigned(i64 %a, i64 %b) { |
212 entry: | 200 entry: |
213 %mul = mul i64 %b, %a | 201 %mul = mul i64 %b, %a |
214 ret i64 %mul | 202 ret i64 %mul |
215 } | 203 } |
216 ; CHECK-LABEL: mul64BitSigned | 204 ; CHECK-LABEL: mul64BitSigned |
217 ; CHECK: imul | 205 ; CHECK: imul |
218 ; CHECK: imul | 206 ; CHECK: imul |
219 ; CHECK: mul | 207 ; CHECK: mul |
220 ; CHECK: add | 208 ; CHECK: add |
221 ; CHECK: add | 209 ; CHECK: add |
222 ; CHECK: ret | |
223 ; | 210 ; |
224 ; OPTM1-LABEL: mul64BitSigned | 211 ; OPTM1-LABEL: mul64BitSigned |
225 ; OPTM1: imul | 212 ; OPTM1: imul |
226 ; OPTM1: imul | 213 ; OPTM1: imul |
227 ; OPTM1: mul | 214 ; OPTM1: mul |
228 ; OPTM1: add | 215 ; OPTM1: add |
229 ; OPTM1: add | 216 ; OPTM1: add |
230 ; OPTM1: ret | |
231 | 217 |
232 define internal i64 @mul64BitUnsigned(i64 %a, i64 %b) { | 218 define internal i64 @mul64BitUnsigned(i64 %a, i64 %b) { |
233 entry: | 219 entry: |
234 %mul = mul i64 %b, %a | 220 %mul = mul i64 %b, %a |
235 ret i64 %mul | 221 ret i64 %mul |
236 } | 222 } |
237 ; CHECK-LABEL: mul64BitUnsigned | 223 ; CHECK-LABEL: mul64BitUnsigned |
238 ; CHECK: imul | 224 ; CHECK: imul |
239 ; CHECK: imul | 225 ; CHECK: imul |
240 ; CHECK: mul | 226 ; CHECK: mul |
241 ; CHECK: add | 227 ; CHECK: add |
242 ; CHECK: add | 228 ; CHECK: add |
243 ; CHECK: ret | |
244 ; | 229 ; |
245 ; OPTM1-LABEL: mul64BitUnsigned | 230 ; OPTM1-LABEL: mul64BitUnsigned |
246 ; OPTM1: imul | 231 ; OPTM1: imul |
247 ; OPTM1: imul | 232 ; OPTM1: imul |
248 ; OPTM1: mul | 233 ; OPTM1: mul |
249 ; OPTM1: add | 234 ; OPTM1: add |
250 ; OPTM1: add | 235 ; OPTM1: add |
251 ; OPTM1: ret | |
252 | 236 |
253 define internal i64 @div64BitSigned(i64 %a, i64 %b) { | 237 define internal i64 @div64BitSigned(i64 %a, i64 %b) { |
254 entry: | 238 entry: |
255 %div = sdiv i64 %a, %b | 239 %div = sdiv i64 %a, %b |
256 ret i64 %div | 240 ret i64 %div |
257 } | 241 } |
258 ; CHECK-LABEL: div64BitSigned | 242 ; CHECK-LABEL: div64BitSigned |
259 ; CALLTARGETS-LABEL: div64BitSigned | 243 ; CALLTARGETS-LABEL: div64BitSigned |
260 ; CHECK: call -4 | 244 ; CHECK: call -4 |
261 ; CALLTARGETS: call __divdi3 | 245 ; CALLTARGETS: call __divdi3 |
262 ; CHECK: ret | |
263 | 246 |
264 ; OPTM1-LABEL: div64BitSigned | 247 ; OPTM1-LABEL: div64BitSigned |
265 ; OPTM1: call -4 | 248 ; OPTM1: call -4 |
266 ; OPTM1: ret | |
267 | 249 |
268 define internal i64 @div64BitSignedConst(i64 %a) { | 250 define internal i64 @div64BitSignedConst(i64 %a) { |
269 entry: | 251 entry: |
270 %div = sdiv i64 %a, 12345678901234 | 252 %div = sdiv i64 %a, 12345678901234 |
271 ret i64 %div | 253 ret i64 %div |
272 } | 254 } |
273 ; CHECK-LABEL: div64BitSignedConst | 255 ; CHECK-LABEL: div64BitSignedConst |
274 ; CALLTARGETS-LABEL: div64BitSignedConst | 256 ; CALLTARGETS-LABEL: div64BitSignedConst |
275 ; CHECK: mov dword ptr [esp + 12], 2874 | 257 ; CHECK: mov dword ptr [esp + 12], 2874 |
276 ; CHECK: mov dword ptr [esp + 8], 1942892530 | 258 ; CHECK: mov dword ptr [esp + 8], 1942892530 |
277 ; CHECK: call -4 | 259 ; CHECK: call -4 |
278 ; CALLTARGETS: call __divdi3 | 260 ; CALLTARGETS: call __divdi3 |
279 ; CHECK: ret | |
280 ; | 261 ; |
281 ; OPTM1-LABEL: div64BitSignedConst | 262 ; OPTM1-LABEL: div64BitSignedConst |
282 ; OPTM1: mov dword ptr [esp + 12], 2874 | 263 ; OPTM1: mov dword ptr [esp + 12], 2874 |
283 ; OPTM1: mov dword ptr [esp + 8], 1942892530 | 264 ; OPTM1: mov dword ptr [esp + 8], 1942892530 |
284 ; OPTM1: call -4 | 265 ; OPTM1: call -4 |
285 ; OPTM1: ret | |
286 | 266 |
287 define internal i64 @div64BitUnsigned(i64 %a, i64 %b) { | 267 define internal i64 @div64BitUnsigned(i64 %a, i64 %b) { |
288 entry: | 268 entry: |
289 %div = udiv i64 %a, %b | 269 %div = udiv i64 %a, %b |
290 ret i64 %div | 270 ret i64 %div |
291 } | 271 } |
292 ; CHECK-LABEL: div64BitUnsigned | 272 ; CHECK-LABEL: div64BitUnsigned |
293 ; CALLTARGETS-LABEL: div64BitUnsigned | 273 ; CALLTARGETS-LABEL: div64BitUnsigned |
294 ; CHECK: call -4 | 274 ; CHECK: call -4 |
295 ; CALLTARGETS: call __udivdi3 | 275 ; CALLTARGETS: call __udivdi3 |
296 ; CHECK: ret | |
297 ; | 276 ; |
298 ; OPTM1-LABEL: div64BitUnsigned | 277 ; OPTM1-LABEL: div64BitUnsigned |
299 ; OPTM1: call -4 | 278 ; OPTM1: call -4 |
300 ; OPTM1: ret | |
301 | 279 |
302 define internal i64 @rem64BitSigned(i64 %a, i64 %b) { | 280 define internal i64 @rem64BitSigned(i64 %a, i64 %b) { |
303 entry: | 281 entry: |
304 %rem = srem i64 %a, %b | 282 %rem = srem i64 %a, %b |
305 ret i64 %rem | 283 ret i64 %rem |
306 } | 284 } |
307 ; CHECK-LABEL: rem64BitSigned | 285 ; CHECK-LABEL: rem64BitSigned |
308 ; CALLTARGETS-LABEL: rem64BitSigned | 286 ; CALLTARGETS-LABEL: rem64BitSigned |
309 ; CHECK: call -4 | 287 ; CHECK: call -4 |
310 ; CALLTARGETS: call __moddi3 | 288 ; CALLTARGETS: call __moddi3 |
311 ; CHECK: ret | |
312 ; | 289 ; |
313 ; OPTM1-LABEL: rem64BitSigned | 290 ; OPTM1-LABEL: rem64BitSigned |
314 ; OPTM1: call -4 | 291 ; OPTM1: call -4 |
315 ; OPTM1: ret | |
316 | 292 |
317 define internal i64 @rem64BitUnsigned(i64 %a, i64 %b) { | 293 define internal i64 @rem64BitUnsigned(i64 %a, i64 %b) { |
318 entry: | 294 entry: |
319 %rem = urem i64 %a, %b | 295 %rem = urem i64 %a, %b |
320 ret i64 %rem | 296 ret i64 %rem |
321 } | 297 } |
322 ; CHECK-LABEL: rem64BitUnsigned | 298 ; CHECK-LABEL: rem64BitUnsigned |
323 ; CALLTARGETS-LABEL: rem64BitUnsigned | 299 ; CALLTARGETS-LABEL: rem64BitUnsigned |
324 ; CHECK: call -4 | 300 ; CHECK: call -4 |
325 ; CALLTARGETS: call __umoddi3 | 301 ; CALLTARGETS: call __umoddi3 |
326 ; CHECK: ret | |
327 ; | 302 ; |
328 ; OPTM1-LABEL: rem64BitUnsigned | 303 ; OPTM1-LABEL: rem64BitUnsigned |
329 ; OPTM1: call -4 | 304 ; OPTM1: call -4 |
330 ; OPTM1: ret | |
331 | 305 |
332 define internal i64 @shl64BitSigned(i64 %a, i64 %b) { | 306 define internal i64 @shl64BitSigned(i64 %a, i64 %b) { |
333 entry: | 307 entry: |
334 %shl = shl i64 %a, %b | 308 %shl = shl i64 %a, %b |
335 ret i64 %shl | 309 ret i64 %shl |
336 } | 310 } |
337 ; CHECK-LABEL: shl64BitSigned | 311 ; CHECK-LABEL: shl64BitSigned |
338 ; CHECK: shld | 312 ; CHECK: shld |
339 ; CHECK: shl e | 313 ; CHECK: shl e |
340 ; CHECK: test {{.*}}, 32 | 314 ; CHECK: test {{.*}}, 32 |
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 ; OPTM1: xor | 451 ; OPTM1: xor |
478 ; OPTM1: xor | 452 ; OPTM1: xor |
479 | 453 |
480 define internal i32 @trunc64To32Signed(i64 %a) { | 454 define internal i32 @trunc64To32Signed(i64 %a) { |
481 entry: | 455 entry: |
482 %conv = trunc i64 %a to i32 | 456 %conv = trunc i64 %a to i32 |
483 ret i32 %conv | 457 ret i32 %conv |
484 } | 458 } |
485 ; CHECK-LABEL: trunc64To32Signed | 459 ; CHECK-LABEL: trunc64To32Signed |
486 ; CHECK: mov eax, dword ptr [esp + 4] | 460 ; CHECK: mov eax, dword ptr [esp + 4] |
487 ; CHECK-NEXT: ret | |
488 ; | 461 ; |
489 ; OPTM1-LABEL: trunc64To32Signed | 462 ; OPTM1-LABEL: trunc64To32Signed |
490 ; OPTM1: mov eax, dword ptr [esp + | 463 ; OPTM1: mov eax, dword ptr [esp + |
491 ; OPTM1: ret | |
492 | 464 |
493 define internal i32 @trunc64To16Signed(i64 %a) { | 465 define internal i32 @trunc64To16Signed(i64 %a) { |
494 entry: | 466 entry: |
495 %conv = trunc i64 %a to i16 | 467 %conv = trunc i64 %a to i16 |
496 %conv.ret_ext = sext i16 %conv to i32 | 468 %conv.ret_ext = sext i16 %conv to i32 |
497 ret i32 %conv.ret_ext | 469 ret i32 %conv.ret_ext |
498 } | 470 } |
499 ; CHECK-LABEL: trunc64To16Signed | 471 ; CHECK-LABEL: trunc64To16Signed |
500 ; CHECK: mov eax, dword ptr [esp + 4] | 472 ; CHECK: mov eax, dword ptr [esp + 4] |
501 ; CHECK-NEXT: movsx eax, ax | 473 ; CHECK-NEXT: movsx eax, ax |
502 ; CHECK-NEXT: ret | |
503 ; | 474 ; |
504 ; OPTM1-LABEL: trunc64To16Signed | 475 ; OPTM1-LABEL: trunc64To16Signed |
505 ; OPTM1: mov eax, dword ptr [esp + | 476 ; OPTM1: mov eax, dword ptr [esp + |
506 ; OPTM1: movsx eax, | 477 ; OPTM1: movsx eax, |
507 ; OPTM1: ret | |
508 | 478 |
509 define internal i32 @trunc64To8Signed(i64 %a) { | 479 define internal i32 @trunc64To8Signed(i64 %a) { |
510 entry: | 480 entry: |
511 %conv = trunc i64 %a to i8 | 481 %conv = trunc i64 %a to i8 |
512 %conv.ret_ext = sext i8 %conv to i32 | 482 %conv.ret_ext = sext i8 %conv to i32 |
513 ret i32 %conv.ret_ext | 483 ret i32 %conv.ret_ext |
514 } | 484 } |
515 ; CHECK-LABEL: trunc64To8Signed | 485 ; CHECK-LABEL: trunc64To8Signed |
516 ; CHECK: mov eax, dword ptr [esp + 4] | 486 ; CHECK: mov eax, dword ptr [esp + 4] |
517 ; CHECK-NEXT: movsx eax, al | 487 ; CHECK-NEXT: movsx eax, al |
518 ; CHECK-NEXT: ret | |
519 ; | 488 ; |
520 ; OPTM1-LABEL: trunc64To8Signed | 489 ; OPTM1-LABEL: trunc64To8Signed |
521 ; OPTM1: mov eax, dword ptr [esp + | 490 ; OPTM1: mov eax, dword ptr [esp + |
522 ; OPTM1: movsx eax, | 491 ; OPTM1: movsx eax, |
523 ; OPTM1: ret | |
524 | 492 |
525 define internal i32 @trunc64To32SignedConst() { | 493 define internal i32 @trunc64To32SignedConst() { |
526 entry: | 494 entry: |
527 %conv = trunc i64 12345678901234 to i32 | 495 %conv = trunc i64 12345678901234 to i32 |
528 ret i32 %conv | 496 ret i32 %conv |
529 } | 497 } |
530 ; CHECK-LABEL: trunc64To32SignedConst | 498 ; CHECK-LABEL: trunc64To32SignedConst |
531 ; CHECK: mov eax, 1942892530 | 499 ; CHECK: mov eax, 1942892530 |
532 ; | 500 ; |
533 ; OPTM1-LABEL: trunc64To32SignedConst | 501 ; OPTM1-LABEL: trunc64To32SignedConst |
(...skipping 13 matching lines...) Expand all Loading... |
547 ; OPTM1: mov eax, 1942892530 | 515 ; OPTM1: mov eax, 1942892530 |
548 ; OPTM1: movsx eax, | 516 ; OPTM1: movsx eax, |
549 | 517 |
550 define internal i32 @trunc64To32Unsigned(i64 %a) { | 518 define internal i32 @trunc64To32Unsigned(i64 %a) { |
551 entry: | 519 entry: |
552 %conv = trunc i64 %a to i32 | 520 %conv = trunc i64 %a to i32 |
553 ret i32 %conv | 521 ret i32 %conv |
554 } | 522 } |
555 ; CHECK-LABEL: trunc64To32Unsigned | 523 ; CHECK-LABEL: trunc64To32Unsigned |
556 ; CHECK: mov eax, dword ptr [esp + 4] | 524 ; CHECK: mov eax, dword ptr [esp + 4] |
557 ; CHECK-NEXT: ret | |
558 ; | 525 ; |
559 ; OPTM1-LABEL: trunc64To32Unsigned | 526 ; OPTM1-LABEL: trunc64To32Unsigned |
560 ; OPTM1: mov eax, dword ptr [esp + | 527 ; OPTM1: mov eax, dword ptr [esp + |
561 ; OPTM1: ret | |
562 | 528 |
563 define internal i32 @trunc64To16Unsigned(i64 %a) { | 529 define internal i32 @trunc64To16Unsigned(i64 %a) { |
564 entry: | 530 entry: |
565 %conv = trunc i64 %a to i16 | 531 %conv = trunc i64 %a to i16 |
566 %conv.ret_ext = zext i16 %conv to i32 | 532 %conv.ret_ext = zext i16 %conv to i32 |
567 ret i32 %conv.ret_ext | 533 ret i32 %conv.ret_ext |
568 } | 534 } |
569 ; CHECK-LABEL: trunc64To16Unsigned | 535 ; CHECK-LABEL: trunc64To16Unsigned |
570 ; CHECK: mov eax, dword ptr [esp + 4] | 536 ; CHECK: mov eax, dword ptr [esp + 4] |
571 ; CHECK-NEXT: movzx eax, ax | 537 ; CHECK-NEXT: movzx eax, ax |
572 ; CHECK-NEXT: ret | |
573 ; | 538 ; |
574 ; OPTM1-LABEL: trunc64To16Unsigned | 539 ; OPTM1-LABEL: trunc64To16Unsigned |
575 ; OPTM1: mov eax, dword ptr [esp + | 540 ; OPTM1: mov eax, dword ptr [esp + |
576 ; OPTM1: movzx eax, | 541 ; OPTM1: movzx eax, |
577 ; OPTM1: ret | |
578 | 542 |
579 define internal i32 @trunc64To8Unsigned(i64 %a) { | 543 define internal i32 @trunc64To8Unsigned(i64 %a) { |
580 entry: | 544 entry: |
581 %conv = trunc i64 %a to i8 | 545 %conv = trunc i64 %a to i8 |
582 %conv.ret_ext = zext i8 %conv to i32 | 546 %conv.ret_ext = zext i8 %conv to i32 |
583 ret i32 %conv.ret_ext | 547 ret i32 %conv.ret_ext |
584 } | 548 } |
585 ; CHECK-LABEL: trunc64To8Unsigned | 549 ; CHECK-LABEL: trunc64To8Unsigned |
586 ; CHECK: mov eax, dword ptr [esp + 4] | 550 ; CHECK: mov eax, dword ptr [esp + 4] |
587 ; CHECK-NEXT: movzx eax, al | 551 ; CHECK-NEXT: movzx eax, al |
588 ; CHECK-NEXT: ret | |
589 ; | 552 ; |
590 ; OPTM1-LABEL: trunc64To8Unsigned | 553 ; OPTM1-LABEL: trunc64To8Unsigned |
591 ; OPTM1: mov eax, dword ptr [esp + | 554 ; OPTM1: mov eax, dword ptr [esp + |
592 ; OPTM1: movzx eax, | 555 ; OPTM1: movzx eax, |
593 ; OPTM1: ret | |
594 | 556 |
595 define internal i32 @trunc64To1(i64 %a) { | 557 define internal i32 @trunc64To1(i64 %a) { |
596 entry: | 558 entry: |
597 ; %tobool = icmp ne i64 %a, 0 | 559 ; %tobool = icmp ne i64 %a, 0 |
598 %tobool = trunc i64 %a to i1 | 560 %tobool = trunc i64 %a to i1 |
599 %tobool.ret_ext = zext i1 %tobool to i32 | 561 %tobool.ret_ext = zext i1 %tobool to i32 |
600 ret i32 %tobool.ret_ext | 562 ret i32 %tobool.ret_ext |
601 } | 563 } |
602 ; CHECK-LABEL: trunc64To1 | 564 ; CHECK-LABEL: trunc64To1 |
603 ; CHECK: mov eax, dword ptr [esp + 4] | 565 ; CHECK: mov eax, dword ptr [esp + 4] |
604 ; CHECK: and eax, 1 | 566 ; CHECK: and eax, 1 |
605 ; CHECK-NEXT: ret | 567 ; CHECK: and eax, 1 |
606 ; | 568 ; |
607 ; OPTM1-LABEL: trunc64To1 | 569 ; OPTM1-LABEL: trunc64To1 |
608 ; OPTM1: mov eax, dword ptr [esp + | 570 ; OPTM1: mov eax, dword ptr [esp + |
609 ; OPTM1: and eax, 1 | 571 ; OPTM1: and eax, 1 |
610 ; OPTM1: ret | 572 ; OPTM1: and eax, 1 |
611 | 573 |
612 define internal i64 @sext32To64(i32 %a) { | 574 define internal i64 @sext32To64(i32 %a) { |
613 entry: | 575 entry: |
614 %conv = sext i32 %a to i64 | 576 %conv = sext i32 %a to i64 |
615 ret i64 %conv | 577 ret i64 %conv |
616 } | 578 } |
617 ; CHECK-LABEL: sext32To64 | 579 ; CHECK-LABEL: sext32To64 |
618 ; CHECK: mov | 580 ; CHECK: mov |
619 ; CHECK: sar {{.*}}, 31 | 581 ; CHECK: sar {{.*}}, 31 |
620 ; | 582 ; |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
653 define internal i64 @sext1To64(i32 %a) { | 615 define internal i64 @sext1To64(i32 %a) { |
654 entry: | 616 entry: |
655 %a.arg_trunc = trunc i32 %a to i1 | 617 %a.arg_trunc = trunc i32 %a to i1 |
656 %conv = sext i1 %a.arg_trunc to i64 | 618 %conv = sext i1 %a.arg_trunc to i64 |
657 ret i64 %conv | 619 ret i64 %conv |
658 } | 620 } |
659 ; CHECK-LABEL: sext1To64 | 621 ; CHECK-LABEL: sext1To64 |
660 ; CHECK: mov | 622 ; CHECK: mov |
661 ; CHECK: shl {{.*}}, 31 | 623 ; CHECK: shl {{.*}}, 31 |
662 ; CHECK: sar {{.*}}, 31 | 624 ; CHECK: sar {{.*}}, 31 |
663 ; CHECK: sar {{.*}}, 31 | |
664 ; | 625 ; |
665 ; OPTM1-LABEL: sext1To64 | 626 ; OPTM1-LABEL: sext1To64 |
666 ; OPTM1: mov | 627 ; OPTM1: mov |
667 ; OPTM1: shl {{.*}}, 31 | 628 ; OPTM1: shl {{.*}}, 31 |
668 ; OPTM1: sar {{.*}}, 31 | 629 ; OPTM1: sar {{.*}}, 31 |
669 ; OPTM1: sar {{.*}}, 31 | |
670 | 630 |
671 define internal i64 @zext32To64(i32 %a) { | 631 define internal i64 @zext32To64(i32 %a) { |
672 entry: | 632 entry: |
673 %conv = zext i32 %a to i64 | 633 %conv = zext i32 %a to i64 |
674 ret i64 %conv | 634 ret i64 %conv |
675 } | 635 } |
676 ; CHECK-LABEL: zext32To64 | 636 ; CHECK-LABEL: zext32To64 |
677 ; CHECK: mov | 637 ; CHECK: mov |
678 ; CHECK: mov {{.*}}, 0 | 638 ; CHECK: mov {{.*}}, 0 |
679 ; | 639 ; |
(...skipping 631 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1311 } | 1271 } |
1312 ; The following checks are not strictly necessary since one of the RUN | 1272 ; The following checks are not strictly necessary since one of the RUN |
1313 ; lines actually runs the output through the assembler. | 1273 ; lines actually runs the output through the assembler. |
1314 ; CHECK-LABEL: icmpLt64Imm | 1274 ; CHECK-LABEL: icmpLt64Imm |
1315 ; CHECK-NOT: cmp {{[0-9]+}}, | 1275 ; CHECK-NOT: cmp {{[0-9]+}}, |
1316 ; OPTM1-LABEL: icmpLt64Imm | 1276 ; OPTM1-LABEL: icmpLt64Imm |
1317 ; OPTM1-NOT: cmp {{[0-9]+}}, | 1277 ; OPTM1-NOT: cmp {{[0-9]+}}, |
1318 | 1278 |
1319 ; ERRORS-NOT: ICE translation error | 1279 ; ERRORS-NOT: ICE translation error |
1320 ; DUMP-NOT: SZ | 1280 ; DUMP-NOT: SZ |
OLD | NEW |