[llvm] r349680 - [x86] add test to show ddup hole; NFC (PR37502)
Sanjay Patel via llvm-commits
llvm-commits at lists.llvm.org
Wed Dec 19 12:35:28 PST 2018
Author: spatel
Date: Wed Dec 19 12:35:28 2018
New Revision: 349680
URL: http://llvm.org/viewvc/llvm-project?rev=349680&view=rev
Log:
[x86] add test to show ddup hole; NFC (PR37502)
Modified:
llvm/trunk/test/CodeGen/X86/build-vector-128.ll
Modified: llvm/trunk/test/CodeGen/X86/build-vector-128.ll
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/CodeGen/X86/build-vector-128.ll?rev=349680&r1=349679&r2=349680&view=diff
==============================================================================
--- llvm/trunk/test/CodeGen/X86/build-vector-128.ll (original)
+++ llvm/trunk/test/CodeGen/X86/build-vector-128.ll Wed Dec 19 12:35:28 2018
@@ -507,3 +507,68 @@ define <4 x i32> @test_buildvector_v4i32
%splat = shufflevector <4 x i32> %insert, <4 x i32> undef, <4 x i32> zeroinitializer
ret <4 x i32> %splat
}
+
+; PR37502 - https://bugs.llvm.org/show_bug.cgi?id=37502
+; Don't use a series of insertps when movddup will do.
+
+define <4 x float> @PR37502(float %x, float %y) {
+; SSE2-32-LABEL: PR37502:
+; SSE2-32: # %bb.0:
+; SSE2-32-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
+; SSE2-32-NEXT: movlhps {{.*#+}} xmm0 = xmm0[0,0]
+; SSE2-32-NEXT: retl
+;
+; SSE2-64-LABEL: PR37502:
+; SSE2-64: # %bb.0:
+; SSE2-64-NEXT: unpcklps {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
+; SSE2-64-NEXT: movlhps {{.*#+}} xmm0 = xmm0[0,0]
+; SSE2-64-NEXT: retq
+;
+; SSE41-32-LABEL: PR37502:
+; SSE41-32: # %bb.0:
+; SSE41-32-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
+; SSE41-32-NEXT: insertps {{.*#+}} xmm0 = xmm0[0,1],mem[0],xmm0[3]
+; SSE41-32-NEXT: insertps {{.*#+}} xmm0 = xmm0[0,1,2],mem[0]
+; SSE41-32-NEXT: retl
+;
+; SSE41-64-LABEL: PR37502:
+; SSE41-64: # %bb.0:
+; SSE41-64-NEXT: movaps %xmm0, %xmm2
+; SSE41-64-NEXT: insertps {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[2,3]
+; SSE41-64-NEXT: insertps {{.*#+}} xmm2 = xmm2[0,1],xmm0[0],xmm2[3]
+; SSE41-64-NEXT: insertps {{.*#+}} xmm2 = xmm2[0,1,2],xmm1[0]
+; SSE41-64-NEXT: movaps %xmm2, %xmm0
+; SSE41-64-NEXT: retq
+;
+; AVX1-32-LABEL: PR37502:
+; AVX1-32: # %bb.0:
+; AVX1-32-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
+; AVX1-32-NEXT: vinsertps {{.*#+}} xmm0 = xmm0[0,1],mem[0],xmm0[3]
+; AVX1-32-NEXT: vinsertps {{.*#+}} xmm0 = xmm0[0,1,2],mem[0]
+; AVX1-32-NEXT: retl
+;
+; AVX1-64-LABEL: PR37502:
+; AVX1-64: # %bb.0:
+; AVX1-64-NEXT: vinsertps {{.*#+}} xmm2 = xmm0[0],xmm1[0],xmm0[2,3]
+; AVX1-64-NEXT: vinsertps {{.*#+}} xmm0 = xmm2[0,1],xmm0[0],xmm2[3]
+; AVX1-64-NEXT: vinsertps {{.*#+}} xmm0 = xmm0[0,1,2],xmm1[0]
+; AVX1-64-NEXT: retq
+;
+; AVX2-32-LABEL: PR37502:
+; AVX2-32: # %bb.0:
+; AVX2-32-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
+; AVX2-32-NEXT: vmovddup {{.*#+}} xmm0 = xmm0[0,0]
+; AVX2-32-NEXT: retl
+;
+; AVX2-64-LABEL: PR37502:
+; AVX2-64: # %bb.0:
+; AVX2-64-NEXT: vunpcklps {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
+; AVX2-64-NEXT: vmovddup {{.*#+}} xmm0 = xmm0[0,0]
+; AVX2-64-NEXT: retq
+ %i0 = insertelement <4 x float> undef, float %x, i32 0
+ %i1 = insertelement <4 x float> %i0, float %y, i32 1
+ %i2 = insertelement <4 x float> %i1, float %x, i32 2
+ %i3 = insertelement <4 x float> %i2, float %y, i32 3
+ ret <4 x float> %i3
+}
+
More information about the llvm-commits
mailing list