[PATCH] D22975: [AArch64] Compute the Newton series iterations natively

Tim Northover via llvm-commits llvm-commits at lists.llvm.org
Tue Aug 2 14:09:32 PDT 2016


t.p.northover added inline comments.

================
Comment at: llvm/lib/CodeGen/SelectionDAG/DAGCombiner.cpp:14500
@@ -14499,2 +14499,3 @@
 
-SDValue DAGCombiner::BuildReciprocalEstimate(SDValue Op, SDNodeFlags *Flags) {
+/// Newton iteration for a function: F(X) is X_{i+1} = X_i - F(X_i)/F'(X_i)
+/// For the reciprocal, we need to find the zero of the function:
----------------
All of the changes in this file appear to be refactoring, is that right?

Mostly they look OK (though should be committed separately). But I'm not convinced moving the  sqrt(0) handling into BuildReciprocalEstimate is an improvement.

================
Comment at: llvm/lib/Target/AArch64/AArch64ISelLowering.cpp:4598
@@ +4597,3 @@
+    // AArch64 reciprocal iteration instruction: (2 - M * N)
+    while (ExtraSteps > 0) {
+      SDValue Step = DCI.DAG.getNode(AArch64ISD::FRECPS, DL, VT, Arg, Est,
----------------
A for loop would probably be better. People expect while loops to do crazy things.


Repository:
  rL LLVM

https://reviews.llvm.org/D22975





More information about the llvm-commits mailing list