Issue 170529
Summary [builtins] __truncxfhf2 incorrect values compared to --rtlib=libgcc
Labels new issue
Assignees
Reporter gorgew
    The value of `__truncxfhf2` for casting long double to __fp16 appears to be incorrect with `--rtlib=compiler-rt` to `--rtlib=libgcc`, at least on x86_64 on llvm 21. This is also without `-mf16c`, though it does seem to happen with it as well.

Example program:
`
int main(void)
{
     __fp16 h = 0.0f16;
    long double ld = 12.34l;
    h = ld;
    return 0;
}
`
Compiled with clang++  and `-g --rtlib=libgcc`, in GDB I see that the value after the cast is 
`
(gdb) p h
$1 = 12.344
`
which seems reasonable.
However, with '-g --rtlib=compiler-rt', I see that the value after the cast is
`
(gdb) p h
$1 = 9504
`
which is an unreasonable value.
_______________________________________________
llvm-bugs mailing list
[email protected]
https://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-bugs

Reply via email to