[llvm-commits] [llvm] r120907 - in /llvm/trunk/lib: Target/X86/X86ISelLowering.cpp VMCore/Constants.cpp
Benjamin Kramer
benny.kra at googlemail.com
Sat Dec 4 06:22:24 PST 2010
Author: d0k
Date: Sat Dec 4 08:22:24 2010
New Revision: 120907
URL: http://llvm.org/viewvc/llvm-project?rev=120907&view=rev
Log:
Simplify code. No functionality change.
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
llvm/trunk/lib/VMCore/Constants.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=120907&r1=120906&r2=120907&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sat Dec 4 08:22:24 2010
@@ -521,13 +521,12 @@
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);
Modified: llvm/trunk/lib/VMCore/Constants.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/VMCore/Constants.cpp?rev=120907&r1=120906&r2=120907&view=diff
==============================================================================
--- llvm/trunk/lib/VMCore/Constants.cpp (original)
+++ llvm/trunk/lib/VMCore/Constants.cpp Sat Dec 4 08:22:24 2010
@@ -40,22 +40,25 @@
//===----------------------------------------------------------------------===//
// 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:
More information about the llvm-commits
mailing list