[PATCH] D13994: [SimplifyLibCalls] Optimization for pow(x, n) where n is some constant
Mandeep Singh Grang via llvm-commits
llvm-commits at lists.llvm.org
Wed Nov 4 16:29:05 PST 2015
mgrang added inline comments.
================
Comment at: lib/Transforms/Utils/SimplifyLibCalls.cpp:1156
@@ +1155,3 @@
+ for (unsigned Exp = 2; Exp <= 32; ++Exp) {
+ if (Op2C->isExactlyValue(Exp) || Op2C->isExactlyValue((int)-Exp)) {
+ Value *FMul = getPow(Op1, Exp, B);
----------------
scanon wrote:
> Can we really not find a more elegant way to handle this than by checking for equality to every integer in range? How was 32 chosen? It would make more sense to bound the number of multiplies in the resulting lowering than bounding the magnitude of the exponent. I would also expect this to not be symmetric, because division is expensive.
Thanks for the review Steve. I am working on fixing this.
GCC generates fmul for all exponent values under fast-math. But I don't know if it would really be efficient since the no. of fmuls increases with the exponent.
Repository:
rL LLVM
http://reviews.llvm.org/D13994
More information about the llvm-commits
mailing list