[PATCH] D63038: [SimplifyLibCalls] powf(x, sitofp(n)) -> powi(x, n)

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Jun 10 12:44:37 PDT 2019


efriedma added a comment.

We definitely need `afn` for this; powi performs multiple intermediate rounding steps, so it can be significantly less accurate than pow.

Beyond that, we might need `nsz` in some cases?  Probably worth writing a bunch of tests for zero/inf/nan base with zero/positive/negative exponents to figure out exactly which cases are different.



================
Comment at: lib/Transforms/Utils/SimplifyLibCalls.cpp:1454
+    return createPowWithIntegerExponent(
+        Base, cast<Instruction>(Expo)->getOperand(0), M, B);
+
----------------
I think you're missing some checks here.


================
Comment at: lib/Transforms/Utils/SimplifyLibCalls.cpp:1534
+
+    APSInt IntExpo(32, false);
+    // powf(x, C) -> powi(x, C) iff C is a constant integer value
----------------
powi takes a signed exponent.


CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D63038/new/

https://reviews.llvm.org/D63038





More information about the llvm-commits mailing list