Skip to content

Commit

Permalink
[M68k] Use getSignedConstant() where necessary
Browse files Browse the repository at this point in the history
  • Loading branch information
nikic committed Nov 25, 2024
1 parent 4715dec commit 3699931
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions llvm/lib/Target/M68k/M68kISelDAGToDAG.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,17 +289,17 @@ class M68kDAGToDAGISel : public SelectionDAGISel {

/// Return a target constant with the specified value of type i8.
inline SDValue getI8Imm(int64_t Imm, const SDLoc &DL) {
return CurDAG->getTargetConstant(Imm, DL, MVT::i8);
return CurDAG->getSignedTargetConstant(Imm, DL, MVT::i8);
}

/// Return a target constant with the specified value of type i8.
inline SDValue getI16Imm(int64_t Imm, const SDLoc &DL) {
return CurDAG->getTargetConstant(Imm, DL, MVT::i16);
return CurDAG->getSignedTargetConstant(Imm, DL, MVT::i16);
}

/// Return a target constant with the specified value, of type i32.
inline SDValue getI32Imm(int64_t Imm, const SDLoc &DL) {
return CurDAG->getTargetConstant(Imm, DL, MVT::i32);
return CurDAG->getSignedTargetConstant(Imm, DL, MVT::i32);
}

/// Return a reference to the TargetInstrInfo, casted to the target-specific
Expand Down
10 changes: 5 additions & 5 deletions llvm/lib/Target/M68k/M68kISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2947,7 +2947,7 @@ void M68kTargetLowering::LowerAsmOperandForConstraint(SDValue Op,
llvm_unreachable("Unhandled constant constraint");
}

Result = DAG.getTargetConstant(Val, SDLoc(Op), Op.getValueType());
Result = DAG.getSignedTargetConstant(Val, SDLoc(Op), Op.getValueType());
break;
}
default:
Expand Down Expand Up @@ -2983,7 +2983,7 @@ void M68kTargetLowering::LowerAsmOperandForConstraint(SDValue Op,
llvm_unreachable("Unhandled constant constraint");
}

Result = DAG.getTargetConstant(Val, SDLoc(Op), Op.getValueType());
Result = DAG.getSignedTargetConstant(Val, SDLoc(Op), Op.getValueType());
break;
}
default:
Expand Down Expand Up @@ -3415,7 +3415,7 @@ SDValue M68kTargetLowering::LowerDYNAMIC_STACKALLOC(SDValue Op,
Result = DAG.getNode(ISD::SUB, DL, VT, SP, Size); // Value
if (Align > StackAlign)
Result = DAG.getNode(ISD::AND, DL, VT, Result,
DAG.getConstant(-(uint64_t)Align, DL, VT));
DAG.getSignedConstant(-(uint64_t)Align, DL, VT));
Chain = DAG.getCopyToReg(Chain, DL, SPReg, Result); // Output chain
}

Expand All @@ -3442,7 +3442,7 @@ SDValue M68kTargetLowering::LowerShiftLeftParts(SDValue Op,

SDValue Zero = DAG.getConstant(0, DL, VT);
SDValue One = DAG.getConstant(1, DL, VT);
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 Expand Up @@ -3494,7 +3494,7 @@ SDValue M68kTargetLowering::LowerShiftRightParts(SDValue Op, SelectionDAG &DAG,

SDValue Zero = DAG.getConstant(0, DL, VT);
SDValue One = DAG.getConstant(1, DL, VT);
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 3699931

Please sign in to comment.