return IsConstantOffsetFromGlobal(CE->getOperand(0), GV, Offset, DL);
// i32* getelementptr ([5 x i32]* @a, i32 0, i32 5)
return IsConstantOffsetFromGlobal(CE->getOperand(0), GV, Offset, DL);
// i32* getelementptr ([5 x i32]* @a, i32 0, i32 5)
// return true for a name like "cos\0blah" which strcmp would return equal to
// "cos", but has length 8.
switch (Name[0]) {
// return true for a name like "cos\0blah" which strcmp would return equal to
// "cos", but has length 8.
switch (Name[0]) {
- return Name == "acos" || Name == "asin" || Name == "atan" || Name =="atan2";
+ return Name == "acos" || Name == "asin" || Name == "atan" ||
+ Name == "atan2" || Name == "acosf" || Name == "asinf" ||
+ Name == "atanf" || Name == "atan2f";
// 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);
// 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);
return ConstantFoldFP(log10, V, Ty);
else if (IntrinsicID == Intrinsic::sqrt &&
(Ty->isHalfTy() || Ty->isFloatTy() || Ty->isDoubleTy())) {
return ConstantFoldFP(log10, V, Ty);
else if (IntrinsicID == Intrinsic::sqrt &&
(Ty->isHalfTy() || Ty->isFloatTy() || Ty->isDoubleTy())) {
- else if (Name == "sqrt" && V >= 0 && TLI->has(LibFunc::sqrt))
- return ConstantFoldFP(sqrt, V, Ty);
- else if (Name == "sqrtf" && V >= 0 && TLI->has(LibFunc::sqrtf))
+ else if ((Name == "sqrt" && V >= 0 && TLI->has(LibFunc::sqrt)) ||
+ (Name == "sqrtf" && V >= 0 && TLI->has(LibFunc::sqrtf)))
return ConstantFoldBinaryFP(pow, Op1V, Op2V, Ty);
return ConstantFoldBinaryFP(pow, Op1V, Op2V, Ty);
return ConstantFoldBinaryFP(fmod, Op1V, Op2V, Ty);
return ConstantFoldBinaryFP(fmod, Op1V, Op2V, Ty);
return ConstantFoldBinaryFP(atan2, Op1V, Op2V, Ty);
} else if (ConstantInt *Op2C = dyn_cast<ConstantInt>(Operands[1])) {
if (IntrinsicID == Intrinsic::powi && Ty->isHalfTy())
return ConstantFoldBinaryFP(atan2, Op1V, Op2V, Ty);
} else if (ConstantInt *Op2C = dyn_cast<ConstantInt>(Operands[1])) {
if (IntrinsicID == Intrinsic::powi && Ty->isHalfTy())