[llvm] [RISCV][GlobalIsel] Reduce constant pool usage without FP extension (PR #158346)
Shaoce SUN via llvm-commits
llvm-commits at lists.llvm.org
Fri Sep 12 23:17:34 PDT 2025
================
@@ -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()))
----------------
sunshaoce wrote:
I haven’t figured out how to directly turn `G_FCONSTANT` into a `G_CONSTANT`, so instead I converted `ConstVal->getValue()` with `bitcastToAPInt()`.
https://github.com/llvm/llvm-project/pull/158346
More information about the llvm-commits
mailing list