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

Luís Marques via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Oct 21 13:26:56 PDT 2019


luismarques added a comment.

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

> It's probably a good idea to clarify the psABI's stance on half floats (possibly including not having any opinion about that), but do beware that this issue transcends the ABI. This half-float is being promoted at the LLVM IR level to a single-precision float, and once that happens everything behaves normally. What happens before the promotion is an LLVM implementation detail, so probably outside the scope of the ABI docs.


Just to clarify, because I used somewhat sloppy terminology. Consider this:

  %r = fadd half %a, %b
  ->
  ; ... magic ...
  ; CHECK-NEXT:    fadd.s fa0, fs0, fa0
  ; ... magic ...

We are conceptually implementing half-float addition, but in reality promoting and expanding that to single-precision floating-point addition. If we consider that all of the promotion/expansion happens at a level that is not visible to the user and does not have to interoperate with other compilers then I would argue that it transcends the ABI requirements. But if it becomes visible then that's another story. Then I guess the answer depends on whether you want to standardize the ABI for a non-standard C type, and thus ensure interoperability across compilers even for that case.


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