[PATCH] Refactor and enhance FMA combine
Mehdi Amini
mehdi.amini at apple.com
Thu Apr 2 12:48:05 PDT 2015
Hi Olivier,
Tentatively CC: Steve who might have an input on the validity of the two transforms below without fast-math.
> On Apr 2, 2015, at 12:41 PM, Olivier Sallenave <ohsallen at us.ibm.com> wrote:
>
> Hi Mehdi,
>
>> I’d rather see the duplicated code (the one made obsolete by a correct canonicalization) removed from your patch (i.e. do not build technical debt), and a separate commits that implement the canonicalization part.
>
>
> Makes perfect sense, thanks for your feedback. I was able to do the canonicalization you suggest by adding the following transforms:
>
> (fsub (fneg A), B) -> (fneg (fadd A, B))
> (fpext (fneg x)) -> (fneg (fpext x))
>
> The problem is that I think those should be enabled only with -enable-unsafe-fp-math. So the two FMA combines that can be removed because of the canonicalization now only happen with -enable-unsafe-fp-math, whereas they used to work with -fp-contract=fast as well... Not sure what to do here.
I overlook the fact that we have these pesky fine grain flags :(
Now for these two particular transformations, they sound OK to me even without fast-math, but I rather have a numeric expert confirming because of all the possible edge cases.
Best,
Mehdi
.
More information about the llvm-commits
mailing list