[PATCH] D26518: [AArch64] Compute the Newton series for reciprocals natively
Evandro Menezes via llvm-commits
llvm-commits at lists.llvm.org
Fri Nov 11 08:37:29 PST 2016
evandro added inline comments.
================
Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:4681
+ // Correct the result if the operand is 0.0.
+ Estimate = DAG.getNode(VT.isVector() ? ISD::VSELECT : ISD::SELECT, DL,
+ VT, Eq, Operand, Estimate);
----------------
jmolloy wrote:
> Why do you need this? Is this to preserve sign-of-zero?
>
> You don't need this if the original operation was marked nsz or fast.
I'm not sure what you're pointing out here, so allow me to be verbose.
When taking `sqrt(0.0)`, the instruction sequence above ends up with a `NaN`. Therefore, `0.0` is a special case when the result is hamfisted for correctness.
Instead of materializing `0.0`, which requires extra instructions, since the argument is known to be `0.0`, I chose to use it instead. Yes, as a result its sign is preserved, but this is not the reason why I consider this to be a more sensible choice.
Repository:
rL LLVM
https://reviews.llvm.org/D26518
More information about the llvm-commits
mailing list