[PATCH] Refactor reciprocal and reciprocal square root estimate into target-independent functions (part 2).

Sanjay Patel spatel at rotateright.com
Fri Sep 26 09:02:47 PDT 2014


================
Comment at: include/llvm/Target/TargetLowering.h:2632
@@ +2631,3 @@
+  /// returned by one of the above methods.
+  virtual unsigned getNRSteps(EVT VT) const {
+    return 0;
----------------
hfinkel wrote:
> The number of iterations necessary for the reciprocal estimate and for the reciprocal sqrt estimate might be different. Please provide a way to differentiate (and I'd want to make really sure the target actually overrides this). Maybe:
> 
>   virtual unsigned getNRSteps(EVT VT, bool SqrtEst) const {
>     llvm_unreachable("Target must provide the number of iterations");
>   }
> 
Sure - I'll make unique functions to return iteration counts for sqrte and rcpe. 

We may need one more refinement here regarding the rcpe(rsqrt(x)) transformation of a regular sqrt(x)...my guess is that's not a win on any recent X86 (and probably not PPC either?). But that change can come later if needed.

http://reviews.llvm.org/D5484






More information about the llvm-commits mailing list