[compiler-rt] [compiler-rt][builtins] Fix FLOAT16 feature detection (PR #69842)

Konrad Kleine via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 22 03:36:55 PST 2024


kwk wrote:

> This needs to be reviewed by someone familiar with the compiler-rt build system.

@tstellar is there any progress on this? Without this PR this test fails for us: https://src.fedoraproject.org/tests/compiler-rt/blob/main/f/fp16-abi

To reproduce it locally with a recent clang you can do this:

```console
$ cat <<EOF > /tmp/test.cpp                                           
#include <iostream>
#include <algorithm>
#include <vector>

int main()
{
    _Float16 one_f16 = 0.123;
    float one_f32 = one_f16;
    std::cout <<  one_f32 << std::endl;
    return 0;
}
EOF
$ clang++ --rtlib=compiler-rt -O0 /tmp/test.cpp -o /tmp/test
$ /tmp/test
```

The expected output is `0.122986` but the actual output is `5.96046e-08`. This only happens for `-O0` by the way.

For the moment I'm going to cherry-pick this PR and have it applied to our snapshot builds.

https://github.com/llvm/llvm-project/pull/69842


More information about the llvm-commits mailing list