Skip to content

Commit 2218587

Browse files
authored
MIPS: Support isLegalICmpImmediate and isLegalAddImmediate (#133400)
Set it to true only if isInt<16>. By default implemention defines them to true always. For most cases, MIPS uses 16bit IMM, and for microMIPS, ICMP and ADDiu have 16bit IMM flavors.
1 parent 460d628 commit 2218587

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

llvm/lib/Target/Mips/MipsISelLowering.cpp

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4474,6 +4474,14 @@ bool MipsTargetLowering::isFPImmLegal(const APFloat &Imm, EVT VT,
44744474
return Imm.isZero();
44754475
}
44764476

4477+
bool MipsTargetLowering::isLegalICmpImmediate(int64_t Imm) const {
4478+
return isInt<16>(Imm);
4479+
}
4480+
4481+
bool MipsTargetLowering::isLegalAddImmediate(int64_t Imm) const {
4482+
return isInt<16>(Imm);
4483+
}
4484+
44774485
unsigned MipsTargetLowering::getJumpTableEncoding() const {
44784486
if (!isPositionIndependent())
44794487
return MachineJumpTableInfo::EK_BlockAddress;

llvm/lib/Target/Mips/MipsISelLowering.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -706,6 +706,9 @@ class TargetRegisterClass;
706706
bool isFPImmLegal(const APFloat &Imm, EVT VT,
707707
bool ForCodeSize) const override;
708708

709+
bool isLegalICmpImmediate(int64_t Imm) const override;
710+
bool isLegalAddImmediate(int64_t Imm) const override;
711+
709712
unsigned getJumpTableEncoding() const override;
710713
SDValue getPICJumpTableRelocBase(SDValue Table,
711714
SelectionDAG &DAG) const override;

0 commit comments

Comments
 (0)