[llvm-commits] [llvm] r46411 - /llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Chris Lattner
sabre at nondot.org
Sat Jan 26 22:19:32 PST 2008
Author: lattner
Date: Sun Jan 27 00:19:31 2008
New Revision: 46411
URL: http://llvm.org/viewvc/llvm-project?rev=46411&view=rev
Log:
Use fldz and fld1 for long double constants instead of a constant pool load.
Modified:
llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=46411&r1=46410&r2=46411&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Sun Jan 27 00:19:31 2008
@@ -455,7 +455,20 @@
addRegisterClass(MVT::f80, X86::RFP80RegisterClass);
setOperationAction(ISD::UNDEF, MVT::f80, Expand);
setOperationAction(ISD::FCOPYSIGN, MVT::f80, Expand);
- setOperationAction(ISD::ConstantFP, MVT::f80, Expand);
+ {
+ setOperationAction(ISD::ConstantFP, MVT::f80, Expand);
+ APFloat TmpFlt(+0.0);
+ TmpFlt.convert(APFloat::x87DoubleExtended, APFloat::rmNearestTiesToEven);
+ addLegalFPImmediate(TmpFlt); // FLD0
+ TmpFlt.changeSign();
+ addLegalFPImmediate(TmpFlt); // FLD0/FCHS
+ APFloat TmpFlt2(+1.0);
+ TmpFlt2.convert(APFloat::x87DoubleExtended, APFloat::rmNearestTiesToEven);
+ addLegalFPImmediate(TmpFlt2); // FLD1
+ TmpFlt2.changeSign();
+ addLegalFPImmediate(TmpFlt2); // FLD1/FCHS
+ }
+
if (!UnsafeFPMath) {
setOperationAction(ISD::FSIN , MVT::f80 , Expand);
setOperationAction(ISD::FCOS , MVT::f80 , Expand);
More information about the llvm-commits
mailing list