[compiler-rt] [builtins] Detect _Float16 support at compile time
authorDimitry Andric <dimitry@andric.com>
Thu, 28 Jul 2022 17:52:16 +0000 (19:52 +0200)
committerDimitry Andric <dimitry@andric.com>
Fri, 29 Jul 2022 18:58:52 +0000 (20:58 +0200)
commitce6d40f5c23923a807388c58b82b4c343eced0ce
treee0732870c318205abc0c18b5197fcf30d56f769a
parent4e1fe968c9de73507a1bf0c8aa57e06be457816e
[compiler-rt] [builtins] Detect _Float16 support at compile time

Instead of detecting `_Float16` support at CMake configuration time,
detect it at compile time by checking for the predefined (by the
compiler) macro `__FLT16_MAX__` instead.

This solves the issue where compiler-rt is built simultaneously for both
x86_64 and i386 targets, and the CMake configuration uses x86_64
compilation to detect `_Float16` support, while it may not be supported
by the i386 target (if it does not have SSE2).

While here, rename `COMPILERT_RT_HAS_FLOAT16` to `CRT_HAS_FLOAT16`, to
conform more to the naming style used in `int_lib.h` and `int_types.h`.

Reviewed By: MaskRay

Differential Revision: https://reviews.llvm.org/D130718
compiler-rt/cmake/builtin-config-ix.cmake
compiler-rt/lib/builtins/CMakeLists.txt
compiler-rt/lib/builtins/extendhftf2.c
compiler-rt/lib/builtins/fp_extend.h
compiler-rt/lib/builtins/fp_trunc.h
compiler-rt/lib/builtins/int_types.h
compiler-rt/lib/builtins/trunctfhf2.c
compiler-rt/test/builtins/CMakeLists.txt
compiler-rt/test/builtins/Unit/extendhftf2_test.c
compiler-rt/test/builtins/Unit/fp_test.h
compiler-rt/test/builtins/Unit/trunctfhf2_test.c