OLD | NEW |
1 ; This tests some of the subtleties of Phi lowering. In particular, | 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 | 2 ; it tests that it does the right thing when it tries to enable |
3 ; compare/branch fusing. | 3 ; compare/branch fusing. |
4 | 4 |
5 ; TODO(kschimpf) Find out why lc2i must be used. | 5 ; TODO(kschimpf) Find out why lc2i must be used. |
6 ; REQUIRES: allow_llvm_ir_as_input | 6 ; REQUIRES: allow_llvm_ir_as_input |
7 ; RUN: %lc2i -i %s --args -O2 --verbose none --phi-edge-split=0 \ | 7 ; RUN: %lc2i -i %s --args -O2 --verbose none --phi-edge-split=0 \ |
8 ; RUN: | llvm-mc -triple=i686-none-nacl -filetype=obj \ | 8 ; RUN: | llvm-mc -triple=i686-none-nacl -filetype=obj \ |
9 ; RUN: | llvm-objdump -d -symbolize -x86-asm-syntax=intel - | FileCheck %s | 9 ; RUN: | llvm-objdump -d -symbolize -x86-asm-syntax=intel - | FileCheck %s |
10 ; RUN: %lc2i -i %s --args --verbose none | FileCheck --check-prefix=ERRORS %s | |
11 ; RUN: %lc2i -i %s --insts | %szdiff %s | FileCheck --check-prefix=DUMP %s | |
12 | 10 |
13 define internal i32 @testPhi1(i32 %arg) { | 11 define internal i32 @testPhi1(i32 %arg) { |
14 entry: | 12 entry: |
15 %cmp1 = icmp sgt i32 %arg, 0 | 13 %cmp1 = icmp sgt i32 %arg, 0 |
16 br i1 %cmp1, label %next, label %target | 14 br i1 %cmp1, label %next, label %target |
17 next: | 15 next: |
18 br label %target | 16 br label %target |
19 target: | 17 target: |
20 %merge = phi i1 [ %cmp1, %entry ], [ false, %next ] | 18 %merge = phi i1 [ %cmp1, %entry ], [ false, %next ] |
21 %result = zext i1 %merge to i32 | 19 %result = zext i1 %merge to i32 |
(...skipping 23 matching lines...) Expand all Loading... |
45 ret i32 %merge | 43 ret i32 %merge |
46 } | 44 } |
47 ; Test that compare/branch fusing and Phi lowering happens as expected. | 45 ; Test that compare/branch fusing and Phi lowering happens as expected. |
48 ; CHECK-LABEL: testPhi2 | 46 ; CHECK-LABEL: testPhi2 |
49 ; CHECK: mov {{.*}}, 12345 | 47 ; CHECK: mov {{.*}}, 12345 |
50 ; CHECK: cmp {{.*}}, 0 | 48 ; CHECK: cmp {{.*}}, 0 |
51 ; CHECK-NEXT: jle | 49 ; CHECK-NEXT: jle |
52 ; CHECK: mov [[PHI:.*]], 54321 | 50 ; CHECK: mov [[PHI:.*]], 54321 |
53 ; CHECK: mov {{.*}}, [[PHI]] | 51 ; CHECK: mov {{.*}}, [[PHI]] |
54 | 52 |
55 ; ERRORS-NOT: ICE translation error | |
56 ; DUMP-NOT: SZ | |
57 | |
58 ; Test that address mode inference doesn't extend past | 53 ; Test that address mode inference doesn't extend past |
59 ; multi-definition, non-SSA Phi temporaries. | 54 ; multi-definition, non-SSA Phi temporaries. |
60 define internal i32 @testPhi3(i32 %arg) { | 55 define internal i32 @testPhi3(i32 %arg) { |
61 entry: | 56 entry: |
62 br label %body | 57 br label %body |
63 body: | 58 body: |
64 %merge = phi i32 [ %arg, %entry ], [ %elt, %body ] | 59 %merge = phi i32 [ %arg, %entry ], [ %elt, %body ] |
65 %interior = add i32 %merge, 1000 | 60 %interior = add i32 %merge, 1000 |
66 %__4 = inttoptr i32 %interior to i32* | 61 %__4 = inttoptr i32 %interior to i32* |
67 %elt = load i32* %__4, align 1 | 62 %elt = load i32* %__4, align 1 |
(...skipping 27 matching lines...) Expand all Loading... |
95 | 90 |
96 ; CHECK-LABEL: testPhi3 | 91 ; CHECK-LABEL: testPhi3 |
97 ; CHECK: push [[EBX:.*]] | 92 ; CHECK: push [[EBX:.*]] |
98 ; CHECK: mov {{.*}}, dword ptr [esp | 93 ; CHECK: mov {{.*}}, dword ptr [esp |
99 ; CHECK: mov | 94 ; CHECK: mov |
100 ; CHECK: mov {{.*}}[[ADDR:.*1000]] | 95 ; CHECK: mov {{.*}}[[ADDR:.*1000]] |
101 ; CHECK: cmp {{.*}}, 0 | 96 ; CHECK: cmp {{.*}}, 0 |
102 ; CHECK: jne | 97 ; CHECK: jne |
103 ; CHECK: mov {{.*}}[[ADDR]] | 98 ; CHECK: mov {{.*}}[[ADDR]] |
104 ; CHECK: pop [[EBX]] | 99 ; CHECK: pop [[EBX]] |
OLD | NEW |