[llvm] r300161 - [InstCombine] Add vector version of a test to show missing optimization.

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 12 18:31:40 PDT 2017


Author: ctopper
Date: Wed Apr 12 20:31:40 2017
New Revision: 300161

URL: http://llvm.org/viewvc/llvm-project?rev=300161&view=rev
Log:
[InstCombine] Add vector version of a test to show missing optimization.

Modified:
    llvm/trunk/test/Transforms/InstCombine/and2.ll

Modified: llvm/trunk/test/Transforms/InstCombine/and2.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/Transforms/InstCombine/and2.ll?rev=300161&r1=300160&r2=300161&view=diff
==============================================================================
--- llvm/trunk/test/Transforms/InstCombine/and2.ll (original)
+++ llvm/trunk/test/Transforms/InstCombine/and2.ll Wed Apr 12 20:31:40 2017
@@ -110,6 +110,18 @@ define i64 @test9(i64 %x) {
   ret i64 %and
 }
 
+; combine -x & 1 into x & 1
+define <2 x i64> @test9vec(<2 x i64> %x) {
+; CHECK-LABEL: @test9vec(
+; CHECK-NEXT:    [[SUB:%.*]] = sub nsw <2 x i64> zeroinitializer, [[X:%.*]]
+; CHECK-NEXT:    [[AND:%.*]] = and <2 x i64> [[SUB]], <i64 1, i64 1>
+; CHECK-NEXT:    ret <2 x i64> [[AND]]
+;
+  %sub = sub nsw <2 x i64> <i64 0, i64 0>, %x
+  %and = and <2 x i64> %sub, <i64 1, i64 1>
+  ret <2 x i64> %and
+}
+
 define i64 @test10(i64 %x) {
 ; CHECK-LABEL: @test10(
 ; CHECK-NEXT:    [[AND:%.*]] = and i64 %x, 1




More information about the llvm-commits mailing list