Apply transformation on OS X 10.9+ and iOS 7.0+: pow(10, x) ―> __exp10(x)

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@196544 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Yi Jiang
2013-12-05 22:42:50 +00:00
parent 7d3a11fd9f
commit ab906d0048
3 changed files with 55 additions and 0 deletions

View File

@ -1162,6 +1162,12 @@ struct PowOpt : public UnsafeFPLibCallOptimization {
hasUnaryFloatFn(TLI, Op1->getType(), LibFunc::exp2, LibFunc::exp2f,
LibFunc::exp2l))
return EmitUnaryFloatFnCall(Op2, "exp2", B, Callee->getAttributes());
// pow(10.0, x) -> exp10(x)
if (Op1C->isExactlyValue(10.0) &&
hasUnaryFloatFn(TLI, Op1->getType(), LibFunc::exp10, LibFunc::exp10f,
LibFunc::exp10l))
return EmitUnaryFloatFnCall(Op2, TLI->getName(LibFunc::exp10), B,
Callee->getAttributes());
}
ConstantFP *Op2C = dyn_cast<ConstantFP>(Op2);