[PATCH] D109953: [X86][FP16] Combine the FADD(A, FMA(B, C, 0)) to FMA(B, C, A)

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 18 14:50:39 PDT 2021


craig.topper added a comment.

There are special rules for adding or subtracting signed zero:

- x + (+0) = x (for x different than 0)
- x + (-0) = x (for x different than 0)
- (-0) + (-0) = (-0) - (+0) = -0
- (+0) + (+0) = (+0) - (-0) = +0
- x - x = x + (-x) = +0 for any finite x unless rounding towards negative infininity then the result is -0 instead

If A * B is -0, then FMA(A, B, +0) would be (-0 + +0) or (-0 - (-0)) which should produce +0 by the last rule above with x = -0. This is different than FMUL(A,B) which we said was -0.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D109953/new/

https://reviews.llvm.org/D109953



More information about the llvm-commits mailing list