[PATCH] D26602: [DAGCombiner] do not fold (fmul (fadd X, 1), Y) -> (fmad X, Y, Y) by default

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Dec 1 08:28:28 PST 2016


spatel accepted this revision.
spatel added subscribers: delena, craig.topper.
spatel added a comment.
This revision is now accepted and ready to land.

In https://reviews.llvm.org/D26602#610545, @nhaehnle wrote:

> Rearrange the logic. It looks quite readable to me this way, and
>  clang-format-diff agrees with the formatting.
>
> Thinking about the FMA case again, isn't it actually obvious? At least today
>  I'm quite convinced by the following argument:
>
> > The mathematically exact result of `x * (y + 1)` is equal to that of `x * y +
> >  x`. FMA produces the best rounding of this mathematically exact result. So
> >  whatever happens to the rounding in (fmul x (fadd y 1.0)), the FMA variant
> >  can only be more accurate.


That sounds good to me. Is that quoted from a different thread?

As a follow-up patch, we'll want to add RUN lines to the x86 test files to add coverage back for the hoped-for FMA codegen (cc'ing @craig.topper and @delena because I think they may have added those tests).

LGTM.


https://reviews.llvm.org/D26602





More information about the llvm-commits mailing list