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

LuoYuanke via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sat Sep 18 16:14:39 PDT 2021


LuoYuanke added a comment.

In D109953#3008056 <https://reviews.llvm.org/D109953#3008056>, @craig.topper wrote:

> 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.

Got it. Thanks a lot. :)


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