Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 1 addition & 14 deletions llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -871,17 +871,6 @@ bool RISCVLegalizerInfo::shouldBeInConstantPool(const APInt &APImm,
return !(!SeqLo.empty() && (SeqLo.size() + 2) <= STI.getMaxBuildIntsCost());
}

bool RISCVLegalizerInfo::shouldBeInFConstantPool(const APFloat &APF) const {
[[maybe_unused]] unsigned Size = APF.getSizeInBits(APF.getSemantics());
assert((Size == 32 || Size == 64) && "Only support f32 and f64");

int64_t Imm = APF.bitcastToAPInt().getSExtValue();
RISCVMatInt::InstSeq Seq = RISCVMatInt::generateInstSeq(Imm, STI);
if (Seq.size() <= STI.getMaxBuildIntsCost())
return false;
return true;
}

bool RISCVLegalizerInfo::legalizeVScale(MachineInstr &MI,
MachineIRBuilder &MIB) const {
const LLT XLenTy(STI.getXLenVT());
Expand Down Expand Up @@ -1372,9 +1361,7 @@ bool RISCVLegalizerInfo::legalizeCustom(
case TargetOpcode::G_ABS:
return Helper.lowerAbsToMaxNeg(MI);
case TargetOpcode::G_FCONSTANT: {
const APFloat FVal = MI.getOperand(1).getFPImm()->getValueAPF();
if (shouldBeInFConstantPool(FVal))
return Helper.lowerFConstant(MI);
const APFloat &FVal = MI.getOperand(1).getFPImm()->getValueAPF();

// Convert G_FCONSTANT to G_CONSTANT.
Register DstReg = MI.getOperand(0).getReg();
Expand Down
1 change: 0 additions & 1 deletion llvm/lib/Target/RISCV/GISel/RISCVLegalizerInfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,6 @@ class RISCVLegalizerInfo : public LegalizerInfo {

private:
bool shouldBeInConstantPool(const APInt &APImm, bool ShouldOptForSize) const;
bool shouldBeInFConstantPool(const APFloat &APImm) const;
bool legalizeShlAshrLshr(MachineInstr &MI, MachineIRBuilder &MIRBuilder,
GISelChangeObserver &Observer) const;

Expand Down