The _Float16 type is supported on x86 systems with SSE2 enabled. Operations are emulated by software emulation and “float” instructions. This patch is allowing the support of _Float16 type without the use of -max512fp16 flag. The final goal being, perform _Float16 emulation for all arithmetic expressions.
Why don't move it to fp16-abi.c directly?
Change the file name?
This test (and Float16.c) should test at least one target that doesn't have _Float16 support, so please just add -DHAVE to the x86_64 line and add, I dunno, a generic i386 or SPARC line.
This change is breaking build of compiler-rt on Ubuntu bionic and others on amd64:
"/build/llvm-toolchain-snapshot-14~++20211119100719+d729f4c38fca/build-llvm/./bin/clang" --target=x86_64-pc-linux-gnu -DVISIBILITY_HIDDEN -fstack-protector-strong -Wformat -Werror=format-security -Wno-unused-command-line-argument -Wdate-time -D_FORTIFY_SOURCE=2 -O3 -DNDEBUG -m32 -DCOMPILER_RT_HAS_FLOAT16 -std=c11 -fPIC -fno-builtin -fvisibility=hidden -fomit-frame-pointer -MD -MT CMakeFiles/clang_rt.builtins-i386.dir/extendhfsf2.c.o -MF CMakeFiles/clang_rt.builtins-i386.dir/extendhfsf2.c.o.d -o CMakeFiles/clang_rt.builtins-i386.dir/extendhfsf2.c.o -c '/build/llvm-toolchain-snapshot-14~++20211119100719+d729f4c38fca/compiler-rt/lib/builtins/extendhfsf2.c' In file included from /build/llvm-toolchain-snapshot-14~++20211119100719+d729f4c38fca/compiler-rt/lib/builtins/extendhfsf2.c:11: In file included from /build/llvm-toolchain-snapshot-14~++20211119100719+d729f4c38fca/compiler-rt/lib/builtins/fp_extend_impl.inc:38: /build/llvm-toolchain-snapshot-14~++20211119100719+d729f4c38fca/compiler-rt/lib/builtins/fp_extend.h:44:9: error: _Float16 is not supported on this target typedef _Float16 src_t; ^ 1 error generated.
I have reverted this patch but would like to push it in at some point (may be after the back end changes https://reviews.llvm.org/D107082 will be merged in.
But I see in the command above that it is compiling with -DCOMPILER_RT_HAS_FLOAT16. @sylvestre.ledru is this flag really supposed to be on? Was it the case before this patch? @rjmccall isn't this because we turned on HasLegalHalfType?