[llvm] [LoongArch] Pass 'half' in the lower 16 bits of an f32 value with F/D ABI (PR #109368)

via llvm-commits llvm-commits at lists.llvm.org
Fri Sep 20 04:28:43 PDT 2024


heiher wrote:

> Are you aware of #97981? This was recently fixed by #107791 and it sounds like you want to un-fix it? It's my understanding that for half it's preferred to use GPR rather than FPR for the call ABI, if you do not have ABI requirements to the contrary.
> 
> Note that there is also the useFPRegsForHalfType() hook.

This doesn't undo the fix. The motivation is to prepare for future LoongArch FPU support for fp16 (similar to RISC-V's Zfh extension). If we pass fp16 via GPR now, but future hardware uses the lower 16 bits of FPR for fp16, we'd introduce unnecessary data transfers between GPR and FPR. Passing software fp16 via FPR now aligns the ABI with future hardware fp16, avoiding issues similar to `-mfloat-abi=softfp`. Given software fp16's low performance, I'd recommend prioritizing future hardware fp16 support. Thanks.

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


More information about the llvm-commits mailing list