diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/CodeGen/AsmPrinter.cpp | 1 | ||||
-rw-r--r-- | lib/CodeGen/IntrinsicLowering.cpp | 18 | ||||
-rw-r--r-- | lib/Transforms/IPO/SimplifyLibCalls.cpp | 6 |
3 files changed, 21 insertions, 4 deletions
diff --git a/lib/CodeGen/AsmPrinter.cpp b/lib/CodeGen/AsmPrinter.cpp index 88d21af054..488185d9bb 100644 --- a/lib/CodeGen/AsmPrinter.cpp +++ b/lib/CodeGen/AsmPrinter.cpp @@ -1271,6 +1271,7 @@ void AsmPrinter::printDataDirective(const Type *type) { } break; case Type::FloatTyID: case Type::DoubleTyID: + case Type::X86_FP80TyID: case Type::FP128TyID: case Type::PPC_FP128TyID: assert (0 && "Should have already output floating point constant."); default: assert (0 && "Can't handle printing this type of thing"); diff --git a/lib/CodeGen/IntrinsicLowering.cpp b/lib/CodeGen/IntrinsicLowering.cpp index 42b09c2d3a..0a2f0d6a51 100644 --- a/lib/CodeGen/IntrinsicLowering.cpp +++ b/lib/CodeGen/IntrinsicLowering.cpp @@ -794,6 +794,24 @@ void IntrinsicLowering::LowerIntrinsicCall(CallInst *CI) { Type::DoubleTy, sqrtFCache); break; } + case Intrinsic::sqrt_f80: { + static Constant *sqrtF80Cache = 0; + ReplaceCallWith("sqrtl", CI, CI->op_begin()+1, CI->op_end(), + Type::X86_FP80Ty, sqrtF80Cache); + break; + } + case Intrinsic::sqrt_f128: { + static Constant *sqrtF128Cache = 0; + ReplaceCallWith("sqrtl", CI, CI->op_begin()+1, CI->op_end(), + Type::FP128Ty, sqrtF128Cache); + break; + } + case Intrinsic::sqrt_ppcf128: { + static Constant *sqrtppcF128Cache = 0; + ReplaceCallWith("sqrtl", CI, CI->op_begin()+1, CI->op_end(), + Type::PPC_FP128Ty, sqrtppcF128Cache); + break; + } } assert(CI->use_empty() && diff --git a/lib/Transforms/IPO/SimplifyLibCalls.cpp b/lib/Transforms/IPO/SimplifyLibCalls.cpp index 01d3c9ff2e..717a5a847f 100644 --- a/lib/Transforms/IPO/SimplifyLibCalls.cpp +++ b/lib/Transforms/IPO/SimplifyLibCalls.cpp @@ -1115,17 +1115,15 @@ public: /// @brief Perform the pow optimization. virtual bool OptimizeCall(CallInst *ci, SimplifyLibCalls &SLC) { const Type *Ty = cast<Function>(ci->getOperand(0))->getReturnType(); + if (Ty!=Type::FloatTy && Ty!=Type::DoubleTy) + return false; // FIXME long double not yet supported Value* base = ci->getOperand(1); Value* expn = ci->getOperand(2); if (ConstantFP *Op1 = dyn_cast<ConstantFP>(base)) { - if (Ty!=Type::FloatTy && Ty!=Type::DoubleTy) - return false; // FIXME long double not yet supported if (Op1->isExactlyValue(1.0)) // pow(1.0,x) -> 1.0 return ReplaceCallWith(ci, ConstantFP::get(Ty, Ty==Type::FloatTy ? APFloat(1.0f) : APFloat(1.0))); } else if (ConstantFP* Op2 = dyn_cast<ConstantFP>(expn)) { - if (Ty!=Type::FloatTy && Ty!=Type::DoubleTy) - return false; // FIXME long double not yet supported if (Op2->getValueAPF().isZero()) { // pow(x,0.0) -> 1.0 return ReplaceCallWith(ci, ConstantFP::get(Ty, |