Skip to content

Commit 58c9ef5

Browse files
authored
[RISCV] Use f64 for LocVT for ilp32 when whole f64 is passed on the stack. NFC (#69118)
This removes the special case from unpackF64OnRV32DSoftABI. We can use the default MemLoc handling. This also allows us to remove a isRegLoc() check from LowerCall. This part of preparation for supporting FP arguments with GISel.
1 parent e3f5332 commit 58c9ef5

File tree

1 file changed

+3
-16
lines changed

1 file changed

+3
-16
lines changed

llvm/lib/Target/RISCV/RISCVISelLowering.cpp

Lines changed: 3 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16452,13 +16452,13 @@ bool RISCV::CC_RISCV(const DataLayout &DL, RISCVABI::ABI ABI, unsigned ValNo,
1645216452
// stack. LowerCall/LowerFormalArguments/LowerReturn must recognise these
1645316453
// cases.
1645416454
Register Reg = State.AllocateReg(ArgGPRs);
16455-
LocVT = MVT::i32;
1645616455
if (!Reg) {
1645716456
unsigned StackOffset = State.AllocateStack(8, Align(8));
1645816457
State.addLoc(
1645916458
CCValAssign::getMem(ValNo, ValVT, StackOffset, LocVT, LocInfo));
1646016459
return false;
1646116460
}
16461+
LocVT = MVT::i32;
1646216462
if (!State.AllocateReg(ArgGPRs))
1646316463
State.AllocateStack(4, Align(4));
1646416464
State.addLoc(CCValAssign::getReg(ValNo, ValVT, Reg, LocVT, LocInfo));
@@ -16777,15 +16777,6 @@ static SDValue unpackF64OnRV32DSoftABI(SelectionDAG &DAG, SDValue Chain,
1677716777
MachineFrameInfo &MFI = MF.getFrameInfo();
1677816778
MachineRegisterInfo &RegInfo = MF.getRegInfo();
1677916779

16780-
if (VA.isMemLoc()) {
16781-
// f64 is passed on the stack.
16782-
int FI =
16783-
MFI.CreateFixedObject(8, VA.getLocMemOffset(), /*IsImmutable=*/true);
16784-
SDValue FIN = DAG.getFrameIndex(FI, MVT::i32);
16785-
return DAG.getLoad(MVT::f64, DL, Chain, FIN,
16786-
MachinePointerInfo::getFixedStack(MF, FI));
16787-
}
16788-
1678916780
assert(VA.isRegLoc() && "Expected register VA assignment");
1679016781

1679116782
Register LoVReg = RegInfo.createVirtualRegister(&RISCV::GPRRegClass);
@@ -17298,9 +17289,8 @@ SDValue RISCVTargetLowering::LowerCall(CallLoweringInfo &CLI,
1729817289
ISD::ArgFlagsTy Flags = Outs[i].Flags;
1729917290

1730017291
// Handle passing f64 on RV32D with a soft float ABI as a special case.
17301-
bool IsF64OnRV32DSoftABI =
17302-
VA.getLocVT() == MVT::i32 && VA.getValVT() == MVT::f64;
17303-
if (IsF64OnRV32DSoftABI && VA.isRegLoc()) {
17292+
if (VA.getLocVT() == MVT::i32 && VA.getValVT() == MVT::f64) {
17293+
assert(VA.isRegLoc() && "Expected register VA assignment");
1730417294
SDValue SplitF64 = DAG.getNode(
1730517295
RISCVISD::SplitF64, DL, DAG.getVTList(MVT::i32, MVT::i32), ArgValue);
1730617296
SDValue Lo = SplitF64.getValue(0);
@@ -17326,9 +17316,6 @@ SDValue RISCVTargetLowering::LowerCall(CallLoweringInfo &CLI,
1732617316
continue;
1732717317
}
1732817318

17329-
// IsF64OnRV32DSoftABI && VA.isMemLoc() is handled below in the same way
17330-
// as any other MemLoc.
17331-
1733217319
// Promote the value if needed.
1733317320
// For now, only handle fully promoted and indirect arguments.
1733417321
if (VA.getLocInfo() == CCValAssign::Indirect) {

0 commit comments

Comments
 (0)