[clang] [compiler-rt] [llvm] [SystemZ] Add support for half (fp16) (PR #109164)
Jonas Paulsson via cfe-commits
cfe-commits at lists.llvm.org
Sun Mar 9 08:48:37 PDT 2025
JonPsson1 wrote:
>
> If this is not set, you need to figure out why it is not using the correct host compiler. I think it should be using the clang built from the same sources, which _should_ now support `_Float16` - if it doesn't, this may cause other problems, potentially even explaining the wrong results you're seeing.
It seems that with a completely new build with the new cmake config the test actually passes:
```
-- Performing Test COMPILER_RT_HAS_s390x_FLOAT16
-- Performing Test COMPILER_RT_HAS_s390x_FLOAT16 - Success
```
I previously got confused here after rerunning cmake in the same folder as I thought it was enough to see the newly built clang being used (ninja -v) with compiler-rt. It seems maybe cmake itself got confused and used system gcc for its checks while building with clang? Anyway, it works now, sorry.
I also found the problem with the miscompile (after some debugging, sigh), that the file I copied (extendhfsf.c) has float hard coded as return type, even though it defines DST_SINGLE. extendhftf2.c uses dst_t as return type, but I see other files using the type directly, so I will leave those files and extendhftf2.c as they were. I guess I have a motivating case to use dst_t and src_t everywhere, but that's another issue. So the miscompile was due to a final conversion from double to float before returning. My bad.
While adding the corresponding (to extendsfdf2_test.c) test I tried inserting an obvious error, but this did not cause it to fail, not even with ninja check-all, which I thought covered all tests (ninja check-compiler-rt did not report it either). How can I run these tests?
I tried building (same way as before) and running the existing extendhfsf2_test.c but got:
`error in test__extendhfsf2(0x7e00) = 0.000000, expected nan`
This was unexpected, and I get the same error with libgcc.
> By the way, these sites are pretty helpful for double checking float reprs https://float.exposed https://weitz.de/ieee/.
I tried float.exposed but I couldn't really convert an f16 hex to a double hex. Is it supposed to be able to do this?
https://github.com/llvm/llvm-project/pull/109164
More information about the cfe-commits
mailing list