[llvm] Constant Fold Logf128 calls (PR #84501)

Joshua Cranmer via llvm-commits llvm-commits at lists.llvm.org
Wed Mar 27 13:06:37 PDT 2024


jcranmer-intel wrote:

> The primary reason we haven't continued to expand float constant-folding is that we don't really want to use the host's libm for target calculations. Ideally, we want the compiler to be portable: we want to consistently produce the same results. So we want to use our own library routines.
> 
> We have ConstantFoldFP which already uses the host libc, but we don't really want to expand that usage. gcc uses MFPR, but LLVM can't due to licensing issues. Maybe we can borrow code from llvm-libc?

I whole-heartedly agree with this sentiment. llvm-libc is working on getting correctly-rounded versions of all the math functions, but the only one implemented for all the float sizes is `sqrt`, and otherwise they're largely implemented only for `float` at the moment.

When we talked at the last LLVM FP working group meeting, llvm-libc people were receptive to the idea of reusing code for APFloat, although I would probably want to wait to see how things work out for reusing libc code in libc++ first.

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


More information about the llvm-commits mailing list