Offset += NumElts; // Increment for next iteration.
}
-
+ // If we're broadcasting a SETCC result, try to broadcast the ops instead.
+ // TODO: What other unary shuffles would benefit from this?
+ if (isBroadcastShuffleMask(Mask) && V1.getOpcode() == ISD::SETCC &&
+ V1->hasOneUse()) {
+ SDValue Op0 = V1.getOperand(0);
+ SDValue Op1 = V1.getOperand(1);
+ ISD::CondCode CC = cast<CondCodeSDNode>(V1.getOperand(2))->get();
+ EVT OpVT = Op0.getValueType();
+ return DAG.getSetCC(
+ DL, VT, DAG.getVectorShuffle(OpVT, DL, Op0, DAG.getUNDEF(OpVT), Mask),
+ DAG.getVectorShuffle(OpVT, DL, Op1, DAG.getUNDEF(OpVT), Mask), CC);
+ }
MVT ExtVT;
switch (VT.SimpleTy) {
; AVX512F-NEXT: movl $789, %eax # imm = 0x315
; AVX512F-NEXT: vmovd %eax, %xmm1
; AVX512F-NEXT: vpmulld %xmm1, %xmm0, %xmm0
-; AVX512F-NEXT: vptestnmd %zmm0, %zmm0, %k2
-; AVX512F-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k2} {z}
; AVX512F-NEXT: vpbroadcastd %xmm0, %zmm0
-; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k1 {%k1}
+; AVX512F-NEXT: vptestnmd %zmm0, %zmm0, %k1 {%k1}
; AVX512F-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
; AVX512F-NEXT: vpmovdb %zmm0, %xmm0
; AVX512F-NEXT: vzeroupper
; AVX512VL-NEXT: movl $789, %eax # imm = 0x315
; AVX512VL-NEXT: vmovd %eax, %xmm1
; AVX512VL-NEXT: vpmulld %xmm1, %xmm0, %xmm0
-; AVX512VL-NEXT: vptestnmd %zmm0, %zmm0, %k2
-; AVX512VL-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k2} {z}
; AVX512VL-NEXT: vpbroadcastd %xmm0, %zmm0
-; AVX512VL-NEXT: vptestmd %zmm0, %zmm0, %k1 {%k1}
+; AVX512VL-NEXT: vptestnmd %zmm0, %zmm0, %k1 {%k1}
; AVX512VL-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
; AVX512VL-NEXT: vpmovdb %zmm0, %xmm0
; AVX512VL-NEXT: vzeroupper
; VL_BW_DQ-LABEL: PR52500:
; VL_BW_DQ: # %bb.0:
; VL_BW_DQ-NEXT: vpsllw $7, %xmm0, %xmm0
-; VL_BW_DQ-NEXT: vpxor %xmm1, %xmm1, %xmm1
-; VL_BW_DQ-NEXT: vmovd %edi, %xmm2
+; VL_BW_DQ-NEXT: vpmovb2m %xmm0, %k1
+; VL_BW_DQ-NEXT: vmovd %edi, %xmm0
; VL_BW_DQ-NEXT: movl $789, %eax # imm = 0x315
-; VL_BW_DQ-NEXT: vmovd %eax, %xmm3
-; VL_BW_DQ-NEXT: vpmulld %xmm3, %xmm2, %xmm2
-; VL_BW_DQ-NEXT: vptestnmd %zmm2, %zmm2, %k0
-; VL_BW_DQ-NEXT: vpmovm2d %k0, %zmm2
-; VL_BW_DQ-NEXT: vpbroadcastd %xmm2, %zmm2
-; VL_BW_DQ-NEXT: vpmovd2m %zmm2, %k1
-; VL_BW_DQ-NEXT: vpcmpgtb %xmm0, %xmm1, %k0 {%k1}
+; VL_BW_DQ-NEXT: vmovd %eax, %xmm1
+; VL_BW_DQ-NEXT: vpmulld %xmm1, %xmm0, %xmm0
+; VL_BW_DQ-NEXT: vpbroadcastd %xmm0, %zmm0
+; VL_BW_DQ-NEXT: vptestnmd %zmm0, %zmm0, %k0 {%k1}
; VL_BW_DQ-NEXT: vpmovm2b %k0, %xmm0
; VL_BW_DQ-NEXT: vzeroupper
; VL_BW_DQ-NEXT: retq