mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-06-13 04:38:24 +00:00
implement PR9315, constant folding exp2 in terms of pow (since hosts without
C99 runtimes don't have exp2). git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@131872 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@ -1085,7 +1085,7 @@ llvm::canConstantFoldCallTo(const Function *F) {
|
||||
case 'c':
|
||||
return Name == "cos" || Name == "ceil" || Name == "cosf" || Name == "cosh";
|
||||
case 'e':
|
||||
return Name == "exp";
|
||||
return Name == "exp" || Name == "exp2";
|
||||
case 'f':
|
||||
return Name == "fabs" || Name == "fmod" || Name == "floor";
|
||||
case 'l':
|
||||
@ -1221,6 +1221,12 @@ llvm::ConstantFoldCall(Function *F,
|
||||
case 'e':
|
||||
if (Name == "exp")
|
||||
return ConstantFoldFP(exp, V, Ty);
|
||||
|
||||
if (Name == "exp2") {
|
||||
// Constant fold exp2(x) as pow(2,x) in case the host doesn't have a
|
||||
// C99 library.
|
||||
return ConstantFoldBinaryFP(pow, 2.0, V, Ty);
|
||||
}
|
||||
break;
|
||||
case 'f':
|
||||
if (Name == "fabs")
|
||||
|
Reference in New Issue
Block a user