]> granicus.if.org Git - llvm/commitdiff
[x86] add haddps test for PR34111; NFC
authorSanjay Patel <spatel@rotateright.com>
Sun, 27 Aug 2017 17:15:49 +0000 (17:15 +0000)
committerSanjay Patel <spatel@rotateright.com>
Sun, 27 Aug 2017 17:15:49 +0000 (17:15 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@311852 91177308-0d34-0410-b5e6-96231b3b80d8

test/CodeGen/X86/haddsub.ll

index 8e28433d2ac2f37c9df31c2c504671932d5b2e6b..b63d97df52a9793e477ac35078ae3967269f371a 100644 (file)
@@ -397,3 +397,28 @@ define <2 x float> @haddps_v2f32(<4 x float> %v0) {
   %res1 = insertelement <2 x float> %res0, float %op1, i32 1
   ret <2 x float> %res1
 }
+
+define <4 x float> @PR34111(<4 x float> %a) {
+; SSE3-LABEL: PR34111:
+; SSE3:       # BB#0:
+; SSE3-NEXT:    movaps %xmm0, %xmm1
+; SSE3-NEXT:    shufps {{.*#+}} xmm1 = xmm1[0,2,2,3]
+; SSE3-NEXT:    shufps {{.*#+}} xmm0 = xmm0[1,3,2,3]
+; SSE3-NEXT:    addps %xmm1, %xmm0
+; SSE3-NEXT:    movddup {{.*#+}} xmm0 = xmm0[0,0]
+; SSE3-NEXT:    retq
+;
+; AVX-LABEL: PR34111:
+; AVX:       # BB#0:
+; AVX-NEXT:    vpermilps {{.*#+}} xmm1 = xmm0[0,2,2,3]
+; AVX-NEXT:    vpermilps {{.*#+}} xmm0 = xmm0[1,3,2,3]
+; AVX-NEXT:    vaddps %xmm0, %xmm1, %xmm0
+; AVX-NEXT:    vmovddup {{.*#+}} xmm0 = xmm0[0,0]
+; AVX-NEXT:    retq
+  %a02 = shufflevector <4 x float> %a, <4 x float> undef, <2 x i32> <i32 0, i32 2>
+  %a13 = shufflevector <4 x float> %a, <4 x float> undef, <2 x i32> <i32 1, i32 3>
+  %add = fadd <2 x float> %a02, %a13
+  %hadd = shufflevector <2 x float> %add, <2 x float> undef, <4 x i32> <i32 undef, i32 undef, i32 0, i32 1>
+  ret <4 x float> %hadd
+}
+