Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 ; This tests some of the subtleties of Phi lowering. In particular, | |
| 2 ; it tests that it does the right thing when it tries to enable | |
| 3 ; compare/branch fusing. | |
| 4 | |
| 5 ; RUN: %llvm2ice -O2 --verbose none --no-phi-edge-split %s \ | |
| 6 ; RUN: | llvm-mc -triple=i686-none-nacl -x86-asm-syntax=intel -filetype=obj \ | |
| 7 ; RUN: | llvm-objdump -d -symbolize -x86-asm-syntax=intel - | FileCheck %s | |
| 8 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s | |
| 9 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s | |
| 10 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ | |
| 11 ; RUN: | FileCheck --check-prefix=DUMP %s | |
| 12 | |
| 13 define internal i32 @testPhi1(i32 %arg) { | |
| 14 entry: | |
| 15 %cmp1 = icmp sgt i32 %arg, 0 | |
| 16 br i1 %cmp1, label %next, label %target | |
| 17 next: | |
| 18 br label %target | |
| 19 target: | |
| 20 %merge = phi i1 [ %cmp1, %entry ], [ false, %next ] | |
| 21 %result = zext i1 %merge to i32 | |
| 22 ret i32 %result | |
| 23 } | |
| 24 ; Test that compare/branch fusing does not happen, and Phi lowering is | |
| 25 ; put in the right place. | |
| 26 ; CHECK-LABEL: testPhi1 | |
| 27 ; CHECK: cmp {{.*}}, 0 | |
| 28 ; CHECK: mov {{.*}}, 1 | |
| 29 ; CHECK: jg | |
| 30 ; CHECK: mov {{.*}}, 0 | |
| 31 ; CHECK: mov [[PHI:.*]], | |
| 32 ; CHECK: cmp {{.*}}, 0 | |
|
jvoung (off chromium)
2014/09/10 17:17:43
Would it be clearer to check for another jump? (th
Jim Stichnoth
2014/09/10 18:29:16
The problem I had is that the current code generat
| |
| 33 ; CHECK: : | |
| 34 ; CHECK: mov [[PHI]], 0 | |
| 35 ; CHECK: : | |
| 36 ; CHECK: movzx {{.*}}, [[PHI]] | |
| 37 | |
| 38 define internal i32 @testPhi2(i32 %arg) { | |
| 39 entry: | |
| 40 %cmp1 = icmp sgt i32 %arg, 0 | |
| 41 br i1 %cmp1, label %next, label %target | |
| 42 next: | |
| 43 br label %target | |
| 44 target: | |
| 45 %merge = phi i32 [ %arg, %entry ], [ 0, %next ] | |
|
jvoung (off chromium)
2014/09/10 17:17:43
If you change the %arg to a recognizable constant,
Jim Stichnoth
2014/09/10 18:29:16
Good idea, done.
| |
| 46 ret i32 %merge | |
| 47 } | |
| 48 ; Test that compare/branch fusing and Phi lowering happens as expected. | |
| 49 ; CHECK-LABEL: testPhi2 | |
| 50 ; CHECK: cmp {{.*}}, 0 | |
| 51 ; CHECK: jg | |
|
jvoung (off chromium)
2014/09/10 17:17:43
Should this be CHECK-NEXT?
Jim Stichnoth
2014/09/10 18:29:16
Done.
| |
| 52 ; CHECK: : | |
| 53 ; CHECK: mov [[PHI:.*]], 0 | |
| 54 ; CHECK: : | |
| 55 ; CHECK: mov {{.*}}, [[PHI]] | |
| 56 | |
| 57 ; ERRORS-NOT: ICE translation error | |
| 58 ; DUMP-NOT: SZ | |
| OLD | NEW |