}
// TODO: Can we handle this inside matchShuffleWithPACK?
if (MaskVT == MVT::v4i32 && Subtarget.hasSSE2() &&
- isTargetShuffleEquivalent(MaskVT, Mask, {0, 2, 4, 6}, DAG)) {
- if (V1.getScalarValueSizeInBits() == 64 &&
- V2.getScalarValueSizeInBits() == 64 &&
- DAG.ComputeNumSignBits(V1) == 64 && DAG.ComputeNumSignBits(V2) == 64) {
+ isTargetShuffleEquivalent(MaskVT, Mask, {0, 2, 4, 6}, DAG) &&
+ V1.getScalarValueSizeInBits() == 64 &&
+ V2.getScalarValueSizeInBits() == 64) {
+ // Use PACKSSWD if the signbits extend to the lowest 16-bits.
+ if (DAG.ComputeNumSignBits(V1) > 48 && DAG.ComputeNumSignBits(V2) > 48) {
SrcVT = MVT::v4i32;
DstVT = MVT::v8i16;
Shuffle = X86ISD::PACKSS;
; AVX512F-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
; AVX512F-NEXT: vpsraq $48, %zmm0, %zmm0
; AVX512F-NEXT: vpsraq $48, %zmm1, %zmm1
-; AVX512F-NEXT: vshufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[0,2]
+; AVX512F-NEXT: vpackssdw %xmm1, %xmm0, %xmm0
; AVX512F-NEXT: vcvtdq2ps %xmm0, %xmm0
; AVX512F-NEXT: vzeroupper
; AVX512F-NEXT: retq