We are lacking builtins support for _Float16. In most cases, we can use other floating-type builtins and truncate them to _Float16.
But it's a problem to SNaN, e.g., https://gcc.godbolt.org/z/cqr5nG1jh
This patch adds __builtin_nansf16 support as well as other 3 ones since they are usually used together.
Details
Diff Detail
- Repository
- rG LLVM Github Monorepo
Event Timeline
| clang/include/clang/Basic/Builtins.def | ||
|---|---|---|
| 145 | Is the builtin sorted in alphabet order? | |
| clang/include/clang/Basic/Builtins.def | ||
|---|---|---|
| 145 | No, I think there's no strict order requirment here. The xxxf128 builtins have already not met it. | |
| clang/test/CodeGen/builtin_Float16.c | ||
|---|---|---|
| 8 | Is _Float16 a legal type for target armv7a and aarch64? | |
| clang/test/CodeGen/builtin_Float16.c | ||
|---|---|---|
| 8 | ||
| clang/test/CodeGen/builtin_Float16.c | ||
|---|---|---|
| 8 | Maybe use __fp16 because it is supported on every target. | |
| clang/test/CodeGen/builtin_Float16.c | ||
|---|---|---|
| 8 | No, I intentionally use _Float16 here because I want to make it correspond to the type define x in Builtins.def | |
Is the builtin sorted in alphabet order?