-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[RISCV][GlobalIsel] Reduce constant pool usage without FP extension #158346
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
5b538f8
80f8c3b
81c6378
7c868d7
a4eca16
a56f79a
cc73b5e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -572,7 +572,9 @@ RISCVLegalizerInfo::RISCVLegalizerInfo(const RISCVSubtarget &ST) | |
.legalFor(ST.hasStdExtF(), {s32}) | ||
.legalFor(ST.hasStdExtD(), {s64}) | ||
.legalFor(ST.hasStdExtZfh(), {s16}) | ||
.lowerFor({s32, s64, s128}); | ||
.customFor(!ST.is64Bit(), {s32}) | ||
.customFor(ST.is64Bit(), {s32, s64}) | ||
.lowerFor({s64, s128}); | ||
|
||
getActionDefinitionsBuilder({G_FPTOSI, G_FPTOUI}) | ||
.legalFor(ST.hasStdExtF(), {{sXLen, s32}}) | ||
|
@@ -869,6 +871,12 @@ bool RISCVLegalizerInfo::shouldBeInConstantPool(const APInt &APImm, | |
return !(!SeqLo.empty() && (SeqLo.size() + 2) <= STI.getMaxBuildIntsCost()); | ||
} | ||
|
||
bool RISCVLegalizerInfo::shouldBeInFConstantPool(const APFloat &APImm) const { | ||
if (APImm.isZero() || APImm.isExactlyValue(1.0)) | ||
return false; | ||
return true; | ||
} | ||
|
||
bool RISCVLegalizerInfo::legalizeVScale(MachineInstr &MI, | ||
MachineIRBuilder &MIB) const { | ||
const LLT XLenTy(STI.getXLenVT()); | ||
|
@@ -1358,7 +1366,12 @@ bool RISCVLegalizerInfo::legalizeCustom( | |
return false; | ||
case TargetOpcode::G_ABS: | ||
return Helper.lowerAbsToMaxNeg(MI); | ||
// TODO: G_FCONSTANT | ||
case TargetOpcode::G_FCONSTANT: { | ||
const ConstantFP *ConstVal = MI.getOperand(1).getFPImm(); | ||
if (!shouldBeInFConstantPool(ConstVal->getValue())) | ||
|
||
return true; | ||
return Helper.lowerFConstant(MI); | ||
} | ||
case TargetOpcode::G_CONSTANT: { | ||
const Function &F = MF.getFunction(); | ||
// TODO: if PSI and BFI are present, add " || | ||
|
Uh oh!
There was an error while loading. Please reload this page.