[PATCH] D24011: [ConstantFold] Add a flag for ppc_fp128 constant folding, since APFloat doesn't support double-double semantic

Hal Finkel via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 30 16:05:08 PDT 2016

hfinkel added a comment.

In https://reviews.llvm.org/D24011#529603, @timshen wrote:

> In https://reviews.llvm.org/D24011#529529, @hubert.reinterpretcast wrote:
> > In https://reviews.llvm.org/D24011#529508, @timshen wrote:
> >
> > > If there seems to be few applications are depending on this optimization, I wonder if we can turn off the constant folding for now, and fix APFloat later if someone really cares about it?
> >
> >
> > Just wanted to note that the front-end would still encounter the issue with APFloat, and I would be concerned if the (front-end) constant expression evaluation for ppc_fp128 is disabled entirely.
> Good note. No, we don't touch the front-end currently. :)

Yes, but Hubert is right. To fully make this change, you'll need to disable constexpr evaluation of long doubles in Clang also (which I suspect might make it non-conforming).

In the end, I don't think that going for the easy fix here is all that useful. We'll need to invest the time to making an APFloat-based double-double implementation and use that for constant folding.

If the implementations in compiler-rt/lib/builtins/ppc/gcc_q*.c are good, then we could base the implementation, algorithmically, on those.


More information about the llvm-commits mailing list