Hi: It's Kito, a RISC-V folks, recently RISC-V has an ISA extension draft for IEEE half-precision operations [4], including arithmetic, conversion, comparison...a full set of support for IEEE half-precision.
So we are seeking the data type for IEEE half-precision, and then we have few candidates for that: 1. _Float16 2. __fp16 (Same as ACLE) 3. Other type names maybe __float16_t _Float16 was the best candidate since it kind of standard types from ISO/IEC TS 18661-3, and it already supported by both clang and gcc, however the issue is GCC don't support that on C++ mode and seems like [1-2] it not intend to support that due to the decimal floating point issue, C++ also has another proposal for extended floating-point types (https://wg21.link/p1467), which included half-precision types, so in my understanding, _Float16 won't be a portable typen between C/C++. And the second candidate __fp16, which is the typename come from ACLE, it has no C/C++ portable issue due to its target specific type, the only issue is ACLE has defined that promote to float before operation, which is not fully utilized the hardware features, so one possible solution is RISC-V also defined __fp16 type, but with different semantics, no promotion if HW fp16 are enabled, like _Float16 has flexible evaluation format, then we can gain most advantage, compilable for ARM source code, also benefit with the hardware capability. But users might get different slight results than ARM, since we might not do float promotion before evaluation for __fp16. So the last candidate is defined another typename like __float16_t, and define the behavior almost same as _Float16 but with default promotion rule like __fp16 from ACLE, it also has no C/C++ portable issue, but lose a little bit compatibility with the ARM code. What do you think about this? I guess ideally we could wait for P1467[3] to be included in C++ standard, but it seems like we need to wait another couple years to land. Or maybe add a target specific type to resolve that immediate is more realistic solution? Thanks [1] See "C++ note:" in commit log https://gcc.gnu.org/git/?p=gcc.git;a=commit;h=c65699efcce48d68ef57ab3ce7fc5420fac5cbf9 [2] https://gcc.gnu.org/pipermail/gcc/2021-March/234965.html [3] https://wg21.link/p1467 [4] https://github.com/riscv/riscv-isa-manual/pull/496