Skip to content

Commit

Permalink
[RISCV] Use the stack for MVT::f16 for fastcc when there are no other…
Browse files Browse the repository at this point in the history
… registers available

In D155502, we added code for the compiler to check GPR-s for f16
under zhinx. This commit adds code to hit the stack when we run out of
GPR-s.

With this patch and D155502, resolves #63922

Reviewed By: craig.topper

Differential Revision: https://reviews.llvm.org/D155507
  • Loading branch information
eopXD committed Jul 19, 2023
1 parent 3837e3e commit 32c257d
Show file tree
Hide file tree
Showing 2 changed files with 1,223 additions and 0 deletions.
6 changes: 6 additions & 0 deletions llvm/lib/Target/RISCV/RISCVISelLowering.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -15254,6 +15254,12 @@ bool RISCV::CC_RISCV_FastCC(const DataLayout &DL, RISCVABI::ABI ABI,
}
}

if (LocVT == MVT::f16) {
unsigned Offset2 = State.AllocateStack(2, Align(2));
State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset2, LocVT, LocInfo));
return false;
}

if (LocVT == MVT::i32 || LocVT == MVT::f32) {
unsigned Offset4 = State.AllocateStack(4, Align(4));
State.addLoc(CCValAssign::getMem(ValNo, ValVT, Offset4, LocVT, LocInfo));
Expand Down
Loading

0 comments on commit 32c257d

Please sign in to comment.