mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-27 14:34:58 +00:00
Get X86 long double calling convention to work
(on Darwin, anyway). Fix some table omissions for LD arithmetic. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@40877 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
0275cffa97
commit
6a30811d5c
@ -35,7 +35,10 @@ def RetCC_X86Common : CallingConv<[
|
||||
|
||||
// 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 @@ def CC_X86_32_Common : CallingConv<[
|
||||
|
||||
// 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]>>,
|
||||
|
@ -684,48 +684,64 @@ void FPS::handleOneArgFPRW(MachineBasicBlock::iterator &I) {
|
||||
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 @@ void FPS::handleSpecialFP(MachineBasicBlock::iterator &I) {
|
||||
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;
|
||||
|
@ -498,7 +498,8 @@ void X86DAGToDAGISel::InstructionSelectBasicBlock(SelectionDAG &DAG) {
|
||||
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;
|
||||
}
|
||||
|
@ -130,12 +130,18 @@ def FpGETRESULT32 : FpI_<(outs RFP32:$dst), (ins), SpecialFP,
|
||||
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]>;
|
||||
|
Loading…
x
Reference in New Issue
Block a user