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

Sanjay Patel via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Aug 29 15:01:44 PDT 2018


spatel 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),
----------------
There was no real justification for this limit in D13994, but I suppose we're still ok with the transform +1 more instruction?


================
Comment at: lib/Transforms/Utils/SimplifyLibCalls.cpp:1409
+        APFloat Expo2 = ExpoA;
+        if (Expo2.add(ExpoA, APFloat::rmNearestTiesToEven) != APFloat::opOK)
+          return nullptr;
----------------
I didn't catch the doubling of "?.5" followed by an isInteger check when I saw this the first time, so it deserves a code comment.


https://reviews.llvm.org/D51435





More information about the llvm-commits mailing list