Skip to content

Commit

Permalink
Add IEEE half-precision data type.
Browse files Browse the repository at this point in the history
After discussion with clang and gcc community, we choose
C ISO/IEC TS 18661-3 `_Float16` rather than redefine
a different behavior type `__fp16` in RISC-V.

1. ARM folks are working on deprecating `__fp16`. [1]
2. In Clang, `_Float16` is available in both C and C++ mode. [2]
3. In GCC, `_Float16` is only avaiable in C mode but GCC folks
think making it available in C++ as GCC extension is doable. [3]

[1] https://lists.llvm.org/pipermail/cfe-dev/2021-March/067850.html
[2] https://gcc.gnu.org/pipermail/gcc/2021-March/234981.html
[3] https://gcc.gnu.org/pipermail/gcc/2021-March/234972.html
  • Loading branch information
zakk0610 committed Jul 13, 2021
1 parent 7ea570f commit 2d325eb
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions riscv-elf.md
Original file line number Diff line number Diff line change
Expand Up @@ -378,6 +378,7 @@ There are two conventions for C type sizes and alignments.
long long | 8 | 8
__int128 | 16 | 16
void * | 8 | 8
_Float16 | 2 | 2
float | 4 | 4
double | 8 | 8
long double | 16 | 16
Expand All @@ -397,6 +398,7 @@ There are two conventions for C type sizes and alignments.
long | 4 | 4
long long | 8 | 8
void * | 4 | 4
_Float16 | 2 | 2
float | 4 | 4
double | 8 | 8
long double | 16 | 16
Expand All @@ -420,6 +422,8 @@ arguments are either `0` (`false`) or `1` (`true`).

A null pointer (for all types) has the value zero.

`_Float16` is as defined in the C ISO/IEC TS 18661-3 extension.

`_Complex` types have the same layout as a struct containing two fields of the
corresponding real type (`float`, `double`, or `long double`), with the first
member holding the real part and the second member holding the imaginary part.
Expand Down

0 comments on commit 2d325eb

Please sign in to comment.