From 422574b6f8c90ce37345933f5fb468e2362ab720 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Thu, 13 Apr 2017 01:31:40 +0000 Subject: [PATCH] [InstCombine] Add vector version of a test to show missing optimization. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@300161 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/InstCombine/and2.ll | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test/Transforms/InstCombine/and2.ll b/test/Transforms/InstCombine/and2.ll index 1af248b804c..afaddb701a9 100644 --- a/test/Transforms/InstCombine/and2.ll +++ b/test/Transforms/InstCombine/and2.ll @@ -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]], +; CHECK-NEXT: ret <2 x i64> [[AND]] +; + %sub = sub nsw <2 x i64> , %x + %and = and <2 x i64> %sub, + ret <2 x i64> %and +} + define i64 @test10(i64 %x) { ; CHECK-LABEL: @test10( ; CHECK-NEXT: [[AND:%.*]] = and i64 %x, 1 -- 2.50.1