Skip to content

Commit bc745dc

Browse files
authored
[LegalizeTypes] Use getShiftAmountConstant in PromoteIntRes_FunnelShift. (#158553)
1 parent b154b05 commit bc745dc

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

llvm/lib/CodeGen/SelectionDAG/LegalizeIntegerTypes.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1613,7 +1613,7 @@ SDValue DAGTypeLegalizer::PromoteIntRes_FunnelShift(SDNode *N) {
16131613
// fshr(x,y,z) -> (((aext(x) << bw) | zext(y)) >> (z % bw)).
16141614
if (NewBits >= (2 * OldBits) && !isa<ConstantSDNode>(Amt) &&
16151615
!TLI.isOperationLegalOrCustom(Opcode, VT)) {
1616-
SDValue HiShift = DAG.getConstant(OldBits, DL, VT);
1616+
SDValue HiShift = DAG.getShiftAmountConstant(OldBits, VT, DL);
16171617
Hi = DAG.getNode(ISD::SHL, DL, VT, Hi, HiShift);
16181618
Lo = DAG.getZeroExtendInReg(Lo, DL, OldVT);
16191619
SDValue Res = DAG.getNode(ISD::OR, DL, VT, Hi, Lo);
@@ -1624,13 +1624,14 @@ SDValue DAGTypeLegalizer::PromoteIntRes_FunnelShift(SDNode *N) {
16241624
}
16251625

16261626
// Shift Lo up to occupy the upper bits of the promoted type.
1627-
SDValue ShiftOffset = DAG.getConstant(NewBits - OldBits, DL, AmtVT);
1628-
Lo = DAG.getNode(ISD::SHL, DL, VT, Lo, ShiftOffset);
1627+
Lo = DAG.getNode(ISD::SHL, DL, VT, Lo,
1628+
DAG.getShiftAmountConstant(NewBits - OldBits, VT, DL));
16291629

16301630
// Increase Amount to shift the result into the lower bits of the promoted
16311631
// type.
16321632
if (IsFSHR)
1633-
Amt = DAG.getNode(ISD::ADD, DL, AmtVT, Amt, ShiftOffset);
1633+
Amt = DAG.getNode(ISD::ADD, DL, AmtVT, Amt,
1634+
DAG.getConstant(NewBits - OldBits, DL, VT));
16341635

16351636
return DAG.getNode(Opcode, DL, VT, Hi, Lo, Amt);
16361637
}

0 commit comments

Comments
 (0)