[PATCH] D29375: [TLI] Rework interface for approximate (r)sqrt and reciprocal.
Justin Lebar via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 31 22:21:12 PST 2017
jlebar created this revision.
Herald added subscribers: igorb, nhaehnle, nemanjai, arsenm, jholewinski.
Herald added a reviewer: tstellarAMD.
Previously this had a major limitation: The interface expected the
return value of getSqrtEstimate to be a reciprocal sqrt (even if
Not only was this confusing, but it meant that platforms like NVPTX that
have an approximate sqrt had no way to use hook it in.
This patch reworks the API to separate out three questions which
previously were all squished into getSqrtEstimate:
- Should we do an estimate at all?
- If so, how many iterations of Newton's method should we perform to refine our estimate?
- What's our first approximation of the rsqrt?
Now we have one function which answers the first two questions, and a
separate function which answers the third.
We also now have a separate function which we call in the special case
when we're doing zero iterations of Newton's method and calculating a
plain sqrt, and NVPTX hooks into this.
We made the same changes to the reciprocal estimate functions.
In addition, we reworked the parsing of the reciprocal-estimates
metadata flag, which needed some love, and otherwise wasn't compatible
with this new scheme.
-------------- next part --------------
A non-text attachment was scrubbed...
Size: 52113 bytes
Desc: not available
More information about the llvm-commits