minor long double related changes

llvm-svn: 42439
This commit is contained in:
Dale Johannesen 2007-09-28 18:06:58 +00:00
parent cf40e00d32
commit a30678c8f0
6 changed files with 192 additions and 172 deletions

View File

@ -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");

View File

@ -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() &&

View File

@ -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,

File diff suppressed because it is too large Load Diff

View File

@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// This file implements the flex scanner for LLVM 1.9 assembly languages files.
// This doesn't handle long double constants, since LLVM 1.9 did not have them.
//
//===----------------------------------------------------------------------===*/

View File

@ -8,6 +8,7 @@
//===----------------------------------------------------------------------===//
//
// This file implements the flex scanner for LLVM 1.9 assembly languages files.
// This doesn't handle long double constants, since LLVM 1.9 did not have them.
//
//===----------------------------------------------------------------------===*/