[X86] Address post-commit review from code I accidentally commited in r373136.
See https://reviews.llvm.org/D68167 llvm-svn: 373245
This commit is contained in:
parent
f0ca10f2ab
commit
8216414fd1
|
|
@ -43479,16 +43479,19 @@ static SDValue combineAdd(SDNode *N, SelectionDAG &DAG,
|
||||||
// FIXME: We have the (sub Y, (zext (vXi1 X))) -> (add (sext (vXi1 X)), Y) in
|
// FIXME: We have the (sub Y, (zext (vXi1 X))) -> (add (sext (vXi1 X)), Y) in
|
||||||
// generic DAG combine without a legal type check, but adding this there
|
// generic DAG combine without a legal type check, but adding this there
|
||||||
// caused regressions.
|
// caused regressions.
|
||||||
if (Subtarget.hasAVX512() && VT.isVector()) {
|
if (VT.isVector()) {
|
||||||
|
const TargetLowering &TLI = DAG.getTargetLoweringInfo();
|
||||||
if (Op0.getOpcode() == ISD::ZERO_EXTEND &&
|
if (Op0.getOpcode() == ISD::ZERO_EXTEND &&
|
||||||
Op0.getOperand(0).getValueType().getVectorElementType() == MVT::i1) {
|
Op0.getOperand(0).getValueType().getVectorElementType() == MVT::i1 &&
|
||||||
|
TLI.isTypeLegal(Op0.getOperand(0).getValueType())) {
|
||||||
SDLoc DL(N);
|
SDLoc DL(N);
|
||||||
SDValue SExt = DAG.getNode(ISD::SIGN_EXTEND, DL, VT, Op0.getOperand(0));
|
SDValue SExt = DAG.getNode(ISD::SIGN_EXTEND, DL, VT, Op0.getOperand(0));
|
||||||
return DAG.getNode(ISD::SUB, DL, VT, Op1, SExt);
|
return DAG.getNode(ISD::SUB, DL, VT, Op1, SExt);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (Op1.getOpcode() == ISD::ZERO_EXTEND &&
|
if (Op1.getOpcode() == ISD::ZERO_EXTEND &&
|
||||||
Op1.getOperand(0).getValueType().getVectorElementType() == MVT::i1) {
|
Op1.getOperand(0).getValueType().getVectorElementType() == MVT::i1 &&
|
||||||
|
TLI.isTypeLegal(Op1.getOperand(0).getValueType())) {
|
||||||
SDLoc DL(N);
|
SDLoc DL(N);
|
||||||
SDValue SExt = DAG.getNode(ISD::SIGN_EXTEND, DL, VT, Op1.getOperand(0));
|
SDValue SExt = DAG.getNode(ISD::SIGN_EXTEND, DL, VT, Op1.getOperand(0));
|
||||||
return DAG.getNode(ISD::SUB, DL, VT, Op0, SExt);
|
return DAG.getNode(ISD::SUB, DL, VT, Op0, SExt);
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue