@@ -43479,16 +43479,19 @@ static SDValue combineAdd(SDNode *N, SelectionDAG &DAG,
43479
43479
// FIXME: We have the (sub Y, (zext (vXi1 X))) -> (add (sext (vXi1 X)), Y) in
43480
43480
// generic DAG combine without a legal type check, but adding this there
43481
43481
// caused regressions.
43482
- if (Subtarget.hasAVX512() && VT.isVector()) {
43482
+ if (VT.isVector()) {
43483
+ const TargetLowering &TLI = DAG.getTargetLoweringInfo();
43483
43484
if (Op0.getOpcode() == ISD::ZERO_EXTEND &&
43484
- Op0.getOperand(0).getValueType().getVectorElementType() == MVT::i1) {
43485
+ Op0.getOperand(0).getValueType().getVectorElementType() == MVT::i1 &&
43486
+ TLI.isTypeLegal(Op0.getOperand(0).getValueType())) {
43485
43487
SDLoc DL(N);
43486
43488
SDValue SExt = DAG.getNode(ISD::SIGN_EXTEND, DL, VT, Op0.getOperand(0));
43487
43489
return DAG.getNode(ISD::SUB, DL, VT, Op1, SExt);
43488
43490
}
43489
43491
43490
43492
if (Op1.getOpcode() == ISD::ZERO_EXTEND &&
43491
- Op1.getOperand(0).getValueType().getVectorElementType() == MVT::i1) {
43493
+ Op1.getOperand(0).getValueType().getVectorElementType() == MVT::i1 &&
43494
+ TLI.isTypeLegal(Op1.getOperand(0).getValueType())) {
43492
43495
SDLoc DL(N);
43493
43496
SDValue SExt = DAG.getNode(ISD::SIGN_EXTEND, DL, VT, Op1.getOperand(0));
43494
43497
return DAG.getNode(ISD::SUB, DL, VT, Op0, SExt);
0 commit comments