[llvm] r300401 - [InstCombine] add tests to show missing transforms for vectors; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Sat Apr 15 10:50:45 PDT 2017


Author: spatel
Date: Sat Apr 15 12:50:45 2017
New Revision: 300401

URL: http://llvm.org/viewvc/llvm-project?rev=300401&view=rev
Log:
[InstCombine] add tests to show missing transforms for vectors; NFC

Modified:
    llvm/trunk/test/Transforms/InstCombine/and-or-icmps.ll

Modified: llvm/trunk/test/Transforms/InstCombine/and-or-icmps.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/and-or-icmps.ll?rev=300401&r1=300400&r2=300401&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/and-or-icmps.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/and-or-icmps.ll Sat Apr 15 12:50:45 2017
@@ -177,5 +177,31 @@ define i1 @and_ne_with_diff_one_signed(i
   ret i1 %and
 }
 
+; FIXME: Vectors with splat constants get the same folds.
 
+define <2 x i1> @or_eq_with_one_bit_diff_constants2_splatvec(<2 x i32> %x) {
+; CHECK-LABEL: @or_eq_with_one_bit_diff_constants2_splatvec(
+; CHECK-NEXT:    [[CMP1:%.*]] = icmp eq <2 x i32> %x, <i32 97, i32 97>
+; CHECK-NEXT:    [[CMP2:%.*]] = icmp eq <2 x i32> %x, <i32 65, i32 65>
+; CHECK-NEXT:    [[OR:%.*]] = or <2 x i1> [[CMP1]], [[CMP2]]
+; CHECK-NEXT:    ret <2 x i1> [[OR]]
+;
+  %cmp1 = icmp eq <2 x i32> %x, <i32 97, i32 97>
+  %cmp2 = icmp eq <2 x i32> %x, <i32 65, i32 65>
+  %or = or <2 x i1> %cmp1, %cmp2
+  ret <2 x i1> %or
+}
+
+define <2 x i1> @and_ne_with_diff_one_splatvec(<2 x i32> %x) {
+; CHECK-LABEL: @and_ne_with_diff_one_splatvec(
+; CHECK-NEXT:    [[CMP1:%.*]] = icmp ne <2 x i32> %x, <i32 40, i32 40>
+; CHECK-NEXT:    [[CMP2:%.*]] = icmp ne <2 x i32> %x, <i32 39, i32 39>
+; CHECK-NEXT:    [[AND:%.*]] = and <2 x i1> [[CMP1]], [[CMP2]]
+; CHECK-NEXT:    ret <2 x i1> [[AND]]
+;
+  %cmp1 = icmp ne <2 x i32> %x, <i32 40, i32 40>
+  %cmp2 = icmp ne <2 x i32> %x, <i32 39, i32 39>
+  %and = and <2 x i1> %cmp1, %cmp2
+  ret <2 x i1> %and
+}
 




More information about the llvm-commits mailing list