blob: 332ed50ede6f2a898ef8c5a8aa46f531e3635470 [file] [log] [blame]
Tim Northoverb4ddc082014-05-30 10:09:59 +00001; RUN: llc < %s -mtriple=thumbv7-apple-darwin -mattr=+thumb2 -arm-atomic-cfg-tidy=0 | FileCheck %s
Tim Northover52f77f52013-06-26 16:52:32 +00002; 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
Jim Grosbachade1fb12011-07-12 16:06:01 +00004; happen and we get actual branches.
Evan Chenge41903b2009-08-14 18:31:44 +00005
Tim Northover52f77f52013-06-26 16:52:32 +00006declare void @foo()
7
Dan Gohman2ad68de2010-05-03 14:35:47 +00008define i32 @f1(i32 %a, i32 %b, i32* %v) {
Evan Chenge41903b2009-08-14 18:31:44 +00009entry:
Stephen Lind24ab202013-07-14 06:24:09 +000010; CHECK-LABEL: f1:
Benjamin Kramer7e060832009-10-31 19:22:24 +000011; CHECK: bne LBB
Evan Chenge41903b2009-08-14 18:31:44 +000012 %tmp = icmp eq i32 %a, %b ; <i1> [#uses=1]
13 br i1 %tmp, label %cond_true, label %return
14
15cond_true: ; preds = %entry
Tim Northover52f77f52013-06-26 16:52:32 +000016 call void @foo()
Evan Chenge41903b2009-08-14 18:31:44 +000017 store i32 0, i32* %v
Dan Gohman2ad68de2010-05-03 14:35:47 +000018 ret i32 0
Evan Chenge41903b2009-08-14 18:31:44 +000019
20return: ; preds = %entry
Tim Northover52f77f52013-06-26 16:52:32 +000021 call void @foo()
Dan Gohman2ad68de2010-05-03 14:35:47 +000022 ret i32 1
Evan Chenge41903b2009-08-14 18:31:44 +000023}
24
Dan Gohman2ad68de2010-05-03 14:35:47 +000025define i32 @f2(i32 %a, i32 %b, i32* %v) {
Evan Chenge41903b2009-08-14 18:31:44 +000026entry:
Stephen Lind24ab202013-07-14 06:24:09 +000027; CHECK-LABEL: f2:
Benjamin Kramer7e060832009-10-31 19:22:24 +000028; CHECK: bge LBB
Evan Chenge41903b2009-08-14 18:31:44 +000029 %tmp = icmp slt i32 %a, %b ; <i1> [#uses=1]
30 br i1 %tmp, label %cond_true, label %return
31
32cond_true: ; preds = %entry
Tim Northover52f77f52013-06-26 16:52:32 +000033 call void @foo()
Evan Chenge41903b2009-08-14 18:31:44 +000034 store i32 0, i32* %v
Dan Gohman2ad68de2010-05-03 14:35:47 +000035 ret i32 0
Evan Chenge41903b2009-08-14 18:31:44 +000036
37return: ; preds = %entry
Tim Northover52f77f52013-06-26 16:52:32 +000038 call void @foo()
Dan Gohman2ad68de2010-05-03 14:35:47 +000039 ret i32 1
Evan Chenge41903b2009-08-14 18:31:44 +000040}
41
Dan Gohman2ad68de2010-05-03 14:35:47 +000042define i32 @f3(i32 %a, i32 %b, i32* %v) {
Evan Chenge41903b2009-08-14 18:31:44 +000043entry:
Stephen Lind24ab202013-07-14 06:24:09 +000044; CHECK-LABEL: f3:
Benjamin Kramer7e060832009-10-31 19:22:24 +000045; CHECK: bhs LBB
Evan Chenge41903b2009-08-14 18:31:44 +000046 %tmp = icmp ult i32 %a, %b ; <i1> [#uses=1]
47 br i1 %tmp, label %cond_true, label %return
48
49cond_true: ; preds = %entry
Tim Northover52f77f52013-06-26 16:52:32 +000050 call void @foo()
Evan Chenge41903b2009-08-14 18:31:44 +000051 store i32 0, i32* %v
Dan Gohman2ad68de2010-05-03 14:35:47 +000052 ret i32 0
Evan Chenge41903b2009-08-14 18:31:44 +000053
54return: ; preds = %entry
Tim Northover52f77f52013-06-26 16:52:32 +000055 call void @foo()
Dan Gohman2ad68de2010-05-03 14:35:47 +000056 ret i32 1
Evan Chenge41903b2009-08-14 18:31:44 +000057}
58
Dan Gohman2ad68de2010-05-03 14:35:47 +000059define i32 @f4(i32 %a, i32 %b, i32* %v) {
Evan Chenge41903b2009-08-14 18:31:44 +000060entry:
Stephen Lind24ab202013-07-14 06:24:09 +000061; CHECK-LABEL: f4:
Benjamin Kramer7e060832009-10-31 19:22:24 +000062; CHECK: blo LBB
Chandler Carruth4190b502012-04-16 13:49:17 +000063 %tmp = icmp uge i32 %a, %b ; <i1> [#uses=1]
64 br i1 %tmp, label %cond_true, label %return
Evan Chenge41903b2009-08-14 18:31:44 +000065
66cond_true: ; preds = %entry
Tim Northover52f77f52013-06-26 16:52:32 +000067 call void @foo()
Evan Chenge41903b2009-08-14 18:31:44 +000068 store i32 0, i32* %v
Dan Gohman2ad68de2010-05-03 14:35:47 +000069 ret i32 0
Evan Chenge41903b2009-08-14 18:31:44 +000070
71return: ; preds = %entry
Tim Northover52f77f52013-06-26 16:52:32 +000072 call void @foo()
Dan Gohman2ad68de2010-05-03 14:35:47 +000073 ret i32 1
Evan Chenge41903b2009-08-14 18:31:44 +000074}