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 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ | 5 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ |
6 ; RUN: --target x8632 -i %s --args -O2 \ | 6 ; RUN: --target x8632 -i %s --args -O2 \ |
7 ; RUN: | %if --need=target_X8632 --command FileCheck %s | 7 ; RUN: | %if --need=target_X8632 --command FileCheck %s |
8 | 8 |
9 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ | 9 ; RUN: %if --need=target_X8632 --command %p2i --filetype=obj --disassemble \ |
10 ; RUN: --target x8632 -i %s --args -Om1 \ | 10 ; RUN: --target x8632 -i %s --args -Om1 \ |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 ; OPTM1: sub esp | 84 ; OPTM1: sub esp |
85 ; OPTM1: mov DWORD PTR [esp+0x4] | 85 ; OPTM1: mov DWORD PTR [esp+0x4] |
86 ; OPTM1: mov DWORD PTR [esp] | 86 ; OPTM1: mov DWORD PTR [esp] |
87 ; OPTM1: mov DWORD PTR [esp+0x8],0x7b | 87 ; OPTM1: mov DWORD PTR [esp+0x8],0x7b |
88 ; OPTM1: mov DWORD PTR [esp+0x10] | 88 ; OPTM1: mov DWORD PTR [esp+0x10] |
89 ; OPTM1: mov DWORD PTR [esp+0xc] | 89 ; OPTM1: mov DWORD PTR [esp+0xc] |
90 ; OPTM1: call {{.*}} R_{{.*}} ignore64BitArgNoInline | 90 ; OPTM1: call {{.*}} R_{{.*}} ignore64BitArgNoInline |
91 | 91 |
92 ; ARM32-LABEL: pass64BitArg | 92 ; ARM32-LABEL: pass64BitArg |
93 ; ARM32: sub sp, {{.*}} #16 | 93 ; ARM32: sub sp, {{.*}} #16 |
94 ; ARM32: str {{.*}}, [sp, #4] | |
95 ; ARM32: str {{.*}}, [sp] | 94 ; ARM32: str {{.*}}, [sp] |
96 ; ARM32: movw r2, #123 | 95 ; ARM32: movw r2, #123 |
97 ; ARM32: bl {{.*}} ignore64BitArgNoInline | 96 ; ARM32: bl {{.*}} ignore64BitArgNoInline |
98 ; ARM32: add sp, {{.*}} #16 | 97 ; ARM32: add sp, {{.*}} #16 |
99 ; ARM32: sub sp, {{.*}} #16 | 98 ; ARM32: sub sp, {{.*}} #16 |
100 ; ARM32: str {{.*}}, [sp, #4] | |
101 ; ARM32: str {{.*}}, [sp] | 99 ; ARM32: str {{.*}}, [sp] |
102 ; ARM32: {{mov|ldr}} r0 | 100 ; ARM32: {{mov|ldr}} r0 |
103 ; ARM32: {{mov|ldr}} r1 | 101 ; ARM32: {{mov|ldr}} r1 |
104 ; ARM32: movw r2, #123 | 102 ; ARM32: movw r2, #123 |
105 ; ARM32: bl {{.*}} ignore64BitArgNoInline | 103 ; ARM32: bl {{.*}} ignore64BitArgNoInline |
106 ; ARM32: add sp, {{.*}} #16 | 104 ; ARM32: add sp, {{.*}} #16 |
107 ; ARM32: sub sp, {{.*}} #16 | 105 ; ARM32: sub sp, {{.*}} #16 |
108 ; ARM32: str {{.*}}, [sp, #4] | |
109 ; ARM32: str {{.*}}, [sp] | 106 ; ARM32: str {{.*}}, [sp] |
110 ; ARM32: {{mov|ldr}} r0 | 107 ; ARM32: {{mov|ldr}} r0 |
111 ; ARM32: {{mov|ldr}} r1 | 108 ; ARM32: {{mov|ldr}} r1 |
112 ; ARM32: movw r2, #123 | 109 ; ARM32: movw r2, #123 |
113 ; ARM32: bl {{.*}} ignore64BitArgNoInline | 110 ; ARM32: bl {{.*}} ignore64BitArgNoInline |
114 ; ARM32: add sp, {{.*}} #16 | 111 ; ARM32: add sp, {{.*}} #16 |
115 | 112 |
116 | 113 |
117 declare i32 @ignore64BitArgNoInline(i64, i32, i64) | 114 declare i32 @ignore64BitArgNoInline(i64, i32, i64) |
118 | 115 |
(...skipping 21 matching lines...) Expand all Loading... |
140 ; OPTM1-NEXT: mov DWORD PTR [esp+0x8],0x7b | 137 ; OPTM1-NEXT: mov DWORD PTR [esp+0x8],0x7b |
141 ; Bundle padding might be added (so not using -NEXT). | 138 ; Bundle padding might be added (so not using -NEXT). |
142 ; OPTM1: mov DWORD PTR [esp+0x10],0xdeadbeef | 139 ; OPTM1: mov DWORD PTR [esp+0x10],0xdeadbeef |
143 ; OPTM1-NEXT: mov DWORD PTR [esp+0xc],0x12345678 | 140 ; OPTM1-NEXT: mov DWORD PTR [esp+0xc],0x12345678 |
144 ; OPTM1-NOT: mov | 141 ; OPTM1-NOT: mov |
145 ; OPTM1: call {{.*}} R_{{.*}} ignore64BitArgNoInline | 142 ; OPTM1: call {{.*}} R_{{.*}} ignore64BitArgNoInline |
146 | 143 |
147 ; ARM32-LABEL: pass64BitConstArg | 144 ; ARM32-LABEL: pass64BitConstArg |
148 ; ARM32: sub sp, {{.*}} #16 | 145 ; ARM32: sub sp, {{.*}} #16 |
149 ; ARM32: movw [[REG1:r.*]], {{.*}} ; 0xbeef | 146 ; ARM32: movw [[REG1:r.*]], {{.*}} ; 0xbeef |
150 ; ARM32: movt [[REG1:r.*]], {{.*}} ; 0xdead | 147 ; ARM32: movt [[REG1]], {{.*}} ; 0xdead |
151 ; ARM32: movw [[REG2:r.*]], {{.*}} ; 0x5678 | 148 ; ARM32: movw [[REG2:r.*]], {{.*}} ; 0x5678 |
152 ; ARM32: movt [[REG2:r.*]], {{.*}} ; 0x1234 | 149 ; ARM32: movt [[REG2]], {{.*}} ; 0x1234 |
153 ; ARM32: str [[REG1]], [sp, #4] | 150 ; ARM32: str [[REG1]], [sp, #4] |
154 ; ARM32: str [[REG2]], [sp] | 151 ; ARM32: str [[REG2]], [sp] |
155 ; ARM32: {{mov|ldr}} r0 | 152 ; ARM32: {{mov|ldr}} r0 |
156 ; ARM32: {{mov|ldr}} r1 | 153 ; ARM32: {{mov|ldr}} r1 |
157 ; ARM32: movw r2, #123 | 154 ; ARM32: movw r2, #123 |
158 ; ARM32: bl {{.*}} ignore64BitArgNoInline | 155 ; ARM32: bl {{.*}} ignore64BitArgNoInline |
159 ; ARM32: add sp, {{.*}} #16 | 156 ; ARM32: add sp, {{.*}} #16 |
160 | 157 |
161 define internal i32 @pass64BitUndefArg() { | 158 define internal i32 @pass64BitUndefArg() { |
162 entry: | 159 entry: |
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
431 ; CHECK: test {{.*}},0x20 | 428 ; CHECK: test {{.*}},0x20 |
432 ; CHECK: je | 429 ; CHECK: je |
433 ; | 430 ; |
434 ; OPTM1-LABEL: shl64BitSigned | 431 ; OPTM1-LABEL: shl64BitSigned |
435 ; OPTM1: shld | 432 ; OPTM1: shld |
436 ; OPTM1: shl e | 433 ; OPTM1: shl e |
437 ; OPTM1: test {{.*}},0x20 | 434 ; OPTM1: test {{.*}},0x20 |
438 ; OPTM1: je | 435 ; OPTM1: je |
439 | 436 |
440 ; ARM32-LABEL: shl64BitSigned | 437 ; ARM32-LABEL: shl64BitSigned |
441 ; ARM32: sub [[REG3:r.*]], [[REG2:r.*]], #32 | 438 ; ARM32: rsb [[T0:r[0-9]+]], r2, #32 |
442 ; ARM32: lsl [[REG1:r.*]], {{r.*}}, [[REG2]] | 439 ; ARM32: lsr [[T1:r[0-9]+]], r0, [[T0]] |
443 ; ARM32: orr [[REG1]], [[REG1]], [[REG0:r.*]], lsl [[REG3]] | 440 ; ARM32: orr [[T2:r[0-9]+]], [[T1]], r1, lsl r2 |
444 ; ARM32: rsb [[REG4:r.*]], [[REG2]], #32 | 441 ; ARM32: sub [[T3:r[0-9]+]], r2, #32 |
445 ; ARM32: orr [[REG1]], [[REG1]], [[REG0]], lsr [[REG4]] | 442 ; ARM32: cmp [[T3]], #0 |
446 ; ARM32: lsl {{.*}}, [[REG0]], [[REG2]] | 443 ; ARM32: lslge [[T2]], r0, [[T3]] |
| 444 ; ARM32: lsl r{{[0-9]+}}, r0, r2 |
447 | 445 |
448 define internal i32 @shl64BitSignedTrunc(i64 %a, i64 %b) { | 446 define internal i32 @shl64BitSignedTrunc(i64 %a, i64 %b) { |
449 entry: | 447 entry: |
450 %shl = shl i64 %a, %b | 448 %shl = shl i64 %a, %b |
451 %result = trunc i64 %shl to i32 | 449 %result = trunc i64 %shl to i32 |
452 ret i32 %result | 450 ret i32 %result |
453 } | 451 } |
454 ; CHECK-LABEL: shl64BitSignedTrunc | 452 ; CHECK-LABEL: shl64BitSignedTrunc |
455 ; CHECK: mov | 453 ; CHECK: mov |
456 ; CHECK: shl e | 454 ; CHECK: shl e |
(...skipping 20 matching lines...) Expand all Loading... |
477 ; CHECK: test {{.*}},0x20 | 475 ; CHECK: test {{.*}},0x20 |
478 ; CHECK: je | 476 ; CHECK: je |
479 ; | 477 ; |
480 ; OPTM1-LABEL: shl64BitUnsigned | 478 ; OPTM1-LABEL: shl64BitUnsigned |
481 ; OPTM1: shld | 479 ; OPTM1: shld |
482 ; OPTM1: shl e | 480 ; OPTM1: shl e |
483 ; OPTM1: test {{.*}},0x20 | 481 ; OPTM1: test {{.*}},0x20 |
484 ; OPTM1: je | 482 ; OPTM1: je |
485 | 483 |
486 ; ARM32-LABEL: shl64BitUnsigned | 484 ; ARM32-LABEL: shl64BitUnsigned |
| 485 ; ARM32: rsb |
| 486 ; ARM32: lsr |
| 487 ; ARM32: orr |
487 ; ARM32: sub | 488 ; ARM32: sub |
488 ; ARM32: lsl | 489 ; ARM32: cmp |
489 ; ARM32: orr | 490 ; ARM32: lslge |
490 ; ARM32: rsb | |
491 ; ARM32: orr | |
492 ; ARM32: lsl | 491 ; ARM32: lsl |
493 | 492 |
494 define internal i64 @shr64BitSigned(i64 %a, i64 %b) { | 493 define internal i64 @shr64BitSigned(i64 %a, i64 %b) { |
495 entry: | 494 entry: |
496 %shr = ashr i64 %a, %b | 495 %shr = ashr i64 %a, %b |
497 ret i64 %shr | 496 ret i64 %shr |
498 } | 497 } |
499 ; CHECK-LABEL: shr64BitSigned | 498 ; CHECK-LABEL: shr64BitSigned |
500 ; CHECK: shrd | 499 ; CHECK: shrd |
501 ; CHECK: sar | 500 ; CHECK: sar |
502 ; CHECK: test {{.*}},0x20 | 501 ; CHECK: test {{.*}},0x20 |
503 ; CHECK: je | 502 ; CHECK: je |
504 ; CHECK: sar {{.*}},0x1f | 503 ; CHECK: sar {{.*}},0x1f |
505 ; | 504 ; |
506 ; OPTM1-LABEL: shr64BitSigned | 505 ; OPTM1-LABEL: shr64BitSigned |
507 ; OPTM1: shrd | 506 ; OPTM1: shrd |
508 ; OPTM1: sar | 507 ; OPTM1: sar |
509 ; OPTM1: test {{.*}},0x20 | 508 ; OPTM1: test {{.*}},0x20 |
510 ; OPTM1: je | 509 ; OPTM1: je |
511 ; OPTM1: sar {{.*}},0x1f | 510 ; OPTM1: sar {{.*}},0x1f |
512 | 511 |
513 ; ARM32-LABEL: shr64BitSigned | 512 ; ARM32-LABEL: shr64BitSigned |
514 ; ARM32: rsb | 513 ; ARM32: lsr [[T0:r[0-9]+]], r0, r2 |
515 ; ARM32: lsr | 514 ; ARM32: rsb [[T1:r[0-9]+]], r2, #32 |
516 ; ARM32: orr | 515 ; ARM32: orr r0, [[T0]], r1, lsl [[T1]] |
517 ; ARM32: subs | 516 ; ARM32: sub [[T2:r[0-9]+]], r2, #32 |
518 ; ARM32: orrpl | 517 ; ARM32: cmp [[T2]], #0 |
519 ; ARM32: asr | 518 ; ARM32: asrge r0, r1, [[T2]] |
| 519 ; ARM32: asr r{{[0-9]+}}, r1, r2 |
520 | 520 |
521 define internal i32 @shr64BitSignedTrunc(i64 %a, i64 %b) { | 521 define internal i32 @shr64BitSignedTrunc(i64 %a, i64 %b) { |
522 entry: | 522 entry: |
523 %shr = ashr i64 %a, %b | 523 %shr = ashr i64 %a, %b |
524 %result = trunc i64 %shr to i32 | 524 %result = trunc i64 %shr to i32 |
525 ret i32 %result | 525 ret i32 %result |
526 } | 526 } |
527 ; CHECK-LABEL: shr64BitSignedTrunc | 527 ; CHECK-LABEL: shr64BitSignedTrunc |
528 ; CHECK: shrd | 528 ; CHECK: shrd |
529 ; CHECK: sar | 529 ; CHECK: sar |
530 ; CHECK: test {{.*}},0x20 | 530 ; CHECK: test {{.*}},0x20 |
531 ; CHECK: je | 531 ; CHECK: je |
532 ; | 532 ; |
533 ; OPTM1-LABEL: shr64BitSignedTrunc | 533 ; OPTM1-LABEL: shr64BitSignedTrunc |
534 ; OPTM1: shrd | 534 ; OPTM1: shrd |
535 ; OPTM1: sar | 535 ; OPTM1: sar |
536 ; OPTM1: test {{.*}},0x20 | 536 ; OPTM1: test {{.*}},0x20 |
537 ; OPTM1: je | 537 ; OPTM1: je |
538 ; OPTM1: sar {{.*}},0x1f | 538 ; OPTM1: sar {{.*}},0x1f |
539 | 539 |
540 ; ARM32-LABEL: shr64BitSignedTrunc | 540 ; ARM32-LABEL: shr64BitSignedTrunc |
| 541 ; ARM32: lsr |
541 ; ARM32: rsb | 542 ; ARM32: rsb |
542 ; ARM32: lsr | |
543 ; ARM32: orr | 543 ; ARM32: orr |
544 ; ARM32: subs | 544 ; ARM32: sub |
545 ; ARM32: orrpl | 545 ; ARM32: cmp |
| 546 ; ARM32: asrge |
546 | 547 |
547 define internal i64 @shr64BitUnsigned(i64 %a, i64 %b) { | 548 define internal i64 @shr64BitUnsigned(i64 %a, i64 %b) { |
548 entry: | 549 entry: |
549 %shr = lshr i64 %a, %b | 550 %shr = lshr i64 %a, %b |
550 ret i64 %shr | 551 ret i64 %shr |
551 } | 552 } |
552 ; CHECK-LABEL: shr64BitUnsigned | 553 ; CHECK-LABEL: shr64BitUnsigned |
553 ; CHECK: shrd | 554 ; CHECK: shrd |
554 ; CHECK: shr | 555 ; CHECK: shr |
555 ; CHECK: test {{.*}},0x20 | 556 ; CHECK: test {{.*}},0x20 |
556 ; CHECK: je | 557 ; CHECK: je |
557 ; | 558 ; |
558 ; OPTM1-LABEL: shr64BitUnsigned | 559 ; OPTM1-LABEL: shr64BitUnsigned |
559 ; OPTM1: shrd | 560 ; OPTM1: shrd |
560 ; OPTM1: shr | 561 ; OPTM1: shr |
561 ; OPTM1: test {{.*}},0x20 | 562 ; OPTM1: test {{.*}},0x20 |
562 ; OPTM1: je | 563 ; OPTM1: je |
563 | 564 |
564 ; ARM32-LABEL: shr64BitUnsigned | 565 ; ARM32-LABEL: shr64BitUnsigned |
| 566 ; ARM32: lsr |
565 ; ARM32: rsb | 567 ; ARM32: rsb |
566 ; ARM32: lsr | |
567 ; ARM32: orr | 568 ; ARM32: orr |
568 ; ARM32: sub | 569 ; ARM32: sub |
569 ; ARM32: orr | 570 ; ARM32: cmp |
| 571 ; ARM32: lsrge |
570 ; ARM32: lsr | 572 ; ARM32: lsr |
571 | 573 |
572 define internal i32 @shr64BitUnsignedTrunc(i64 %a, i64 %b) { | 574 define internal i32 @shr64BitUnsignedTrunc(i64 %a, i64 %b) { |
573 entry: | 575 entry: |
574 %shr = lshr i64 %a, %b | 576 %shr = lshr i64 %a, %b |
575 %result = trunc i64 %shr to i32 | 577 %result = trunc i64 %shr to i32 |
576 ret i32 %result | 578 ret i32 %result |
577 } | 579 } |
578 ; CHECK-LABEL: shr64BitUnsignedTrunc | 580 ; CHECK-LABEL: shr64BitUnsignedTrunc |
579 ; CHECK: shrd | 581 ; CHECK: shrd |
580 ; CHECK: shr | 582 ; CHECK: shr |
581 ; CHECK: test {{.*}},0x20 | 583 ; CHECK: test {{.*}},0x20 |
582 ; CHECK: je | 584 ; CHECK: je |
583 ; | 585 ; |
584 ; OPTM1-LABEL: shr64BitUnsignedTrunc | 586 ; OPTM1-LABEL: shr64BitUnsignedTrunc |
585 ; OPTM1: shrd | 587 ; OPTM1: shrd |
586 ; OPTM1: shr | 588 ; OPTM1: shr |
587 ; OPTM1: test {{.*}},0x20 | 589 ; OPTM1: test {{.*}},0x20 |
588 ; OPTM1: je | 590 ; OPTM1: je |
589 | 591 |
590 ; ARM32-LABEL: shr64BitUnsignedTrunc | 592 ; ARM32-LABEL: shr64BitUnsignedTrunc |
| 593 ; ARM32: lsr |
591 ; ARM32: rsb | 594 ; ARM32: rsb |
592 ; ARM32: lsr | |
593 ; ARM32: orr | 595 ; ARM32: orr |
594 ; ARM32: sub | 596 ; ARM32: sub |
595 ; ARM32: orr | 597 ; ARM32: cmp |
| 598 ; ARM32: lsrge |
596 | 599 |
597 define internal i64 @and64BitSigned(i64 %a, i64 %b) { | 600 define internal i64 @and64BitSigned(i64 %a, i64 %b) { |
598 entry: | 601 entry: |
599 %and = and i64 %b, %a | 602 %and = and i64 %b, %a |
600 ret i64 %and | 603 ret i64 %and |
601 } | 604 } |
602 ; CHECK-LABEL: and64BitSigned | 605 ; CHECK-LABEL: and64BitSigned |
603 ; CHECK: and | 606 ; CHECK: and |
604 ; CHECK: and | 607 ; CHECK: and |
605 ; | 608 ; |
(...skipping 1199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1805 ; CHECK-LABEL: phi64Undef | 1808 ; CHECK-LABEL: phi64Undef |
1806 ; CHECK: mov {{.*}},0x0 | 1809 ; CHECK: mov {{.*}},0x0 |
1807 ; CHECK: mov {{.*}},0x0 | 1810 ; CHECK: mov {{.*}},0x0 |
1808 ; OPTM1-LABEL: phi64Undef | 1811 ; OPTM1-LABEL: phi64Undef |
1809 ; OPTM1: mov {{.*}},0x0 | 1812 ; OPTM1: mov {{.*}},0x0 |
1810 ; OPTM1: mov {{.*}},0x0 | 1813 ; OPTM1: mov {{.*}},0x0 |
1811 ; ARM32-LABEL: phi64Undef | 1814 ; ARM32-LABEL: phi64Undef |
1812 ; ARM32: mov {{.*}} #0 | 1815 ; ARM32: mov {{.*}} #0 |
1813 ; ARM32: mov {{.*}} #0 | 1816 ; ARM32: mov {{.*}} #0 |
1814 | 1817 |
OLD | NEW |