[PATCH] D51435: [SLC] Support expanding pow(x, n+0.5) to x * x * ... * sqrt(x)

Florian Hahn via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Thu Aug 30 01:59:21 PDT 2018


fhahn added inline comments.


================
Comment at: lib/Transforms/Utils/SimplifyLibCalls.cpp:1400
   if (Pow->isFast() && match(Expo, m_APFloat(ExpoF))) {
     // We limit to a max of 7 multiplications, thus the maximum exponent is 32.
     APFloat LimF(ExpoF->getSemantics(), 33.0),
----------------
spatel wrote:
> There was no real justification for this limit in D13994, but I suppose we're still ok with the transform +1 more instruction?
IIUC the main reason for adding this limit was to avoid generating too long fmul chains. I think adding a call to sqrt() is independent of that (similar to adding a call to fdiv for negative exponents), but I can either update the comment or only generate sqrt() for smaller exponents.


https://reviews.llvm.org/D51435





More information about the llvm-commits mailing list