summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorSanjay Patel <spatel@rotateright.com>2017-05-18 22:47:57 +0000
committerSanjay Patel <spatel@rotateright.com>2017-05-18 22:47:57 +0000
commit86bf0a874c0b2cf56bd8c1493e98ef6c11a0ebd4 (patch)
tree1354c19e5e6f753c120d019ad44de2b794de9ee5 /llvm/test/Transforms
parent960c0d0b0412b727b24862ccc544dc2ef77b6834 (diff)
downloadbcm5719-llvm-86bf0a874c0b2cf56bd8c1493e98ef6c11a0ebd4.tar.gz
bcm5719-llvm-86bf0a874c0b2cf56bd8c1493e98ef6c11a0ebd4.zip
[InstCombine] add more tests for xor-of-icmps; NFC
llvm-svn: 303387
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/InstCombine/set.ll30
1 files changed, 30 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/set.ll b/llvm/test/Transforms/InstCombine/set.ll
index 443f17a5300..db2b4c3558e 100644
--- a/llvm/test/Transforms/InstCombine/set.ll
+++ b/llvm/test/Transforms/InstCombine/set.ll
@@ -175,6 +175,36 @@ define i1 @xor_of_icmps(i64 %a) {
ret i1 %xor
}
+; FIXME: This is also equivalent to the previous test.
+
+define i1 @xor_of_icmps_commute(i64 %a) {
+; CHECK-LABEL: @xor_of_icmps_commute(
+; CHECK-NEXT: [[B:%.*]] = icmp sgt i64 %a, 0
+; CHECK-NEXT: [[C:%.*]] = icmp eq i64 %a, 1
+; CHECK-NEXT: [[XOR:%.*]] = xor i1 [[B]], [[C]]
+; CHECK-NEXT: ret i1 [[XOR]]
+;
+ %b = icmp sgt i64 %a, 0
+ %c = icmp eq i64 %a, 1
+ %xor = xor i1 %b, %c
+ ret i1 %xor
+}
+
+; FIXME: This is (a != 5).
+
+define i1 @xor_of_icmps_folds_more(i64 %a) {
+; CHECK-LABEL: @xor_of_icmps_folds_more(
+; CHECK-NEXT: [[B:%.*]] = icmp sgt i64 %a, 4
+; CHECK-NEXT: [[C:%.*]] = icmp slt i64 %a, 6
+; CHECK-NEXT: [[XOR:%.*]] = xor i1 [[B]], [[C]]
+; CHECK-NEXT: ret i1 [[XOR]]
+;
+ %b = icmp sgt i64 %a, 4
+ %c = icmp slt i64 %a, 6
+ %xor = xor i1 %b, %c
+ ret i1 %xor
+}
+
; https://bugs.llvm.org/show_bug.cgi?id=2844
define i32 @PR2844(i32 %x) {
OpenPOWER on IntegriCloud