improve portability to systems that don't have powf/modf (e.g. solaris 9)

patch by Evzen Muller!

llvm-svn: 103876
This commit is contained in:
Chris Lattner 2010-05-15 17:10:24 +00:00
parent b0efad148c
commit 93cd0f1c89
4 changed files with 5 additions and 5 deletions

View File

@ -1634,7 +1634,7 @@ LiveIntervals::getSpillWeight(bool isDef, bool isUse, unsigned loopDepth) {
// overflow a float. This expression behaves like 10^d for small d, but is
// more tempered for large d. At d=200 we get 6.7e33 which leaves a bit of
// headroom before overflow.
float lc = powf(1 + (100.0f / (loopDepth+10)), (float)loopDepth);
float lc = std::pow(1 + (100.0f / (loopDepth+10)), (float)loopDepth);
return (isDef + isUse) * lc;
}

View File

@ -809,7 +809,7 @@ float getConflictWeight(LiveInterval *cur, unsigned Reg, LiveIntervals *li_,
MachineInstr *MI = &*I;
if (cur->liveAt(li_->getInstructionIndex(MI))) {
unsigned loopDepth = loopInfo->getLoopDepth(MI->getParent());
Conflicts += powf(10.0f, (float)loopDepth);
Conflicts += std::pow(10.0f, (float)loopDepth);
}
}
return Conflicts;

View File

@ -489,7 +489,7 @@ PBQPRegAlloc::CoalesceMap PBQPRegAlloc::findCoalesces() {
// did, but none of their definitions would prevent us from coalescing.
// We're good to go with the coalesce.
float cBenefit = powf(10.0f, loopInfo->getLoopDepth(mbb)) / 5.0;
float cBenefit = std::pow(10.0f, (float)loopInfo->getLoopDepth(mbb)) / 5.0;
coalescesFound[RegPair(srcReg, dstReg)] = cBenefit;
coalescesFound[RegPair(dstReg, srcReg)] = cBenefit;

View File

@ -715,7 +715,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
case Instruction::FDiv:
GV.FloatVal = LHS.FloatVal / RHS.FloatVal; break;
case Instruction::FRem:
GV.FloatVal = ::fmodf(LHS.FloatVal,RHS.FloatVal); break;
GV.FloatVal = std::fmod(LHS.FloatVal,RHS.FloatVal); break;
}
break;
case Type::DoubleTyID:
@ -730,7 +730,7 @@ GenericValue ExecutionEngine::getConstantValue(const Constant *C) {
case Instruction::FDiv:
GV.DoubleVal = LHS.DoubleVal / RHS.DoubleVal; break;
case Instruction::FRem:
GV.DoubleVal = ::fmod(LHS.DoubleVal,RHS.DoubleVal); break;
GV.DoubleVal = std::fmod(LHS.DoubleVal,RHS.DoubleVal); break;
}
break;
case Type::X86_FP80TyID: