| 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 \ | 7 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 --phi-edge-split=1 \ |
| 8 ; RUN: | FileCheck --check-prefix=SPLIT %s | 8 ; RUN: | FileCheck --check-prefix=SPLIT %s |
| 9 | 9 |
| 10 define internal i32 @testPhi1(i32 %arg) { | 10 define internal i32 @testPhi1(i32 %arg) { |
| 11 entry: | 11 entry: |
| 12 %cmp1 = icmp sgt i32 %arg, 0 | 12 %cmp1 = icmp sgt i32 %arg, 0 |
| 13 br i1 %cmp1, label %next, label %target | 13 br i1 %cmp1, label %next, label %target |
| 14 next: | 14 next: |
| 15 br label %target | 15 br label %target |
| 16 target: | 16 target: |
| 17 %merge = phi i1 [ %cmp1, %entry ], [ false, %next ] | 17 %merge = phi i1 [ %cmp1, %entry ], [ false, %next ] |
| 18 %result = zext i1 %merge to i32 | 18 %result = zext i1 %merge to i32 |
| 19 ret i32 %result | 19 ret i32 %result |
| 20 } | 20 } |
| 21 ; Test that compare/branch fusing does not happen, and Phi lowering is | 21 ; Test that compare/branch fusing does not happen, and Phi lowering is |
| 22 ; put in the right place. | 22 ; put in the right place. |
| 23 ; CHECK-LABEL: testPhi1 | 23 ; CHECK-LABEL: testPhi1 |
| 24 ; CHECK: cmp {{.*}},0x0 | 24 ; CHECK: cmp {{.*}},0x0 |
| 25 ; CHECK: mov {{.*}},0x1 | 25 ; CHECK: setg |
| 26 ; CHECK: jg | |
| 27 ; CHECK: mov {{.*}},0x0 | |
| 28 ; CHECK: mov [[PHI:.*]], | 26 ; CHECK: mov [[PHI:.*]], |
| 29 ; CHECK: cmp {{.*}},0x0 | 27 ; CHECK: cmp {{.*}},0x0 |
| 30 ; CHECK: je | 28 ; CHECK: je |
| 31 ; CHECK: mov [[PHI]],0x0 | 29 ; CHECK: mov [[PHI]],0x0 |
| 32 ; CHECK: movzx {{.*}},[[PHI]] | 30 ; CHECK: movzx {{.*}},[[PHI]] |
| 33 | 31 |
| 34 define internal i32 @testPhi2(i32 %arg) { | 32 define internal i32 @testPhi2(i32 %arg) { |
| 35 entry: | 33 entry: |
| 36 %cmp1 = icmp sgt i32 %arg, 0 | 34 %cmp1 = icmp sgt i32 %arg, 0 |
| 37 br i1 %cmp1, label %next, label %target | 35 br i1 %cmp1, label %next, label %target |
| (...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 150 %cmp = icmp eq i32 %cond, 0 | 148 %cmp = icmp eq i32 %cond, 0 |
| 151 br i1 %cmp, label %eq, label %exit | 149 br i1 %cmp, label %eq, label %exit |
| 152 eq: | 150 eq: |
| 153 br label %exit | 151 br label %exit |
| 154 exit: | 152 exit: |
| 155 %merge = phi float [ %arg, %entry ], [ undef, %eq ] | 153 %merge = phi float [ %arg, %entry ], [ undef, %eq ] |
| 156 ret float %merge | 154 ret float %merge |
| 157 } | 155 } |
| 158 ; SPLIT-LABEL: test_split_undef_float_scalar | 156 ; SPLIT-LABEL: test_split_undef_float_scalar |
| 159 ; SPLIT: movss {{.*}},DWORD PTR | 157 ; SPLIT: movss {{.*}},DWORD PTR |
| OLD | NEW |