[llvm] [RISCV] Teach RISCVTargetLowering::isFPImmLegal about fli+fneg (PR #149075)
Alex Bradbury via llvm-commits
llvm-commits at lists.llvm.org
Mon Jul 21 05:43:11 PDT 2025
asb wrote:
> But looking closer, LegalizeDAG.cpp only checks `isLegalFPImm` in `ExpandNode` which would be after LowerConstantFP gets called. So maybe we can say things in LowerConstantFP are "legal".
Looking at how it's used from DAGCombiner that had been my expectation. Support for selecting the FP value "natively" is a bit debatable on RISC-V, but I think "will be generated cheaply using a small number of instructions rather than loaded from the constant pool" is reasonable, and seems consistent with how that function is implemented today (other than missing the fli+fneg case).
As noted in the commit message, this has almost no impact on llvm-test-suite. But I'd still like to land it for completeness and consistency (and of course the chance of unexpected negative impact seems negligible). What do you think?
https://github.com/llvm/llvm-project/pull/149075
More information about the llvm-commits
mailing list