]> granicus.if.org Git - llvm/commitdiff
[X86] Add tests to show that the DAG combine for OR of shuffles with zero vectors...
authorCraig Topper <craig.topper@gmail.com>
Sun, 3 Jul 2016 19:37:10 +0000 (19:37 +0000)
committerCraig Topper <craig.topper@gmail.com>
Sun, 3 Jul 2016 19:37:10 +0000 (19:37 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@274471 91177308-0d34-0410-b5e6-96231b3b80d8

test/CodeGen/X86/combine-or.ll

index 22f0dbbd1a962bb6c95830adbad52bcf48190afb..fdca611c56c16742e29eabdadf0f88dbb260f106 100644 (file)
@@ -391,3 +391,31 @@ define <4 x i32> @test2d(<4 x i32> %a, <4 x i32> %b) {
   %or = or <4 x i32> %shuf1, %shuf2
   ret <4 x i32> %or
 }
+
+; Make sure we can have an undef where an index pointing to the zero vector should be
+
+define <4 x i32> @test2e(<4 x i32> %a, <4 x i32> %b) {
+; CHECK-LABEL: test2e:
+; CHECK:       # BB#0:
+; CHECK-NEXT:    pxor %xmm2, %xmm2
+; CHECK-NEXT:    pblendw {{.*#+}} xmm0 = xmm0[0,1],xmm2[2,3],xmm0[4,5,6,7]
+; CHECK-NEXT:    movq {{.*#+}} xmm1 = xmm1[0],zero
+; CHECK-NEXT:    por %xmm1, %xmm0
+; CHECK-NEXT:    retq
+  %shuf1 = shufflevector <4 x i32> %a, <4 x i32> <i32 0, i32 undef, i32 undef, i32 undef>, <4 x i32><i32 undef, i32 4, i32 2, i32 3>
+  %shuf2 = shufflevector <4 x i32> %b, <4 x i32> <i32 0, i32 undef, i32 undef, i32 undef>, <4 x i32><i32 0, i32 1, i32 4, i32 4>
+  %or = or <4 x i32> %shuf1, %shuf2
+  ret <4 x i32> %or
+}
+
+define <4 x i32> @test2f(<4 x i32> %a, <4 x i32> %b) {
+; CHECK-LABEL: test2f:
+; CHECK:       # BB#0:
+; CHECK-NEXT:    pshufd {{.*#+}} xmm0 = xmm0[3,1,2,3]
+; CHECK-NEXT:    pblendw {{.*#+}} xmm0 = xmm0[0,1],xmm1[2,3],xmm0[4,5,6,7]
+; CHECK-NEXT:    retq
+  %shuf1 = shufflevector <4 x i32> %a, <4 x i32> <i32 0, i32 undef, i32 undef, i32 undef>, <4 x i32><i32 4, i32 4, i32 2, i32 3>
+  %shuf2 = shufflevector <4 x i32> %b, <4 x i32> <i32 0, i32 undef, i32 undef, i32 undef>, <4 x i32><i32 undef, i32 1, i32 4, i32 4>
+  %or = or <4 x i32> %shuf1, %shuf2
+  ret <4 x i32> %or
+}