OLD | NEW |
1 ; 1. Trivial smoke test of compare and branch, with multiple basic | 1 ; 1. Trivial smoke test of compare and branch, with multiple basic |
2 ; blocks. | 2 ; blocks. |
3 ; 2. For a conditional branch on a constant boolean value, make sure | 3 ; 2. For a conditional branch on a constant boolean value, make sure |
4 ; we don't lower to a cmp instructions with an immediate as the first | 4 ; we don't lower to a cmp instructions with an immediate as the first |
5 ; source operand. | 5 ; source operand. |
6 | 6 |
7 ; RUN: %p2i -i %s --args -O2 --verbose inst | FileCheck %s | 7 ; RUN: %p2i -i %s --args -O2 --verbose inst | FileCheck %s |
8 ; RUN: %p2i -i %s --args -Om1 --verbose inst | FileCheck %s | 8 ; RUN: %p2i -i %s --args -Om1 --verbose inst | FileCheck %s |
9 ; RUN: %p2i -i %s --args --verbose none | FileCheck --check-prefix=ERRORS %s | |
10 ; RUN: %p2i -i %s --insts | %szdiff %s | FileCheck --check-prefix=DUMP %s | |
11 | 9 |
12 define i32 @simple_cond_branch(i32 %foo, i32 %bar) { | 10 define i32 @simple_cond_branch(i32 %foo, i32 %bar) { |
13 entry: | 11 entry: |
14 %r1 = icmp eq i32 %foo, %bar | 12 %r1 = icmp eq i32 %foo, %bar |
15 br i1 %r1, label %Equal, label %Unequal | 13 br i1 %r1, label %Equal, label %Unequal |
16 Equal: | 14 Equal: |
17 ret i32 %foo | 15 ret i32 %foo |
18 Unequal: | 16 Unequal: |
19 ret i32 %bar | 17 ret i32 %bar |
20 ; CHECK-LABEL: simple_cond_branch | 18 ; CHECK-LABEL: simple_cond_branch |
21 ; CHECK: br i1 %r1, label %Equal, label %Unequal | 19 ; CHECK: br i1 %r1, label %Equal, label %Unequal |
22 ; CHECK: Equal: | 20 ; CHECK: Equal: |
23 ; CHECK: ret i32 %foo | 21 ; CHECK: ret i32 %foo |
24 ; CHECK: Unequal: | 22 ; CHECK: Unequal: |
25 ; CHECK: ret i32 %bar | 23 ; CHECK: ret i32 %bar |
26 } | 24 } |
27 | 25 |
28 define internal i32 @test_br_const() { | 26 define internal i32 @test_br_const() { |
29 __0: | 27 __0: |
30 br i1 true, label %__1, label %__2 | 28 br i1 true, label %__1, label %__2 |
31 __1: | 29 __1: |
32 ret i32 21 | 30 ret i32 21 |
33 __2: | 31 __2: |
34 ret i32 43 | 32 ret i32 43 |
35 } | 33 } |
36 ; CHECK-LABEL: test_br_const | 34 ; CHECK-LABEL: test_br_const |
37 ; CHECK-NOT: cmp {{[0-9]*}}, | 35 ; CHECK-NOT: cmp {{[0-9]*}}, |
38 | |
39 ; ERRORS-NOT: ICE translation error | |
40 ; DUMP-NOT: SZ | |
OLD | NEW |