OLD | NEW |
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 |
| 4 ; we don't lower to a cmp instructions with an immediate as the first |
| 5 ; source operand. |
3 | 6 |
4 ; RUN: %llvm2ice %s --verbose inst | FileCheck %s | 7 ; RUN: %llvm2ice -O2 --verbose inst %s | FileCheck %s |
| 8 ; RUN: %llvm2ice -Om1 --verbose inst %s | FileCheck %s |
5 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s | 9 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s |
6 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s | 10 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s |
7 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ | 11 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ |
8 ; RUN: | FileCheck --check-prefix=DUMP %s | 12 ; RUN: | FileCheck --check-prefix=DUMP %s |
9 | 13 |
10 define i32 @simple_cond_branch(i32 %foo, i32 %bar) { | 14 define i32 @simple_cond_branch(i32 %foo, i32 %bar) { |
11 entry: | 15 entry: |
12 %r1 = icmp eq i32 %foo, %bar | 16 %r1 = icmp eq i32 %foo, %bar |
13 br i1 %r1, label %Equal, label %Unequal | 17 br i1 %r1, label %Equal, label %Unequal |
14 Equal: | 18 Equal: |
15 ret i32 %foo | 19 ret i32 %foo |
16 Unequal: | 20 Unequal: |
17 ret i32 %bar | 21 ret i32 %bar |
| 22 ; CHECK-LABEL: simple_cond_branch |
18 ; CHECK: br i1 %r1, label %Equal, label %Unequal | 23 ; CHECK: br i1 %r1, label %Equal, label %Unequal |
19 ; CHECK: Equal: | 24 ; CHECK: Equal: |
20 ; CHECK: ret i32 %foo | 25 ; CHECK: ret i32 %foo |
21 ; CHECK: Unequal: | 26 ; CHECK: Unequal: |
22 ; CHECK: ret i32 %bar | 27 ; CHECK: ret i32 %bar |
23 } | 28 } |
24 | 29 |
| 30 define internal i32 @test_br_const() { |
| 31 __0: |
| 32 br i1 1, label %__1, label %__2 |
| 33 __1: |
| 34 ret i32 21 |
| 35 __2: |
| 36 ret i32 43 |
| 37 } |
| 38 ; CHECK-LABEL: test_br_const |
| 39 ; CHECK-NOT: cmp {{[0-9]*}}, |
| 40 |
25 ; ERRORS-NOT: ICE translation error | 41 ; ERRORS-NOT: ICE translation error |
26 ; DUMP-NOT: SZ | 42 ; DUMP-NOT: SZ |
OLD | NEW |