-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
linking with C library changes the behavior of _Float16 #118813
Comments
@rustbot label A-floating-point A-linkage I-unsound |
cc @Amanieu for compiler builtins shenanigans |
We probably need to se |
WG-prioritization assigning priority (Zulip discussion). @rustbot label -I-prioritize +P-high |
Yes, I think that would solve the problem. Is |
I looks like it's not available on all targets: https://clang.llvm.org/docs/LanguageExtensions.html#half-precision-floating-point |
@beetrees put up rust-lang/compiler-builtins#593 which uses our nightly |
In general, LLVM will call builtins with the default C ABI, so any target features that affect the ABI (SSE2, soft-float, etc.) need to be the same when compiling Related: #116558 |
Do I understand this right that this has been fixed by #125016? |
Correct. Specifically, rust-lang/compiler-builtins#593 means that |
I tried this code:
I expected to see this happen: It prints
114
.Instead, this happened: It prints an unknown value,
0.00017929077
,-0.045898438
or other.After debugging, I found both
compiler_builtins
andlibgcc
provide the symbol__extendhfsf2
.__extendhfsf2
is acompiler-rt
intrinsics for casting a_Float16
tofloat
. Incompiler_builtins
, the only argument of__extendhfsf2
is passed in a general-proposed register, However, inlibgcc
, the only argument of__extendhfsf2
is passed inxmm
.related: llvm/llvm-project#56854
Meta
rustc --version --verbose
:The text was updated successfully, but these errors were encountered: