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 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 --phi-edge-split=0 \ | 5 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 --phi-edge-split=0 \ |
6 ; RUN: | FileCheck %s | 6 ; RUN: | FileCheck %s |
| 7 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 --phi-edge-split=1 \ |
| 8 ; RUN: | FileCheck --check-prefix=SPLIT %s |
7 | 9 |
8 define internal i32 @testPhi1(i32 %arg) { | 10 define internal i32 @testPhi1(i32 %arg) { |
9 entry: | 11 entry: |
10 %cmp1 = icmp sgt i32 %arg, 0 | 12 %cmp1 = icmp sgt i32 %arg, 0 |
11 br i1 %cmp1, label %next, label %target | 13 br i1 %cmp1, label %next, label %target |
12 next: | 14 next: |
13 br label %target | 15 br label %target |
14 target: | 16 target: |
15 %merge = phi i1 [ %cmp1, %entry ], [ false, %next ] | 17 %merge = phi i1 [ %cmp1, %entry ], [ false, %next ] |
16 %result = zext i1 %merge to i32 | 18 %result = zext i1 %merge to i32 |
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
92 | 94 |
93 ; CHECK-LABEL: testPhi3 | 95 ; CHECK-LABEL: testPhi3 |
94 ; CHECK: push [[EBX:.*]] | 96 ; CHECK: push [[EBX:.*]] |
95 ; CHECK: mov {{.*}},DWORD PTR [esp | 97 ; CHECK: mov {{.*}},DWORD PTR [esp |
96 ; CHECK: mov | 98 ; CHECK: mov |
97 ; CHECK: mov {{.*}},DWORD PTR [[ADDR:.*0x3e8]] | 99 ; CHECK: mov {{.*}},DWORD PTR [[ADDR:.*0x3e8]] |
98 ; CHECK: cmp {{.*}},0x0 | 100 ; CHECK: cmp {{.*}},0x0 |
99 ; CHECK: jne | 101 ; CHECK: jne |
100 ; CHECK: mov DWORD PTR [[ADDR]] | 102 ; CHECK: mov DWORD PTR [[ADDR]] |
101 ; CHECK: pop [[EBX]] | 103 ; CHECK: pop [[EBX]] |
| 104 |
| 105 ; Test of "advanced phi lowering" with undef phi arg (integer vector). |
| 106 define internal <4 x i32> @test_split_undef_int_vec(<4 x i32> %arg, i32 %cond) { |
| 107 entry: |
| 108 %cmp = icmp eq i32 %cond, 0 |
| 109 br i1 %cmp, label %eq, label %exit |
| 110 eq: |
| 111 br label %exit |
| 112 exit: |
| 113 %merge = phi <4 x i32> [ %arg, %entry ], [ undef, %eq ] |
| 114 ret <4 x i32> %merge |
| 115 } |
| 116 ; SPLIT-LABEL: test_split_undef_int_vec |
| 117 ; SPLIT: pxor |
| 118 |
| 119 ; Test of "advanced phi lowering" with undef phi arg (float vector). |
| 120 define internal <4 x float> @test_split_undef_float_vec(<4 x float> %arg, i32 %c
ond) { |
| 121 entry: |
| 122 %cmp = icmp eq i32 %cond, 0 |
| 123 br i1 %cmp, label %eq, label %exit |
| 124 eq: |
| 125 br label %exit |
| 126 exit: |
| 127 %merge = phi <4 x float> [ %arg, %entry ], [ undef, %eq ] |
| 128 ret <4 x float> %merge |
| 129 } |
| 130 ; SPLIT-LABEL: test_split_undef_float_vec |
| 131 ; SPLIT: pxor |
| 132 |
| 133 ; Test of "advanced phi lowering" with undef phi arg (integer scalar). |
| 134 define internal i32 @test_split_undef_int_scalar(i32 %arg, i32 %cond) { |
| 135 entry: |
| 136 %cmp = icmp eq i32 %cond, 0 |
| 137 br i1 %cmp, label %eq, label %exit |
| 138 eq: |
| 139 br label %exit |
| 140 exit: |
| 141 %merge = phi i32 [ %arg, %entry ], [ undef, %eq ] |
| 142 ret i32 %merge |
| 143 } |
| 144 ; SPLIT-LABEL: test_split_undef_int_scalar |
| 145 ; SPLIT: mov {{.*}},0x0 |
| 146 |
| 147 ; Test of "advanced phi lowering" with undef phi arg (float scalar). |
| 148 define internal float @test_split_undef_float_scalar(float %arg, i32 %cond) { |
| 149 entry: |
| 150 %cmp = icmp eq i32 %cond, 0 |
| 151 br i1 %cmp, label %eq, label %exit |
| 152 eq: |
| 153 br label %exit |
| 154 exit: |
| 155 %merge = phi float [ %arg, %entry ], [ undef, %eq ] |
| 156 ret float %merge |
| 157 } |
| 158 ; SPLIT-LABEL: test_split_undef_float_scalar |
| 159 ; SPLIT: movss {{.*}},DWORD PTR |
OLD | NEW |