-
Notifications
You must be signed in to change notification settings - Fork 15.2k
[WIP][SPARC] Properly handle CC for long double on sparc32 #162226
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -24,8 +24,8 @@ def CC_Sparc32 : CallingConv<[ | |
// As are v2i32 arguments (this would be the default behavior for | ||
// v2i32 if it wasn't allocated to the IntPair register-class) | ||
CCIfType<[v2i32], CCCustom<"CC_Sparc_Assign_Split_64">>, | ||
|
||
|
||
// f128 arguments are passed indirectly. | ||
CCIfType<[f128], CCPassIndirect<i32>>, | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Also, am I doing this right @efriedma-quic? The argument to CCPassIndirect is the type of the pointer right? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looks right, I think. |
||
// Alternatively, they are assigned to the stack in 4-byte aligned units. | ||
CCAssignToStack<4, 4> | ||
]>; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -554,20 +554,19 @@ SDValue SparcTargetLowering::LowerFormalArguments_32( | |
continue; | ||
} | ||
|
||
int FI = MF.getFrameInfo().CreateFixedObject(4, | ||
Offset, | ||
true); | ||
SDValue FIPtr = DAG.getFrameIndex(FI, PtrVT); | ||
SDValue Load ; | ||
int FI; | ||
if (VA.getValVT() == MVT::i32 || VA.getValVT() == MVT::f32) { | ||
Load = DAG.getLoad(VA.getValVT(), dl, Chain, FIPtr, MachinePointerInfo()); | ||
FI = MF.getFrameInfo().CreateFixedObject(4, Offset, true); | ||
} else if (VA.getValVT() == MVT::f128) { | ||
report_fatal_error("SPARCv8 does not handle f128 in calls; " | ||
"pass indirectly"); | ||
FI = MF.getFrameInfo().CreateFixedObject(16, Offset, false); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This doesn't look right. If the value is passed indirectly, that's encoded in VA: call getLocInfo(), check for CCValAssign::Indirect. If it's indirect, the argument is a pointer, so you need to load the pointer, then load the underlying value from that pointer. |
||
} else { | ||
// We shouldn't see any other value types here. | ||
llvm_unreachable("Unexpected ValVT encountered in frame lowering."); | ||
} | ||
|
||
SDValue FIPtr = DAG.getFrameIndex(FI, PtrVT); | ||
SDValue Load = | ||
DAG.getLoad(VA.getValVT(), dl, Chain, FIPtr, MachinePointerInfo()); | ||
InVals.push_back(Load); | ||
} | ||
|
||
|
@@ -913,7 +912,9 @@ SparcTargetLowering::LowerCall_32(TargetLowering::CallLoweringInfo &CLI, | |
// Promote the value if needed. | ||
switch (VA.getLocInfo()) { | ||
default: llvm_unreachable("Unknown loc info!"); | ||
case CCValAssign::Full: break; | ||
case CCValAssign::Full: | ||
case CCValAssign::Indirect: | ||
break; | ||
case CCValAssign::SExt: | ||
Arg = DAG.getNode(ISD::SIGN_EXTEND, dl, VA.getLocVT(), Arg); | ||
break; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You probably also need to fix the datalayout