aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGen/AArch64/combine-comparisons-by-cse.ll
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2016-07-23 20:41:05 +0000
committerDimitry Andric <dim@FreeBSD.org>2016-07-23 20:41:05 +0000
commit01095a5d43bbfde13731688ddcf6048ebb8b7721 (patch)
tree4def12e759965de927d963ac65840d663ef9d1ea /test/CodeGen/AArch64/combine-comparisons-by-cse.ll
parentf0f4822ed4b66e3579e92a89f368f8fb860e218e (diff)
Vendor import of llvm release_39 branch r276489:vendor/llvm/llvm-release_39-r276489
Diffstat (limited to 'test/CodeGen/AArch64/combine-comparisons-by-cse.ll')
-rw-r--r--test/CodeGen/AArch64/combine-comparisons-by-cse.ll44
1 files changed, 40 insertions, 4 deletions
diff --git a/test/CodeGen/AArch64/combine-comparisons-by-cse.ll b/test/CodeGen/AArch64/combine-comparisons-by-cse.ll
index 004267f4e4e0..1f8e0efa0675 100644
--- a/test/CodeGen/AArch64/combine-comparisons-by-cse.ll
+++ b/test/CodeGen/AArch64/combine-comparisons-by-cse.ll
@@ -405,11 +405,11 @@ return: ; preds = %land.lhs.true, %con
define void @cmp_shifted(i32 %in, i32 %lhs, i32 %rhs) {
; CHECK-LABEL: cmp_shifted:
-; CHECK: cmp w0, #1
-; [...]
; CHECK: cmp w0, #2, lsl #12
+; [...]
+; CHECK: cmp w0, #1
- %tst_low = icmp sgt i32 %in, 0
+ %tst_low = icmp sgt i32 %in, 8191
br i1 %tst_low, label %true, label %false
true:
@@ -417,7 +417,7 @@ true:
ret void
false:
- %tst = icmp sgt i32 %in, 8191
+ %tst = icmp sgt i32 %in, 0
br i1 %tst, label %truer, label %falser
truer:
@@ -429,6 +429,42 @@ falser:
ret void
}
+define i32 @combine_gt_ge_sel(i64 %v, i64* %p) #0 {
+; CHECK-LABEL: combine_gt_ge_sel
+; CHECK: ldr [[reg1:w[0-9]*]],
+; CHECK: cmp [[reg1]], #0
+; CHECK: csel {{.*}}, gt
+entry:
+ %0 = load i32, i32* @a, align 4
+ %cmp = icmp sgt i32 %0, 0
+ %m = select i1 %cmp, i64 %v, i64 0
+ store i64 %m, i64* %p
+ br i1 %cmp, label %lor.lhs.false, label %land.lhs.true
+
+land.lhs.true: ; preds = %entry
+ %1 = load i32, i32* @b, align 4
+ %2 = load i32, i32* @c, align 4
+ %cmp1 = icmp eq i32 %1, %2
+ br i1 %cmp1, label %return, label %land.lhs.true3
+
+lor.lhs.false: ; preds = %entry
+ %cmp2 = icmp sgt i32 %0, 1
+ br i1 %cmp2, label %land.lhs.true3, label %if.end
+
+land.lhs.true3: ; preds = %lor.lhs.false, %land.lhs.true
+ %3 = load i32, i32* @b, align 4
+ %4 = load i32, i32* @d, align 4
+ %cmp4 = icmp eq i32 %3, %4
+ br i1 %cmp4, label %return, label %if.end
+
+if.end: ; preds = %land.lhs.true3, %lor.lhs.false
+ br label %return
+
+return: ; preds = %if.end, %land.lhs.true3, %land.lhs.true
+ %retval.0 = phi i32 [ 0, %if.end ], [ 1, %land.lhs.true3 ], [ 1, %land.lhs.true ]
+ ret i32 %retval.0
+}
+
declare i32 @zoo(i32)
declare double @yoo(i32)