Skip to content

Commit

Permalink
[XTensa] Use getSignedConstant() for negative values
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Nov 25, 2024
1 parent 506ca19 commit 4715dec
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions llvm/lib/Target/Xtensa/XtensaISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -845,7 +845,7 @@ SDValue XtensaTargetLowering::LowerDYNAMIC_STACKALLOC(SDValue Op,
SDValue SizeTmp =
DAG.getNode(ISD::ADD, DL, VT, Size, DAG.getConstant(31, DL, MVT::i32));
SDValue SizeRoundUp = DAG.getNode(ISD::AND, DL, VT, SizeTmp,
DAG.getConstant(~31, DL, MVT::i32));
DAG.getSignedConstant(~31, DL, MVT::i32));

unsigned SPReg = Xtensa::SP;
SDValue SP = DAG.getCopyFromReg(Chain, DL, SPReg, VT);
Expand Down Expand Up @@ -873,7 +873,7 @@ SDValue XtensaTargetLowering::LowerShiftLeftParts(SDValue Op,
// Lo = 0
// Hi = Lo << (Shamt - register size)

SDValue MinusRegisterSize = DAG.getConstant(-32, DL, VT);
SDValue MinusRegisterSize = DAG.getSignedConstant(-32, DL, VT);
SDValue ShamtMinusRegisterSize =
DAG.getNode(ISD::ADD, DL, VT, Shamt, MinusRegisterSize);

Expand Down Expand Up @@ -914,7 +914,7 @@ SDValue XtensaTargetLowering::LowerShiftRightParts(SDValue Op,
// Hi = 0;

unsigned ShiftRightOp = IsSRA ? ISD::SRA : ISD::SRL;
SDValue MinusRegisterSize = DAG.getConstant(-32, DL, VT);
SDValue MinusRegisterSize = DAG.getSignedConstant(-32, DL, VT);
SDValue RegisterSizeMinus1 = DAG.getConstant(32 - 1, DL, VT);
SDValue ShamtMinusRegisterSize =
DAG.getNode(ISD::ADD, DL, VT, Shamt, MinusRegisterSize);
Expand Down

0 comments on commit 4715dec

Please sign in to comment.