[llvm-commits] [llvm] r40877 - in /llvm/trunk/lib/Target/X86: X86CallingConv.td X86FloatingPoint.cpp X86ISelDAGToDAG.cpp X86InstrFPStack.td

Dale Johannesen dalej at apple.com
Mon Aug 6 14:31:06 PDT 2007


Author: johannes
Date: Mon Aug  6 16:31:06 2007
New Revision: 40877

URL: http://llvm.org/viewvc/llvm-project?rev=40877&view=rev
Log:
Get X86 long double calling convention to work
(on Darwin, anyway).  Fix some table omissions for
LD arithmetic.

Modified:
    llvm/trunk/lib/Target/X86/X86CallingConv.td
    llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp
    llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
    llvm/trunk/lib/Target/X86/X86InstrFPStack.td

Modified: llvm/trunk/lib/Target/X86/X86CallingConv.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86CallingConv.td?rev=40877&r1=40876&r2=40877&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86CallingConv.td (original)
+++ llvm/trunk/lib/Target/X86/X86CallingConv.td Mon Aug  6 16:31:06 2007
@@ -35,7 +35,10 @@
 
   // MMX vector types are always returned in MM0. If the target doesn't have
   // MM0, it doesn't support these vector types.
-  CCIfType<[v8i8, v4i16, v2i32, v1i64], CCAssignToReg<[MM0]>>
+  CCIfType<[v8i8, v4i16, v2i32, v1i64], CCAssignToReg<[MM0]>>,
+
+  // Long double types are always returned in ST0 (even with SSE).
+  CCIfType<[f80], CCAssignToReg<[ST0]>>
 ]>;
 
 // X86-32 C return-value convention.
@@ -137,7 +140,10 @@
   
   // Doubles get 8-byte slots that are 4-byte aligned.
   CCIfType<[f64], CCAssignToStack<8, 4>>,
-  
+
+  // Long doubles get 16-byte slots that are 4-byte aligned.
+  CCIfType<[f80], CCAssignToStack<16, 4>>,
+
   // The first 4 vector arguments are passed in XMM registers.
   CCIfType<[v16i8, v8i16, v4i32, v2i64, v4f32, v2f64],
               CCAssignToReg<[XMM0, XMM1, XMM2, XMM3]>>,

Modified: llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp?rev=40877&r1=40876&r2=40877&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86FloatingPoint.cpp Mon Aug  6 16:31:06 2007
@@ -684,48 +684,64 @@
 static const TableEntry ForwardST0Table[] = {
   { X86::ADD_Fp32  , X86::ADD_FST0r },
   { X86::ADD_Fp64  , X86::ADD_FST0r },
+  { X86::ADD_Fp80  , X86::ADD_FST0r },
   { X86::DIV_Fp32  , X86::DIV_FST0r },
   { X86::DIV_Fp64  , X86::DIV_FST0r },
+  { X86::DIV_Fp80  , X86::DIV_FST0r },
   { X86::MUL_Fp32  , X86::MUL_FST0r },
   { X86::MUL_Fp64  , X86::MUL_FST0r },
+  { X86::MUL_Fp80  , X86::MUL_FST0r },
   { X86::SUB_Fp32  , X86::SUB_FST0r },
   { X86::SUB_Fp64  , X86::SUB_FST0r },
+  { X86::SUB_Fp80  , X86::SUB_FST0r },
 };
 
 // ReverseST0Table - Map: A = B op C  into: ST(0) = ST(i) op ST(0)
 static const TableEntry ReverseST0Table[] = {
   { X86::ADD_Fp32  , X86::ADD_FST0r  },   // commutative
   { X86::ADD_Fp64  , X86::ADD_FST0r  },   // commutative
+  { X86::ADD_Fp80  , X86::ADD_FST0r  },   // commutative
   { X86::DIV_Fp32  , X86::DIVR_FST0r },
   { X86::DIV_Fp64  , X86::DIVR_FST0r },
+  { X86::DIV_Fp80  , X86::DIVR_FST0r },
   { X86::MUL_Fp32  , X86::MUL_FST0r  },   // commutative
   { X86::MUL_Fp64  , X86::MUL_FST0r  },   // commutative
+  { X86::MUL_Fp80  , X86::MUL_FST0r  },   // commutative
   { X86::SUB_Fp32  , X86::SUBR_FST0r },
   { X86::SUB_Fp64  , X86::SUBR_FST0r },
+  { X86::SUB_Fp80  , X86::SUBR_FST0r },
 };
 
 // ForwardSTiTable - Map: A = B op C  into: ST(i) = ST(0) op ST(i)
 static const TableEntry ForwardSTiTable[] = {
   { X86::ADD_Fp32  , X86::ADD_FrST0  },   // commutative
   { X86::ADD_Fp64  , X86::ADD_FrST0  },   // commutative
+  { X86::ADD_Fp80  , X86::ADD_FrST0  },   // commutative
   { X86::DIV_Fp32  , X86::DIVR_FrST0 },
   { X86::DIV_Fp64  , X86::DIVR_FrST0 },
+  { X86::DIV_Fp80  , X86::DIVR_FrST0 },
   { X86::MUL_Fp32  , X86::MUL_FrST0  },   // commutative
   { X86::MUL_Fp64  , X86::MUL_FrST0  },   // commutative
+  { X86::MUL_Fp80  , X86::MUL_FrST0  },   // commutative
   { X86::SUB_Fp32  , X86::SUBR_FrST0 },
   { X86::SUB_Fp64  , X86::SUBR_FrST0 },
+  { X86::SUB_Fp80  , X86::SUBR_FrST0 },
 };
 
 // ReverseSTiTable - Map: A = B op C  into: ST(i) = ST(i) op ST(0)
 static const TableEntry ReverseSTiTable[] = {
   { X86::ADD_Fp32  , X86::ADD_FrST0 },
   { X86::ADD_Fp64  , X86::ADD_FrST0 },
+  { X86::ADD_Fp80  , X86::ADD_FrST0 },
   { X86::DIV_Fp32  , X86::DIV_FrST0 },
   { X86::DIV_Fp64  , X86::DIV_FrST0 },
+  { X86::DIV_Fp80  , X86::DIV_FrST0 },
   { X86::MUL_Fp32  , X86::MUL_FrST0 },
   { X86::MUL_Fp64  , X86::MUL_FrST0 },
+  { X86::MUL_Fp80  , X86::MUL_FrST0 },
   { X86::SUB_Fp32  , X86::SUB_FrST0 },
   { X86::SUB_Fp64  , X86::SUB_FrST0 },
+  { X86::SUB_Fp80  , X86::SUB_FrST0 },
 };
 
 
@@ -899,11 +915,13 @@
   default: assert(0 && "Unknown SpecialFP instruction!");
   case X86::FpGETRESULT32:  // Appears immediately after a call returning FP type!
   case X86::FpGETRESULT64:  // Appears immediately after a call returning FP type!
+  case X86::FpGETRESULT80:
     assert(StackTop == 0 && "Stack should be empty after a call!");
     pushReg(getFPReg(MI->getOperand(0)));
     break;
   case X86::FpSETRESULT32:
   case X86::FpSETRESULT64:
+  case X86::FpSETRESULT80:
     assert(StackTop == 1 && "Stack should have one element on it to return!");
     --StackTop;   // "Forget" we have something on the top of stack!
     break;

Modified: llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp?rev=40877&r1=40876&r2=40877&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelDAGToDAG.cpp Mon Aug  6 16:31:06 2007
@@ -498,7 +498,8 @@
                 MRegisterInfo::isVirtualRegister(I->getOperand(op).getReg()) &&
                 ((clas = RegMap->getRegClass(I->getOperand(0).getReg())) == 
                    X86::RFP32RegisterClass ||
-                 clas == X86::RFP64RegisterClass)) {
+                 clas == X86::RFP64RegisterClass ||
+                 clas == X86::RFP80RegisterClass)) {
               ContainsFPCode = true;
               break;
             }

Modified: llvm/trunk/lib/Target/X86/X86InstrFPStack.td
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86InstrFPStack.td?rev=40877&r1=40876&r2=40877&view=diff

==============================================================================
--- llvm/trunk/lib/Target/X86/X86InstrFPStack.td (original)
+++ llvm/trunk/lib/Target/X86/X86InstrFPStack.td Mon Aug  6 16:31:06 2007
@@ -130,12 +130,18 @@
 def FpGETRESULT64 : FpI_<(outs RFP64:$dst), (ins), SpecialFP,
                       [(set RFP64:$dst, X86fpget)]>;           // FPR = ST(0)
 
+def FpGETRESULT80 : FpI_<(outs RFP80:$dst), (ins), SpecialFP,
+                      [(set RFP80:$dst, X86fpget)]>;           // FPR = ST(0)
+
 def FpSETRESULT32 : FpI_<(outs), (ins RFP32:$src), SpecialFP,
                       [(X86fpset RFP32:$src)]>, Imp<[], [ST0]>;// ST(0) = FPR
 
 def FpSETRESULT64 : FpI_<(outs), (ins RFP64:$src), SpecialFP,
                       [(X86fpset RFP64:$src)]>, Imp<[], [ST0]>;// ST(0) = FPR
 
+def FpSETRESULT80 : FpI_<(outs), (ins RFP80:$src), SpecialFP,
+                      [(X86fpset RFP80:$src)]>, Imp<[], [ST0]>;// ST(0) = FPR
+
 // FpI - Floating Point Psuedo Instruction template. Predicated on FPStack.
 class FpI<dag outs, dag ins, FPFormat fp, list<dag> pattern> :
   FpI_<outs, ins, fp, pattern>, Requires<[FPStack]>;





More information about the llvm-commits mailing list