[llvm] [RISCV][GISel][WIP] Support s64 G_PHI on RV32 when D extension is enabled. (PR #119026)

Craig Topper via llvm-commits llvm-commits at lists.llvm.org
Fri Dec 6 13:17:35 PST 2024


topperc wrote:

> > Unfortunately, this hurts the codegen of i64 phis because we now end up emitting them as an s64 G_PHI surrounded by G_MERGE/G_UNMERGE. Since are no instructions to move between 2 GPRs and an FPR, we have to go through a stack temporary.
> 
> Just to make sure I understand this. These are two separate problems:
> 
> 1. Merge/unmerge for i64 values
> 2. Moving 2 gprs in an FPR
> 
> If they are not, the thing that trips me is why do we use FPR for i64?
> 
> While writing this, I think I understand: that's because only FPR can hold the i64 value after legalization and you're stuck with it. Is that the problem?
> 

Yes. Because s64 G_PHI is legal, the G_MERGES/G_UNMERGES created for i64 function arguments/returns or when we legalize i64 arithmetic don't get removed. Those G_MERGE/G_UNMERGE get selected to pseudo instructions that eventually become stack store/load. So it all functionally works its just not optimal.

https://github.com/llvm/llvm-project/pull/119026


More information about the llvm-commits mailing list