@@ -46875,7 +46875,7 @@ static bool canReduceVMulWidth(SDNode *N, SelectionDAG &DAG, ShrinkMode &Mode) {
46875
46875
/// If %2 == zext32(trunc16(%2)), i.e., the scalar value range of %2 is
46876
46876
/// 0 to 65535, and the scalar value range of %4 is also 0 to 65535,
46877
46877
/// generate pmullw+pmulhuw for it (MULU16 mode).
46878
- static SDValue reduceVMULWidth(SDNode *N, SelectionDAG &DAG,
46878
+ static SDValue reduceVMULWidth(SDNode *N, const SDLoc &DL, SelectionDAG &DAG,
46879
46879
const X86Subtarget &Subtarget) {
46880
46880
// Check for legality
46881
46881
// pmullw/pmulhw are not supported by SSE.
@@ -46894,7 +46894,6 @@ static SDValue reduceVMULWidth(SDNode *N, SelectionDAG &DAG,
46894
46894
if (!canReduceVMulWidth(N, DAG, Mode))
46895
46895
return SDValue();
46896
46896
46897
- SDLoc DL(N);
46898
46897
SDValue N0 = N->getOperand(0);
46899
46898
SDValue N1 = N->getOperand(1);
46900
46899
EVT VT = N->getOperand(0).getValueType();
@@ -47034,7 +47033,8 @@ static SDValue combineMulSpecial(uint64_t MulAmt, SDNode *N, SelectionDAG &DAG,
47034
47033
// If the upper 17 bits of either element are zero and the other element are
47035
47034
// zero/sign bits then we can use PMADDWD, which is always at least as quick as
47036
47035
// PMULLD, except on KNL.
47037
- static SDValue combineMulToPMADDWD(SDNode *N, SelectionDAG &DAG,
47036
+ static SDValue combineMulToPMADDWD(SDNode *N, const SDLoc &DL,
47037
+ SelectionDAG &DAG,
47038
47038
const X86Subtarget &Subtarget) {
47039
47039
if (!Subtarget.hasSSE2())
47040
47040
return SDValue();
@@ -47096,32 +47096,31 @@ static SDValue combineMulToPMADDWD(SDNode *N, SelectionDAG &DAG,
47096
47096
return Op;
47097
47097
// Mask off upper 16-bits of sign-extended constants.
47098
47098
if (ISD::isBuildVectorOfConstantSDNodes(Op.getNode()))
47099
- return DAG.getNode(ISD::AND, SDLoc(N), VT, Op,
47100
- DAG.getConstant(0xFFFF, SDLoc(N), VT));
47099
+ return DAG.getNode(ISD::AND, DL, VT, Op, DAG.getConstant(0xFFFF, DL, VT));
47101
47100
if (Op.getOpcode() == ISD::SIGN_EXTEND && N->isOnlyUserOf(Op.getNode())) {
47102
47101
SDValue Src = Op.getOperand(0);
47103
47102
// Convert sext(vXi16) to zext(vXi16).
47104
47103
if (Src.getScalarValueSizeInBits() == 16 && VT.getSizeInBits() <= 128)
47105
- return DAG.getNode(ISD::ZERO_EXTEND, SDLoc(N) , VT, Src);
47104
+ return DAG.getNode(ISD::ZERO_EXTEND, DL , VT, Src);
47106
47105
// Convert sext(vXi8) to zext(vXi16 sext(vXi8)) on pre-SSE41 targets
47107
47106
// which will expand the extension.
47108
47107
if (Src.getScalarValueSizeInBits() < 16 && !Subtarget.hasSSE41()) {
47109
47108
EVT ExtVT = VT.changeVectorElementType(MVT::i16);
47110
- Src = DAG.getNode(ISD::SIGN_EXTEND, SDLoc(N) , ExtVT, Src);
47111
- return DAG.getNode(ISD::ZERO_EXTEND, SDLoc(N) , VT, Src);
47109
+ Src = DAG.getNode(ISD::SIGN_EXTEND, DL , ExtVT, Src);
47110
+ return DAG.getNode(ISD::ZERO_EXTEND, DL , VT, Src);
47112
47111
}
47113
47112
}
47114
47113
// Convert SIGN_EXTEND_VECTOR_INREG to ZEXT_EXTEND_VECTOR_INREG.
47115
47114
if (Op.getOpcode() == ISD::SIGN_EXTEND_VECTOR_INREG &&
47116
47115
N->isOnlyUserOf(Op.getNode())) {
47117
47116
SDValue Src = Op.getOperand(0);
47118
47117
if (Src.getScalarValueSizeInBits() == 16)
47119
- return DAG.getNode(ISD::ZERO_EXTEND_VECTOR_INREG, SDLoc(N) , VT, Src);
47118
+ return DAG.getNode(ISD::ZERO_EXTEND_VECTOR_INREG, DL , VT, Src);
47120
47119
}
47121
47120
// Convert VSRAI(Op, 16) to VSRLI(Op, 16).
47122
47121
if (Op.getOpcode() == X86ISD::VSRAI && Op.getConstantOperandVal(1) == 16 &&
47123
47122
N->isOnlyUserOf(Op.getNode())) {
47124
- return DAG.getNode(X86ISD::VSRLI, SDLoc(N) , VT, Op.getOperand(0),
47123
+ return DAG.getNode(X86ISD::VSRLI, DL , VT, Op.getOperand(0),
47125
47124
Op.getOperand(1));
47126
47125
}
47127
47126
return SDValue();
@@ -47142,11 +47141,10 @@ static SDValue combineMulToPMADDWD(SDNode *N, SelectionDAG &DAG,
47142
47141
DAG.getBitcast(OpVT, Ops[0]),
47143
47142
DAG.getBitcast(OpVT, Ops[1]));
47144
47143
};
47145
- return SplitOpsAndApply(DAG, Subtarget, SDLoc(N), VT, {N0, N1},
47146
- PMADDWDBuilder);
47144
+ return SplitOpsAndApply(DAG, Subtarget, DL, VT, {N0, N1}, PMADDWDBuilder);
47147
47145
}
47148
47146
47149
- static SDValue combineMulToPMULDQ(SDNode *N, SelectionDAG &DAG,
47147
+ static SDValue combineMulToPMULDQ(SDNode *N, const SDLoc &DL, SelectionDAG &DAG,
47150
47148
const X86Subtarget &Subtarget) {
47151
47149
if (!Subtarget.hasSSE2())
47152
47150
return SDValue();
@@ -47170,8 +47168,8 @@ static SDValue combineMulToPMULDQ(SDNode *N, SelectionDAG &DAG,
47170
47168
ArrayRef<SDValue> Ops) {
47171
47169
return DAG.getNode(X86ISD::PMULDQ, DL, Ops[0].getValueType(), Ops);
47172
47170
};
47173
- return SplitOpsAndApply(DAG, Subtarget, SDLoc(N) , VT, { N0, N1 } ,
47174
- PMULDQBuilder, /*CheckBWI*/false);
47171
+ return SplitOpsAndApply(DAG, Subtarget, DL , VT, {N0, N1}, PMULDQBuilder ,
47172
+ /*CheckBWI*/ false);
47175
47173
}
47176
47174
47177
47175
// If the upper bits are zero we can use a single pmuludq.
@@ -47181,8 +47179,8 @@ static SDValue combineMulToPMULDQ(SDNode *N, SelectionDAG &DAG,
47181
47179
ArrayRef<SDValue> Ops) {
47182
47180
return DAG.getNode(X86ISD::PMULUDQ, DL, Ops[0].getValueType(), Ops);
47183
47181
};
47184
- return SplitOpsAndApply(DAG, Subtarget, SDLoc(N) , VT, { N0, N1 } ,
47185
- PMULUDQBuilder, /*CheckBWI*/false);
47182
+ return SplitOpsAndApply(DAG, Subtarget, DL , VT, {N0, N1}, PMULUDQBuilder ,
47183
+ /*CheckBWI*/ false);
47186
47184
}
47187
47185
47188
47186
return SDValue();
@@ -47192,15 +47190,16 @@ static SDValue combineMul(SDNode *N, SelectionDAG &DAG,
47192
47190
TargetLowering::DAGCombinerInfo &DCI,
47193
47191
const X86Subtarget &Subtarget) {
47194
47192
EVT VT = N->getValueType(0);
47193
+ SDLoc DL(N);
47195
47194
47196
- if (SDValue V = combineMulToPMADDWD(N, DAG, Subtarget))
47195
+ if (SDValue V = combineMulToPMADDWD(N, DL, DAG, Subtarget))
47197
47196
return V;
47198
47197
47199
- if (SDValue V = combineMulToPMULDQ(N, DAG, Subtarget))
47198
+ if (SDValue V = combineMulToPMULDQ(N, DL, DAG, Subtarget))
47200
47199
return V;
47201
47200
47202
47201
if (DCI.isBeforeLegalize() && VT.isVector())
47203
- return reduceVMULWidth(N, DAG, Subtarget);
47202
+ return reduceVMULWidth(N, DL, DAG, Subtarget);
47204
47203
47205
47204
// Optimize a single multiply with constant into two operations in order to
47206
47205
// implement it with two cheaper instructions, e.g. LEA + SHL, LEA + LEA.
@@ -47240,7 +47239,6 @@ static SDValue combineMul(SDNode *N, SelectionDAG &DAG,
47240
47239
assert(SignMulAmt != INT64_MIN && "Int min should have been handled!");
47241
47240
uint64_t AbsMulAmt = SignMulAmt < 0 ? -SignMulAmt : SignMulAmt;
47242
47241
47243
- SDLoc DL(N);
47244
47242
SDValue NewMul = SDValue();
47245
47243
if (VT == MVT::i64 || VT == MVT::i32) {
47246
47244
if (AbsMulAmt == 3 || AbsMulAmt == 5 || AbsMulAmt == 9) {
0 commit comments