| 1 |
; RUN: llc < %s -mtriple=thumbv7-apple-darwin -mattr=+thumb2 -arm-atomic-cfg-tidy=0 | FileCheck %s |
| 2 |
; If-conversion defeats the purpose of this test, which is to check |
| 3 |
; conditional branch generation, so a call to make sure it doesn't |
| 4 |
; happen and we get actual branches. |
| 5 |
|
| 6 |
declare void @foo() |
| 7 |
|
| 8 |
define i32 @f1(i32 %a, i32 %b, ptr %v) { |
| 9 |
entry: |
| 10 |
; CHECK-LABEL: f1: |
| 11 |
; CHECK: bne LBB |
| 12 |
%tmp = icmp eq i32 %a, %b ; <i1> [#uses=1] |
| 13 |
br i1 %tmp, label %cond_true, label %return |
| 14 |
|
| 15 |
cond_true: ; preds = %entry |
| 16 |
call void @foo() |
| 17 |
store i32 0, ptr %v |
| 18 |
ret i32 0 |
| 19 |
|
| 20 |
return: ; preds = %entry |
| 21 |
call void @foo() |
| 22 |
ret i32 1 |
| 23 |
} |
| 24 |
|
| 25 |
define i32 @f2(i32 %a, i32 %b, ptr %v) { |
| 26 |
entry: |
| 27 |
; CHECK-LABEL: f2: |
| 28 |
; CHECK: bge LBB |
| 29 |
%tmp = icmp slt i32 %a, %b ; <i1> [#uses=1] |
| 30 |
br i1 %tmp, label %cond_true, label %return |
| 31 |
|
| 32 |
cond_true: ; preds = %entry |
| 33 |
call void @foo() |
| 34 |
store i32 0, ptr %v |
| 35 |
ret i32 0 |
| 36 |
|
| 37 |
return: ; preds = %entry |
| 38 |
call void @foo() |
| 39 |
ret i32 1 |
| 40 |
} |
| 41 |
|
| 42 |
define i32 @f3(i32 %a, i32 %b, ptr %v) { |
| 43 |
entry: |
| 44 |
; CHECK-LABEL: f3: |
| 45 |
; CHECK: bhs LBB |
| 46 |
%tmp = icmp ult i32 %a, %b ; <i1> [#uses=1] |
| 47 |
br i1 %tmp, label %cond_true, label %return |
| 48 |
|
| 49 |
cond_true: ; preds = %entry |
| 50 |
call void @foo() |
| 51 |
store i32 0, ptr %v |
| 52 |
ret i32 0 |
| 53 |
|
| 54 |
return: ; preds = %entry |
| 55 |
call void @foo() |
| 56 |
ret i32 1 |
| 57 |
} |
| 58 |
|
| 59 |
define i32 @f4(i32 %a, i32 %b, ptr %v) { |
| 60 |
entry: |
| 61 |
; CHECK-LABEL: f4: |
| 62 |
; CHECK: blo LBB |
| 63 |
%tmp = icmp uge i32 %a, %b ; <i1> [#uses=1] |
| 64 |
br i1 %tmp, label %cond_true, label %return |
| 65 |
|
| 66 |
cond_true: ; preds = %entry |
| 67 |
call void @foo() |
| 68 |
store i32 0, ptr %v |
| 69 |
ret i32 0 |
| 70 |
|
| 71 |
return: ; preds = %entry |
| 72 |
call void @foo() |
| 73 |
ret i32 1 |
| 74 |
} |