[PATCH] D69246: [RISCV] Add support for half-precision floats

Sam Elliott via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 21 10:46:16 PDT 2019


lenary added a comment.

In D69246#1716922 <https://reviews.llvm.org/D69246#1716922>, @luismarques wrote:

> In D69246#1716876 <https://reviews.llvm.org/D69246#1716876>, @lenary wrote:
>
> > I find the libcall ABI slighly odd (__gnu_h2f_ieee takes the half-precision arg in `a0` and returns the result in `fa0`, it seems, which strikes me as a bit odd, but maybe I'm missing something). That said, that probably isn't an issue with this patch specifically.
>
>
> That makes sense. The half-precision float isn't a floating-point value as understood by the FP unit, so it has to go in a GPR, for ALU operations to slice up the fields and build the normal IEEE 754 32-bit representation, which can then be returned as a regular float -- which for ilp32f is of course returned in an FPR.


No exception for half-precision floats has been included in the RISC-V ELF psABI (one would expect they should use the FP calling convention, as they are an FP real value). This should perhaps be rectified, but separately to this patch. I'll make a note.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D69246/new/

https://reviews.llvm.org/D69246





More information about the llvm-commits mailing list