[PATCH] D26518: [AArch64] Compute the Newton series for reciprocals natively

James Molloy via llvm-commits llvm-commits at lists.llvm.org
Fri Nov 11 09:01:41 PST 2016


jmolloy accepted this revision.
jmolloy added a comment.
This revision is now accepted and ready to land.

All concerns addressed from my side.



================
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);
----------------
evandro wrote:
> 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.
Ah, I understand now, thanks!


Repository:
  rL LLVM

https://reviews.llvm.org/D26518





More information about the llvm-commits mailing list