From 35b55965c4d7f18f31f3d75d9d787c968c0e8fe5 Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Sun, 9 Apr 2017 06:12:36 +0000 Subject: [PATCH] [InstCombine] Add test cases to show missing support for vectors in an OR combine. Also add the commuted versions. NFC git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@299820 91177308-0d34-0410-b5e6-96231b3b80d8 --- test/Transforms/InstCombine/and.ll | 42 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/test/Transforms/InstCombine/and.ll b/test/Transforms/InstCombine/and.ll index f9cae942b3a..be8aba99916 100644 --- a/test/Transforms/InstCombine/and.ll +++ b/test/Transforms/InstCombine/and.ll @@ -417,6 +417,48 @@ define i32 @test33(i32 %b) { ret i32 %tmp.13 } +define i32 @test33b(i32 %b) { +; CHECK-LABEL: @test33b( +; CHECK-NEXT: [[TMP_13:%.*]] = xor i32 [[B:%.*]], 1 +; CHECK-NEXT: ret i32 [[TMP_13]] +; + %tmp.4.mask = and i32 %b, 1 + %tmp.10 = xor i32 %tmp.4.mask, 1 + %tmp.12 = and i32 %b, -2 + %tmp.13 = or i32 %tmp.10, %tmp.12 + ret i32 %tmp.13 +} + +define <2 x i32> @test33vec(<2 x i32> %b) { +; CHECK-LABEL: @test33vec( +; CHECK-NEXT: [[TMP1:%.*]] = xor <2 x i32> [[B:%.*]], +; CHECK-NEXT: [[TMP_10:%.*]] = and <2 x i32> [[TMP1]], +; CHECK-NEXT: [[TMP_12:%.*]] = and <2 x i32> [[B]], +; CHECK-NEXT: [[TMP_13:%.*]] = or <2 x i32> [[TMP_12]], [[TMP_10]] +; CHECK-NEXT: ret <2 x i32> [[TMP_13]] +; + %tmp.4.mask = and <2 x i32> %b, + %tmp.10 = xor <2 x i32> %tmp.4.mask, + %tmp.12 = and <2 x i32> %b, + %tmp.13 = or <2 x i32> %tmp.12, %tmp.10 + ret <2 x i32> %tmp.13 +} + +define <2 x i32> @test33vecb(<2 x i32> %b) { +; CHECK-LABEL: @test33vecb( +; CHECK-NEXT: [[TMP1:%.*]] = xor <2 x i32> [[B:%.*]], +; CHECK-NEXT: [[TMP_10:%.*]] = and <2 x i32> [[TMP1]], +; CHECK-NEXT: [[TMP_12:%.*]] = and <2 x i32> [[B]], +; CHECK-NEXT: [[TMP_13:%.*]] = or <2 x i32> [[TMP_10]], [[TMP_12]] +; CHECK-NEXT: ret <2 x i32> [[TMP_13]] +; + %tmp.4.mask = and <2 x i32> %b, + %tmp.10 = xor <2 x i32> %tmp.4.mask, + %tmp.12 = and <2 x i32> %b, + %tmp.13 = or <2 x i32> %tmp.10, %tmp.12 + ret <2 x i32> %tmp.13 +} + define i32 @test34(i32 %A, i32 %B) { ; CHECK-LABEL: @test34( ; CHECK-NEXT: ret i32 %B -- 2.11.0