mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-01-29 13:32:33 +00:00
[mips] Fix MipsTargetLowering::LowerCall to pass fp128 arguments in floating
point registers. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@176521 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
parent
5fdee6d2b5
commit
cb2eafdfa3
@ -3362,7 +3362,9 @@ MipsTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
|||||||
getTargetMachine(), ArgLocs, *DAG.getContext());
|
getTargetMachine(), ArgLocs, *DAG.getContext());
|
||||||
MipsCC MipsCCInfo(CallConv, IsO32, CCInfo);
|
MipsCC MipsCCInfo(CallConv, IsO32, CCInfo);
|
||||||
|
|
||||||
MipsCCInfo.analyzeCallOperands(Outs, isVarArg);
|
MipsCCInfo.analyzeCallOperands(Outs, isVarArg,
|
||||||
|
getTargetMachine().Options.UseSoftFloat,
|
||||||
|
Callee.getNode(), CLI.Args);
|
||||||
|
|
||||||
// Get a count of how many bytes are to be pushed on the stack.
|
// Get a count of how many bytes are to be pushed on the stack.
|
||||||
unsigned NextStackOffset = CCInfo.getNextStackOffset();
|
unsigned NextStackOffset = CCInfo.getNextStackOffset();
|
||||||
@ -3421,7 +3423,8 @@ MipsTargetLowering::LowerCall(TargetLowering::CallLoweringInfo &CLI,
|
|||||||
case CCValAssign::Full:
|
case CCValAssign::Full:
|
||||||
if (VA.isRegLoc()) {
|
if (VA.isRegLoc()) {
|
||||||
if ((ValVT == MVT::f32 && LocVT == MVT::i32) ||
|
if ((ValVT == MVT::f32 && LocVT == MVT::i32) ||
|
||||||
(ValVT == MVT::f64 && LocVT == MVT::i64))
|
(ValVT == MVT::f64 && LocVT == MVT::i64) ||
|
||||||
|
(ValVT == MVT::i64 && LocVT == MVT::f64))
|
||||||
Arg = DAG.getNode(ISD::BITCAST, dl, LocVT, Arg);
|
Arg = DAG.getNode(ISD::BITCAST, dl, LocVT, Arg);
|
||||||
else if (ValVT == MVT::f64 && LocVT == MVT::i32) {
|
else if (ValVT == MVT::f64 && LocVT == MVT::i32) {
|
||||||
SDValue Lo = DAG.getNode(MipsISD::ExtractElementF64, dl, MVT::i32,
|
SDValue Lo = DAG.getNode(MipsISD::ExtractElementF64, dl, MVT::i32,
|
||||||
@ -4144,7 +4147,8 @@ MipsTargetLowering::MipsCC::MipsCC(CallingConv::ID CC, bool IsO32_,
|
|||||||
|
|
||||||
void MipsTargetLowering::MipsCC::
|
void MipsTargetLowering::MipsCC::
|
||||||
analyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Args,
|
analyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Args,
|
||||||
bool IsVarArg) {
|
bool IsVarArg, bool IsSoftFloat, const SDNode *CallNode,
|
||||||
|
std::vector<ArgListEntry> &FuncArgs) {
|
||||||
assert((CallConv != CallingConv::Fast || !IsVarArg) &&
|
assert((CallConv != CallingConv::Fast || !IsVarArg) &&
|
||||||
"CallingConv::Fast shouldn't be used for vararg functions.");
|
"CallingConv::Fast shouldn't be used for vararg functions.");
|
||||||
|
|
||||||
@ -4163,8 +4167,11 @@ analyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Args,
|
|||||||
|
|
||||||
if (IsVarArg && !Args[I].IsFixed)
|
if (IsVarArg && !Args[I].IsFixed)
|
||||||
R = VarFn(I, ArgVT, ArgVT, CCValAssign::Full, ArgFlags, CCInfo);
|
R = VarFn(I, ArgVT, ArgVT, CCValAssign::Full, ArgFlags, CCInfo);
|
||||||
else
|
else {
|
||||||
R = FixedFn(I, ArgVT, ArgVT, CCValAssign::Full, ArgFlags, CCInfo);
|
MVT RegVT = getRegVT(ArgVT, FuncArgs[Args[I].OrigArgIndex].Ty, CallNode,
|
||||||
|
IsSoftFloat);
|
||||||
|
R = FixedFn(I, ArgVT, RegVT, CCValAssign::Full, ArgFlags, CCInfo);
|
||||||
|
}
|
||||||
|
|
||||||
if (R) {
|
if (R) {
|
||||||
#ifndef NDEBUG
|
#ifndef NDEBUG
|
||||||
|
@ -205,7 +205,9 @@ namespace llvm {
|
|||||||
MipsCC(CallingConv::ID CallConv, bool IsO32, CCState &Info);
|
MipsCC(CallingConv::ID CallConv, bool IsO32, CCState &Info);
|
||||||
|
|
||||||
void analyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Outs,
|
void analyzeCallOperands(const SmallVectorImpl<ISD::OutputArg> &Outs,
|
||||||
bool IsVarArg);
|
bool IsVarArg, bool IsSoftFloat,
|
||||||
|
const SDNode *CallNode,
|
||||||
|
std::vector<ArgListEntry> &FuncArgs);
|
||||||
void analyzeFormalArguments(const SmallVectorImpl<ISD::InputArg> &Ins,
|
void analyzeFormalArguments(const SmallVectorImpl<ISD::InputArg> &Ins,
|
||||||
bool IsSoftFloat,
|
bool IsSoftFloat,
|
||||||
Function::const_arg_iterator FuncArg);
|
Function::const_arg_iterator FuncArg);
|
||||||
|
@ -11,3 +11,16 @@ entry:
|
|||||||
store fp128 %a0, fp128* @gld0, align 16
|
store fp128 %a0, fp128* @gld0, align 16
|
||||||
ret void
|
ret void
|
||||||
}
|
}
|
||||||
|
|
||||||
|
; CHECK: foo1
|
||||||
|
; CHECK: ldc1 $f13, 8(${{[0-9]+}})
|
||||||
|
; CHECK: ldc1 $f12, 0(${{[0-9]+}})
|
||||||
|
|
||||||
|
define void @foo1() {
|
||||||
|
entry:
|
||||||
|
%0 = load fp128* @gld0, align 16
|
||||||
|
tail call void @foo2(fp128 %0)
|
||||||
|
ret void
|
||||||
|
}
|
||||||
|
|
||||||
|
declare void @foo2(fp128)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user