Skip to content

Commit 1bad702

Browse files
committed
[X86] combineShiftToPMULH - reuse existing SDLoc. NFC.
1 parent 43e357f commit 1bad702

File tree

1 file changed

+6
-9
lines changed

1 file changed

+6
-9
lines changed

llvm/lib/Target/X86/X86ISelLowering.cpp

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -47970,10 +47970,10 @@ static SDValue combineMul(SDNode *N, SelectionDAG &DAG,
4797047970
// of a MULHU/MULHS. There isn't a way to convey this to the generic DAG
4797147971
// combiner.
4797247972
static SDValue combineShiftToPMULH(SDNode *N, SelectionDAG &DAG,
47973+
const SDLoc &DL,
4797347974
const X86Subtarget &Subtarget) {
4797447975
assert((N->getOpcode() == ISD::SRL || N->getOpcode() == ISD::SRA) &&
4797547976
"SRL or SRA node is required here!");
47976-
SDLoc DL(N);
4797747977

4797847978
if (!Subtarget.hasSSE2())
4797947979
return SDValue();
@@ -48024,6 +48024,7 @@ static SDValue combineShiftLeft(SDNode *N, SelectionDAG &DAG,
4802448024
SDValue N1 = N->getOperand(1);
4802548025
ConstantSDNode *N1C = dyn_cast<ConstantSDNode>(N1);
4802648026
EVT VT = N0.getValueType();
48027+
SDLoc DL(N);
4802748028

4802848029
// Exploits AVX2 VSHLV/VSRLV instructions for efficient unsigned vector shifts
4802948030
// with out-of-bounds clamping.
@@ -48039,7 +48040,6 @@ static SDValue combineShiftLeft(SDNode *N, SelectionDAG &DAG,
4803948040
ISD::isConstantSplatVector(Cond.getOperand(1).getNode(), SV) &&
4804048041
ISD::isConstantSplatVectorAllZeros(N01.getNode()) &&
4804148042
SV == VT.getScalarSizeInBits()) {
48042-
SDLoc DL(N);
4804348043
return DAG.getNode(X86ISD::VSHLV, DL, VT, N00, N1);
4804448044
}
4804548045
}
@@ -48074,10 +48074,8 @@ static SDValue combineShiftLeft(SDNode *N, SelectionDAG &DAG,
4807448074
N00.getOperand(0).getOpcode() == X86ISD::SETCC_CARRY) {
4807548075
MaskOK = Mask.isIntN(N00.getOperand(0).getValueSizeInBits());
4807648076
}
48077-
if (MaskOK && Mask != 0) {
48078-
SDLoc DL(N);
48077+
if (MaskOK && Mask != 0)
4807948078
return DAG.getNode(ISD::AND, DL, VT, N00, DAG.getConstant(Mask, DL, VT));
48080-
}
4808148079
}
4808248080

4808348081
return SDValue();
@@ -48092,7 +48090,7 @@ static SDValue combineShiftRightArithmetic(SDNode *N, SelectionDAG &DAG,
4809248090
unsigned Size = VT.getSizeInBits();
4809348091
SDLoc DL(N);
4809448092

48095-
if (SDValue V = combineShiftToPMULH(N, DAG, Subtarget))
48093+
if (SDValue V = combineShiftToPMULH(N, DAG, DL, Subtarget))
4809648094
return V;
4809748095

4809848096
// fold sra(x,umin(amt,bw-1)) -> avx2 psrav(x,amt)
@@ -48157,8 +48155,9 @@ static SDValue combineShiftRightLogical(SDNode *N, SelectionDAG &DAG,
4815748155
SDValue N0 = N->getOperand(0);
4815848156
SDValue N1 = N->getOperand(1);
4815948157
EVT VT = N0.getValueType();
48158+
SDLoc DL(N);
4816048159

48161-
if (SDValue V = combineShiftToPMULH(N, DAG, Subtarget))
48160+
if (SDValue V = combineShiftToPMULH(N, DAG, DL, Subtarget))
4816248161
return V;
4816348162

4816448163
// Exploits AVX2 VSHLV/VSRLV instructions for efficient unsigned vector shifts
@@ -48175,7 +48174,6 @@ static SDValue combineShiftRightLogical(SDNode *N, SelectionDAG &DAG,
4817548174
ISD::isConstantSplatVector(Cond.getOperand(1).getNode(), SV) &&
4817648175
ISD::isConstantSplatVectorAllZeros(N01.getNode()) &&
4817748176
SV == VT.getScalarSizeInBits()) {
48178-
SDLoc DL(N);
4817948177
return DAG.getNode(X86ISD::VSRLV, DL, VT, N00, N1);
4818048178
}
4818148179
}
@@ -48215,7 +48213,6 @@ static SDValue combineShiftRightLogical(SDNode *N, SelectionDAG &DAG,
4821548213
if ((OldMaskSize > 8 && NewMaskSize <= 8) ||
4821648214
(OldMaskSize > 32 && NewMaskSize <= 32)) {
4821748215
// srl (and X, AndC), ShiftC --> and (srl X, ShiftC), (AndC >> ShiftC)
48218-
SDLoc DL(N);
4821948216
SDValue NewMask = DAG.getConstant(NewMaskVal, DL, VT);
4822048217
SDValue NewShift = DAG.getNode(ISD::SRL, DL, VT, N0.getOperand(0), N1);
4822148218
return DAG.getNode(ISD::AND, DL, VT, NewShift, NewMask);

0 commit comments

Comments
 (0)