- Notifications
You must be signed in to change notification settings - Fork254
Add builtins forf16/f128 float conversions#593
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Uh oh!
There was an error while loading.Please reload this page.
Conversation
e5d4ef8 to28e85bfComparePatryk27 commentedApr 14, 2024
Yeah, I'm not sure on AVR's ABI here, so probably better to keep those |
6dd8caf to4878c32Comparetgross35 commentedApr 15, 2024
Should this also be setting |
tgross35 commentedApr 16, 2024
Since this will probably land before#587, you might have to add the feature gate that@bjorn3 requested#587 (comment) |
beetrees commentedApr 17, 2024
I've added a |
tgross35 commentedApr 17, 2024
Thanks, that part looks great to me. Looks like tests might be missing? Like compiler-builtins/testcrate/tests/misc.rs Lines 114 to 121 in2978bdd
compiler-builtins/testcrate/tests/misc.rs Lines 201 to 214 in2978bdd
|
201f826 to11c1eedComparebeetrees commentedApr 21, 2024
As the builtins aren't present everywhere at the moment (and therefore comparing against the builtin compiler float conversions would cause test failures on platforms where they're currently unavailable or miscompiled), I've instead added tests comparing |
tgross35 commentedApr 25, 2024
Great idea, I can probably do the same on#587. Everything here looks reasonable to my understanding, probably ready for a look from@Amanieu. |
Uh oh!
There was an error while loading.Please reload this page.
76e648a toefd5d7dCompareUh oh!
There was an error while loading.Please reload this page.
| abs_result =(a_abs >> sign_bits_delta).cast(); | ||
| let tmp = src_exp_bias.wrapping_sub(dst_exp_bias) <<R::SIGNIFICAND_BITS; | ||
| abs_result = abs_result.wrapping_sub(tmp.cast()); | ||
| // Cast before shifting to prevent overflow. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
I'm having trouble understand how exactly this helps prevent overflows. Aren't you casting to a smaller size (u16) here instead of operating as a u32?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
@Amanieu This is indeed not an issue for truncation tof16. However, the__trunctfdf2 builtin also implemented in this PR truncates fromf128 tof64, meaningR::Int is au64 andR::SIGNIFICAND_BITS is52.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others.Learn more.
Ah, I missed that. LGTM.
The `weak-intrinsics` feature was removed from compiler_builtins inrust-lang/compiler-builtins#598, so dropped the`compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.Inrust-lang/compiler-builtins#593, somebuiltins for f16/f128 were added. These don't work for all compilerbackends, so add a `compiler-builtins-no-f16-f128` feature and disableit for cranelift and gcc.
The `weak-intrinsics` feature was removed from compiler_builtins inrust-lang/compiler-builtins#598, so dropped the`compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.Inrust-lang/compiler-builtins#593, somebuiltins for f16/f128 were added. These don't work for all compilerbackends, so add a `compiler-builtins-no-f16-f128` feature and disableit for cranelift and gcc.
The `weak-intrinsics` feature was removed from compiler_builtins inrust-lang/compiler-builtins#598, so dropped the`compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.Inrust-lang/compiler-builtins#593, somebuiltins for f16/f128 were added. These don't work for all compilerbackends, so add a `compiler-builtins-no-f16-f128` feature and disableit for cranelift and gcc.
The `weak-intrinsics` feature was removed from compiler_builtins inrust-lang/compiler-builtins#598, so dropped the`compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.Inrust-lang/compiler-builtins#593, somebuiltins for f16/f128 were added. These don't work for all compilerbackends, so add a `compiler-builtins-no-f16-f128` feature and disableit for cranelift and gcc.
Update compiler_builtins to 0.1.112The `weak-intrinsics` feature was removed from compiler_builtins inrust-lang/compiler-builtins#598, so dropped the `compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.Inrust-lang/compiler-builtins#593, some builtins for f16/f128 were added. These don't work for all compiler backends, so add a `compiler-builtins-no-f16-f128` feature and disable it for cranelift and gcc.
The `weak-intrinsics` feature was removed from compiler_builtins inrust-lang/compiler-builtins#598, so dropped the`compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.Inrust-lang/compiler-builtins#593, somebuiltins for f16/f128 were added. These don't work for all compilerbackends, so add a `compiler-builtins-no-f16-f128` feature and disableit for cranelift and gcc.
…iler-errorsUpdate compiler_builtins to 0.1.112The `weak-intrinsics` feature was removed from compiler_builtins inrust-lang/compiler-builtins#598, so dropped the `compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.Inrust-lang/compiler-builtins#593, some builtins for f16/f128 were added. These don't work for all compiler backends, so add a `compiler-builtins-no-f16-f128` feature and disable it for cranelift and gcc.
The `weak-intrinsics` feature was removed from compiler_builtins inrust-lang/compiler-builtins#598, so dropped the`compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.Inrust-lang/compiler-builtins#593, somebuiltins for f16/f128 were added. These don't work for all compilerbackends, so add a `compiler-builtins-no-f16-f128` feature and disableit for cranelift and gcc. Also disable it for LLVM targets that don'tsupport it.
The `weak-intrinsics` feature was removed from compiler_builtins inrust-lang/compiler-builtins#598, so dropped the`compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.Inrust-lang/compiler-builtins#593, somebuiltins for f16/f128 were added. These don't work for all compilerbackends, so add a `compiler-builtins-no-f16-f128` feature and disableit for cranelift and gcc. Also disable it for LLVM targets that don'tsupport it.
The `weak-intrinsics` feature was removed from compiler_builtins inrust-lang/compiler-builtins#598, so dropped the`compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.Inrust-lang/compiler-builtins#593, somebuiltins for f16/f128 were added. These don't work for all compilerbackends, so add a `compiler-builtins-no-f16-f128` feature and disableit for cranelift and gcc. Also disable it for LLVM targets that don'tsupport it.
Update compiler_builtins to 0.1.112The `weak-intrinsics` feature was removed from compiler_builtins inrust-lang/compiler-builtins#598, so dropped the `compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.Inrust-lang/compiler-builtins#593, some builtins for f16/f128 were added. These don't work for all compiler backends, so add a `compiler-builtins-no-f16-f128` feature and disable it for cranelift and gcc.
The `weak-intrinsics` feature was removed from compiler_builtins inrust-lang/compiler-builtins#598, so dropped the`compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.Inrust-lang/compiler-builtins#593, somebuiltins for f16/f128 were added. These don't work for all compilerbackends, so add a `compiler-builtins-no-f16-f128` feature and disableit for cranelift and gcc. Also disable it for LLVM targets that don'tsupport it.
The `weak-intrinsics` feature was removed from compiler_builtins inrust-lang/compiler-builtins#598, so dropped the`compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.Inrust-lang/compiler-builtins#593, somebuiltins for f16/f128 were added. These don't work for all compilerbackends, so add a `compiler-builtins-no-f16-f128` feature and disableit for cranelift and gcc. Also disable it for LLVM targets that don'tsupport it.
Update compiler_builtins to 0.1.112The `weak-intrinsics` feature was removed from compiler_builtins inrust-lang/compiler-builtins#598, so dropped the `compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.Inrust-lang/compiler-builtins#593, some builtins for f16/f128 were added. These don't work for all compiler backends, so add a `compiler-builtins-no-f16-f128` feature and disable it for cranelift and gcc.
…anieuUpdate compiler_builtins to 0.1.113The `weak-intrinsics` feature was removed from compiler_builtins inrust-lang/compiler-builtins#598, so dropped the `compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.Inrust-lang/compiler-builtins#593, some builtins for f16/f128 were added. These don't work for all compiler backends, so add a `compiler-builtins-no-f16-f128` feature and disable it for cranelift and gcc.
…anieuUpdate compiler_builtins to 0.1.113The `weak-intrinsics` feature was removed from compiler_builtins inrust-lang/compiler-builtins#598, so dropped the `compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.Inrust-lang/compiler-builtins#593, some builtins for f16/f128 were added. These don't work for all compiler backends, so add a `compiler-builtins-no-f16-f128` feature and disable it for cranelift and gcc.
The `weak-intrinsics` feature was removed from compiler_builtins inrust-lang/compiler-builtins#598, so dropped the`compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.Inrust-lang/compiler-builtins#593, somebuiltins for f16/f128 were added. These don't work for all compilerbackends, so add a `compiler-builtins-no-f16-f128` feature and disableit for cranelift and gcc. Also disable it for LLVM targets that don'tsupport it.
The `weak-intrinsics` feature was removed from compiler_builtins inrust-lang/compiler-builtins#598, so dropped the`compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.Inrust-lang/compiler-builtins#593, somebuiltins for f16/f128 were added. These don't work for all compilerbackends, so add a `compiler-builtins-no-f16-f128` feature and disableit for cranelift and gcc. Also disable it for LLVM targets that don'tsupport it.
The `weak-intrinsics` feature was removed from compiler_builtins inrust-lang/compiler-builtins#598, so dropped the`compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.Inrust-lang/compiler-builtins#593, somebuiltins for f16/f128 were added. These don't work for all compilerbackends, so add a `compiler-builtins-no-f16-f128` feature and disableit for cranelift and gcc. Also disable it for LLVM targets that don'tsupport it.
…ss35Update compiler_builtins to 0.1.114The `weak-intrinsics` feature was removed from compiler_builtins inrust-lang/compiler-builtins#598, so dropped the `compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.Inrust-lang/compiler-builtins#593, some builtins for f16/f128 were added. These don't work for all compiler backends, so add a `compiler-builtins-no-f16-f128` feature and disable it for cranelift and gcc.
The `weak-intrinsics` feature was removed from compiler_builtins inrust-lang/compiler-builtins#598, so dropped the`compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.Inrust-lang/compiler-builtins#593, somebuiltins for f16/f128 were added. These don't work for all compilerbackends, so add a `compiler-builtins-no-f16-f128` feature and disableit for cranelift and gcc. Also disable it for LLVM targets that don'tsupport it.
Update compiler_builtins to 0.1.114The `weak-intrinsics` feature was removed from compiler_builtins inrust-lang/compiler-builtins#598, so dropped the `compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.Inrust-lang/compiler-builtins#593, some builtins for f16/f128 were added. These don't work for all compiler backends, so add a `compiler-builtins-no-f16-f128` feature and disable it for cranelift and gcc.
The `weak-intrinsics` feature was removed from compiler_builtins inrust-lang/compiler-builtins#598, so dropped the`compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.Inrust-lang/compiler-builtins#593, somebuiltins for f16/f128 were added. These don't work for all compilerbackends, so add a `compiler-builtins-no-f16-f128` feature and disableit for cranelift and gcc. Also disable it for LLVM targets that don'tsupport it.
Update compiler_builtins to 0.1.114The `weak-intrinsics` feature was removed from compiler_builtins inrust-lang/compiler-builtins#598, so dropped the `compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.Inrust-lang/compiler-builtins#593, some builtins for f16/f128 were added. These don't work for all compiler backends, so add a `compiler-builtins-no-f16-f128` feature and disable it for cranelift and gcc.
The `weak-intrinsics` feature was removed from compiler_builtins inrust-lang/compiler-builtins#598, so dropped the`compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.Inrust-lang/compiler-builtins#593, somebuiltins for f16/f128 were added. These don't work for all compilerbackends, so add a `compiler-builtins-no-f16-f128` feature and disableit for cranelift and gcc. Also disable it for LLVM targets that don'tsupport it.
Update compiler_builtins to 0.1.114The `weak-intrinsics` feature was removed from compiler_builtins inrust-lang/compiler-builtins#598, so dropped the `compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.Inrust-lang/compiler-builtins#593, some builtins for f16/f128 were added. These don't work for all compiler backends, so add a `compiler-builtins-no-f16-f128` feature and disable it for cranelift and gcc.
The `weak-intrinsics` feature was removed from compiler_builtins inrust-lang/compiler-builtins#598, so dropped the`compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.Inrust-lang/compiler-builtins#593, somebuiltins for f16/f128 were added. These don't work for all compilerbackends, so add a `compiler-builtins-no-f16-f128` feature and disableit for cranelift and gcc. Also disable it for LLVM targets that don'tsupport it.
Update compiler_builtins to 0.1.114The `weak-intrinsics` feature was removed from compiler_builtins inrust-lang/compiler-builtins#598, so dropped the `compiler-builtins-weak-intrinsics` feature from alloc/std/sysroot.Inrust-lang/compiler-builtins#593, some builtins for f16/f128 were added. These don't work for all compiler backends, so add a `compiler-builtins-no-f16-f128` feature and disable it for cranelift and gcc.
Adds builtins for float conversions to/from
f16/f128, which will solverust-lang/rust#123885. I also updated theREADME.mdto reflect thatf16/f128are being added to Rust.@tgross35 this should save you some work on#587.
I'm not sure if the new functions need the
#[avr_skip]attribute like the existing extend/truncate builtins do, but thought it was better to add it and accidentally cause linker errors if the builtin is needed and not supplied bylibgccrather than not having the attribute and accidentally causing subtle ABI bugs if a special ABI is required on AVR.@Patryk27 who added the original#[avr_skip]s.