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

hfinkel at anl.gov hfinkel at anl.gov
Fri Sep 26 09:39:41 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;
----------------
spatel wrote:
> 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.
Regarding PPC, you might be right about some of them -- it is certainly a win on the embedded cores where the sqrt instruction is not fully pipelined. We'll need to do some measurements.

http://reviews.llvm.org/D5484






More information about the llvm-commits mailing list