[llvm] [RISCV] Use FLI + FNEG to materialize some negative FP constants (PR #70825)

Alex Bradbury via llvm-commits llvm-commits at lists.llvm.org
Wed Nov 1 07:51:00 PDT 2023


asb wrote:

> > that exploits knowledge about the table only having one negative constant and so avoids calling itself again.
> 
> I'm not sure if I understand you correctly, but right now we only recursively call `getLegalZfaFPImm` with negated FPImm if FPImm is negative. So I believe we've avoided most of the redundant recursive calls.

My thought was just that it _might_ read cleaner to handle the negative input case up-front and avoid the self-invocation. i.e. if the input is negative but isn't -1, then set then negate the APFloat and set NeedsFNeg before proceeding to look up into the table. But tastes vary.

https://github.com/llvm/llvm-project/pull/70825


More information about the llvm-commits mailing list