[llvm] [RISCV] Teach RISCVTargetLowering::isFPImmLegal about fli+fneg (PR #149075)
Craig Topper via llvm-commits
llvm-commits at lists.llvm.org
Wed Jul 16 11:02:42 PDT 2025
topperc wrote:
> Thanks for the reference. How would you define "legal" constants for isFPImmLegal because by my reading of the function, it's currently counting anything that can be handled with two instructions (e.g. -0.0 via fmv x0 then fneg, and FP values with bit patterns that can be loaded with a single int instruction then fmv).
I thought "legal" was anything that was handled by the code in `case ISD::ConstantFP` in RISCVISelDAGToDAG.cpp. Which would be anything that is "legal" to reach isel.
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".
https://github.com/llvm/llvm-project/pull/149075
More information about the llvm-commits
mailing list