summaryrefslogtreecommitdiffstats
path: root/llvm/test/Transforms
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2017-06-15 01:01:01 +0000
committerCraig Topper <craig.topper@intel.com>2017-06-15 01:01:01 +0000
commit6ea89f24977d17919a49ae9d49a43768594c66df (patch)
tree6159ebc8a8aebb267c7d924b11b26427b66f9ef5 /llvm/test/Transforms
parenteea71e8f0e64296058b4a6d65ab03af7748abee8 (diff)
downloadbcm5719-llvm-6ea89f24977d17919a49ae9d49a43768594c66df.tar.gz
bcm5719-llvm-6ea89f24977d17919a49ae9d49a43768594c66df.zip
[InstCombine] Add a test case to show a case where don't handle a partially commuted IR. NFC
llvm-svn: 305438
Diffstat (limited to 'llvm/test/Transforms')
-rw-r--r--llvm/test/Transforms/InstCombine/onehot_merge.ll27
1 files changed, 27 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/onehot_merge.ll b/llvm/test/Transforms/InstCombine/onehot_merge.ll
index 496d847b532..6fd4fc66a52 100644
--- a/llvm/test/Transforms/InstCombine/onehot_merge.ll
+++ b/llvm/test/Transforms/InstCombine/onehot_merge.ll
@@ -33,3 +33,30 @@ bb:
ret i1 %or
}
+; Same as above but with operands commuted one of the ands, but not the other.
+; TODO handle this form correctly
+define i1 @foo1_and_commuted(i32 %k, i32 %c1, i32 %c2) {
+; CHECK-LABEL: @foo1_and_commuted(
+; CHECK-NEXT: bb:
+; CHECK-NEXT: [[K2:%.*]] = mul i32 [[K:%.*]], [[K]]
+; CHECK-NEXT: [[TMP:%.*]] = shl i32 1, [[C1:%.*]]
+; CHECK-NEXT: [[TMP4:%.*]] = lshr i32 -2147483648, [[C2:%.*]]
+; CHECK-NEXT: [[TMP1:%.*]] = and i32 [[K2]], [[TMP]]
+; CHECK-NEXT: [[TMP2:%.*]] = icmp eq i32 [[TMP1]], 0
+; CHECK-NEXT: [[TMP5:%.*]] = and i32 [[TMP4]], [[K2]]
+; CHECK-NEXT: [[TMP6:%.*]] = icmp eq i32 [[TMP5]], 0
+; CHECK-NEXT: [[OR:%.*]] = or i1 [[TMP2]], [[TMP6]]
+; CHECK-NEXT: ret i1 [[OR]]
+;
+bb:
+ %k2 = mul i32 %k, %k ; to trick the complexity sorting
+ %tmp = shl i32 1, %c1
+ %tmp4 = lshr i32 -2147483648, %c2
+ %tmp1 = and i32 %k2, %tmp
+ %tmp2 = icmp eq i32 %tmp1, 0
+ %tmp5 = and i32 %tmp4, %k2
+ %tmp6 = icmp eq i32 %tmp5, 0
+ %or = or i1 %tmp2, %tmp6
+ ret i1 %or
+}
+
OpenPOWER on IntegriCloud