From 2d325ebcb54ef2e54ae485bb3ca8a2341b314004 Mon Sep 17 00:00:00 2001 From: Zakk Chen Date: Mon, 1 Feb 2021 16:30:00 +0800 Subject: [PATCH] Add IEEE half-precision data type. 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 --- riscv-elf.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/riscv-elf.md b/riscv-elf.md index 8c55754b..1877cd07 100644 --- a/riscv-elf.md +++ b/riscv-elf.md @@ -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 @@ -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 @@ -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.