Simplify code. No functionality change.

llvm-svn: 120907
This commit is contained in:
Benjamin Kramer 2010-12-04 14:22:24 +00:00
parent 594827281c
commit 8ceebfaa04
2 changed files with 12 additions and 10 deletions

View File

@ -521,13 +521,12 @@ X86TargetLowering::X86TargetLowering(X86TargetMachine &TM)
setOperationAction(ISD::UNDEF, MVT::f80, Expand);
setOperationAction(ISD::FCOPYSIGN, MVT::f80, Expand);
{
bool ignored;
APFloat TmpFlt(+0.0);
TmpFlt.convert(APFloat::x87DoubleExtended, APFloat::rmNearestTiesToEven,
&ignored);
APFloat TmpFlt = APFloat::getZero(APFloat::x87DoubleExtended);
addLegalFPImmediate(TmpFlt); // FLD0
TmpFlt.changeSign();
addLegalFPImmediate(TmpFlt); // FLD0/FCHS
bool ignored;
APFloat TmpFlt2(+1.0);
TmpFlt2.convert(APFloat::x87DoubleExtended, APFloat::rmNearestTiesToEven,
&ignored);

View File

@ -40,22 +40,25 @@ using namespace llvm;
//===----------------------------------------------------------------------===//
// Constructor to create a '0' constant of arbitrary type...
static const uint64_t zero[2] = {0, 0};
Constant *Constant::getNullValue(const Type *Ty) {
switch (Ty->getTypeID()) {
case Type::IntegerTyID:
return ConstantInt::get(Ty, 0);
case Type::FloatTyID:
return ConstantFP::get(Ty->getContext(), APFloat(APInt(32, 0)));
return ConstantFP::get(Ty->getContext(),
APFloat::getZero(APFloat::IEEEsingle));
case Type::DoubleTyID:
return ConstantFP::get(Ty->getContext(), APFloat(APInt(64, 0)));
return ConstantFP::get(Ty->getContext(),
APFloat::getZero(APFloat::IEEEdouble));
case Type::X86_FP80TyID:
return ConstantFP::get(Ty->getContext(), APFloat(APInt(80, 2, zero)));
return ConstantFP::get(Ty->getContext(),
APFloat::getZero(APFloat::x87DoubleExtended));
case Type::FP128TyID:
return ConstantFP::get(Ty->getContext(),
APFloat(APInt(128, 2, zero), true));
APFloat::getZero(APFloat::IEEEquad));
case Type::PPC_FP128TyID:
return ConstantFP::get(Ty->getContext(), APFloat(APInt(128, 2, zero)));
return ConstantFP::get(Ty->getContext(),
APFloat::getZero(APFloat::PPCDoubleDouble));
case Type::PointerTyID:
return ConstantPointerNull::get(cast<PointerType>(Ty));
case Type::StructTyID: