[llvm] r308029 - [InstCombine] add tests for PR32401; NFC
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Fri Jul 14 07:43:28 PDT 2017
Author: spatel
Date: Fri Jul 14 07:43:28 2017
New Revision: 308029
URL: http://llvm.org/viewvc/llvm-project?rev=308029&view=rev
Log:
[InstCombine] add tests for PR32401; NFC
Also, add comments to a couple of tests that could be moved out of instcombine.
Modified:
llvm/trunk/test/Transforms/InstCombine/icmp-logical.ll
Modified: llvm/trunk/test/Transforms/InstCombine/icmp-logical.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/icmp-logical.ll?rev=308029&r1=308028&r2=308029&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/icmp-logical.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/icmp-logical.ll Fri Jul 14 07:43:28 2017
@@ -127,6 +127,8 @@ define i1 @nomask_rhs(i32 %in) {
ret i1 %val
}
+; TODO: This test simplifies to a constant, so the functionality and test could be in InstSimplify.
+
define i1 @fold_mask_cmps_to_false(i32 %x) {
; CHECK-LABEL: @fold_mask_cmps_to_false(
; CHECK-NEXT: ret i1 false
@@ -138,6 +140,8 @@ define i1 @fold_mask_cmps_to_false(i32 %
ret i1 %4
}
+; TODO: This test simplifies to a constant, so the functionality and test could be in InstSimplify.
+
define i1 @fold_mask_cmps_to_true(i32 %x) {
; CHECK-LABEL: @fold_mask_cmps_to_true(
; CHECK-NEXT: ret i1 true
@@ -149,3 +153,35 @@ define i1 @fold_mask_cmps_to_true(i32 %x
ret i1 %4
}
+; PR32401 - https://bugs.llvm.org/show_bug.cgi?id=32401
+
+define i1 @cmpeq_bitwise(i8 %a, i8 %b, i8 %c, i8 %d) {
+; CHECK-LABEL: @cmpeq_bitwise(
+; CHECK-NEXT: [[XOR1:%.*]] = xor i8 %a, %b
+; CHECK-NEXT: [[XOR2:%.*]] = xor i8 %c, %d
+; CHECK-NEXT: [[OR:%.*]] = or i8 [[XOR1]], [[XOR2]]
+; CHECK-NEXT: [[CMP:%.*]] = icmp eq i8 [[OR]], 0
+; CHECK-NEXT: ret i1 [[CMP]]
+;
+ %xor1 = xor i8 %a, %b
+ %xor2 = xor i8 %c, %d
+ %or = or i8 %xor1, %xor2
+ %cmp = icmp eq i8 %or, 0
+ ret i1 %cmp
+}
+
+define <2 x i1> @cmpne_bitwise(<2 x i64> %a, <2 x i64> %b, <2 x i64> %c, <2 x i64> %d) {
+; CHECK-LABEL: @cmpne_bitwise(
+; CHECK-NEXT: [[XOR1:%.*]] = xor <2 x i64> %a, %b
+; CHECK-NEXT: [[XOR2:%.*]] = xor <2 x i64> %c, %d
+; CHECK-NEXT: [[OR:%.*]] = or <2 x i64> [[XOR1]], [[XOR2]]
+; CHECK-NEXT: [[CMP:%.*]] = icmp ne <2 x i64> [[OR]], zeroinitializer
+; CHECK-NEXT: ret <2 x i1> [[CMP]]
+;
+ %xor1 = xor <2 x i64> %a, %b
+ %xor2 = xor <2 x i64> %c, %d
+ %or = or <2 x i64> %xor1, %xor2
+ %cmp = icmp ne <2 x i64> %or, zeroinitializer
+ ret <2 x i1> %cmp
+}
+
More information about the llvm-commits
mailing list