diff --git a/llvm/lib/Target/X86/X86ISelLowering.cpp b/llvm/lib/Target/X86/X86ISelLowering.cpp index 6b6a1d97282a..bb6faab3a19d 100644 --- a/llvm/lib/Target/X86/X86ISelLowering.cpp +++ b/llvm/lib/Target/X86/X86ISelLowering.cpp @@ -5509,6 +5509,15 @@ static bool getFauxShuffleMask(SDValue N, SmallVectorImpl &Mask, } return true; } + case X86ISD::VZEXT: { + // TODO - add support for VPMOVZX with smaller input vector types. + SDValue Op0 = N.getOperand(0); + if (VT.getSizeInBits() != Op0.getValueSizeInBits()) + break; + DecodeZeroExtendMask(Op0.getSimpleValueType().getScalarType(), VT, Mask); + Ops.push_back(Op0); + return true; + } } return false; diff --git a/llvm/test/CodeGen/X86/2011-10-21-widen-cmp.ll b/llvm/test/CodeGen/X86/2011-10-21-widen-cmp.ll index f60eb5afa0a5..9e6e2f70b0a7 100644 --- a/llvm/test/CodeGen/X86/2011-10-21-widen-cmp.ll +++ b/llvm/test/CodeGen/X86/2011-10-21-widen-cmp.ll @@ -9,9 +9,7 @@ define void @cmp_2_floats(<2 x float> %a, <2 x float> %b) { ; CHECK: # BB#0: # %entry ; CHECK-NEXT: movaps %xmm0, %xmm2 ; CHECK-NEXT: cmpordps %xmm0, %xmm0 -; CHECK-NEXT: pmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero -; CHECK-NEXT: psllq $32, %xmm0 -; CHECK-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,3,2,3] +; CHECK-NEXT: insertps {{.*#+}} xmm0 = xmm0[0,1],zero,xmm0[1] ; CHECK-NEXT: pslld $31, %xmm0 ; CHECK-NEXT: blendvps %xmm2, %xmm1 ; CHECK-NEXT: movlps %xmm1, (%rax) @@ -26,7 +24,7 @@ entry: define void @cmp_2_doubles(<2 x double> %a, <2 x double> %b) { ; CHECK-LABEL: cmp_2_doubles: ; CHECK: # BB#0: # %entry -; CHECK-NEXT: movapd %xmm0, %xmm2 +; CHECK-NEXT: movapd %xmm0, %xmm2 ; CHECK-NEXT: cmpordpd %xmm0, %xmm0 ; CHECK-NEXT: blendvpd %xmm2, %xmm1 ; CHECK-NEXT: movapd %xmm1, (%rax) diff --git a/llvm/test/CodeGen/X86/avx2-vbroadcast.ll b/llvm/test/CodeGen/X86/avx2-vbroadcast.ll index 029c21ae046a..0d1aaac1a408 100644 --- a/llvm/test/CodeGen/X86/avx2-vbroadcast.ll +++ b/llvm/test/CodeGen/X86/avx2-vbroadcast.ll @@ -279,15 +279,15 @@ define <16 x i16> @broadcast_mem_v4i16_v16i16(<4 x i16>* %ptr) { ; X32-AVX2-LABEL: broadcast_mem_v4i16_v16i16: ; X32-AVX2: ## BB#0: ; X32-AVX2-NEXT: movl {{[0-9]+}}(%esp), %eax -; X32-AVX2-NEXT: vpmovzxwd {{.*#+}} xmm0 = mem[0],zero,mem[1],zero,mem[2],zero,mem[3],zero -; X32-AVX2-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[0,1,4,5,8,9,12,13,8,9,12,13,12,13,14,15] +; X32-AVX2-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero +; X32-AVX2-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[0,1,2,3,4,5,6,7,4,5,6,7,6,7],zero,zero ; X32-AVX2-NEXT: vpbroadcastq %xmm0, %ymm0 ; X32-AVX2-NEXT: retl ; ; X64-AVX2-LABEL: broadcast_mem_v4i16_v16i16: ; X64-AVX2: ## BB#0: -; X64-AVX2-NEXT: vpmovzxwd {{.*#+}} xmm0 = mem[0],zero,mem[1],zero,mem[2],zero,mem[3],zero -; X64-AVX2-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[0,1,4,5,8,9,12,13,8,9,12,13,12,13,14,15] +; X64-AVX2-NEXT: vmovq {{.*#+}} xmm0 = mem[0],zero +; X64-AVX2-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[0,1,2,3,4,5,6,7,4,5,6,7,6,7],zero,zero ; X64-AVX2-NEXT: vpbroadcastq %xmm0, %ymm0 ; X64-AVX2-NEXT: retq ; diff --git a/llvm/test/CodeGen/X86/avx512-cvt.ll b/llvm/test/CodeGen/X86/avx512-cvt.ll index 75ac79698251..884362edcf1a 100644 --- a/llvm/test/CodeGen/X86/avx512-cvt.ll +++ b/llvm/test/CodeGen/X86/avx512-cvt.ll @@ -923,9 +923,7 @@ define <2 x float> @sitofp_2i1_float(<2 x float> %a) { ; KNL: ## BB#0: ; KNL-NEXT: vxorps %xmm1, %xmm1, %xmm1 ; KNL-NEXT: vcmpltps %xmm0, %xmm1, %xmm0 -; KNL-NEXT: vpmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero -; KNL-NEXT: vpsllq $32, %xmm0, %xmm0 -; KNL-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[1,3,2,3] +; KNL-NEXT: vinsertps {{.*#+}} xmm0 = xmm0[0,1],zero,xmm0[1] ; KNL-NEXT: vcvtdq2ps %xmm0, %xmm0 ; KNL-NEXT: retq ; diff --git a/llvm/test/CodeGen/X86/sse-minmax.ll b/llvm/test/CodeGen/X86/sse-minmax.ll index b9d9e3189202..de85d8a799ed 100644 --- a/llvm/test/CodeGen/X86/sse-minmax.ll +++ b/llvm/test/CodeGen/X86/sse-minmax.ll @@ -1337,9 +1337,7 @@ define <2 x float> @test_maxps_illegal_v2f32(<2 x float> %x, <2 x float> %y) { ; STRICT-NEXT: movaps %xmm0, %xmm2 ; STRICT-NEXT: movaps %xmm1, %xmm0 ; STRICT-NEXT: cmpleps %xmm2, %xmm0 -; STRICT-NEXT: pmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero -; STRICT-NEXT: psllq $32, %xmm0 -; STRICT-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,3,2,3] +; STRICT-NEXT: insertps {{.*#+}} xmm0 = xmm0[0,1],zero,xmm0[1] ; STRICT-NEXT: pslld $31, %xmm0 ; STRICT-NEXT: blendvps %xmm2, %xmm1 ; STRICT-NEXT: movaps %xmm1, %xmm0 @@ -1360,9 +1358,7 @@ define <2 x float> @test_minps_illegal_v2f32(<2 x float> %x, <2 x float> %y) { ; STRICT: # BB#0: ; STRICT-NEXT: movaps %xmm0, %xmm2 ; STRICT-NEXT: cmpleps %xmm1, %xmm0 -; STRICT-NEXT: pmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero -; STRICT-NEXT: psllq $32, %xmm0 -; STRICT-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,3,2,3] +; STRICT-NEXT: insertps {{.*#+}} xmm0 = xmm0[0,1],zero,xmm0[1] ; STRICT-NEXT: pslld $31, %xmm0 ; STRICT-NEXT: blendvps %xmm2, %xmm1 ; STRICT-NEXT: movaps %xmm1, %xmm0