Don't compute FnAbi for LLVM intrinsics - #160077
Conversation
|
Some changes occurred to the CTFE machinery These commits modify compiler targets. Some changes occurred to the CTFE / Miri interpreter cc @rust-lang/miri |
|
|
|
I guess this finishes my quest of getting rid of
There is still cleanup that can be done, but at least this wildly wrong combination is gone. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
| fn test_f32x2(a: f32x2); | ||
| fn test_f32x2_arr(a: f32x2); | ||
| fn test_simd(a: Simd<i32, 4>); | ||
| fn test_simd_unaligned(a: Simd<i32, 3>); |
There was a problem hiding this comment.
There is no way to test this specific case anymore it seems. LLVM doesn't accept PackedSimd on intrinsics, extern "unadjusted" requires LLVM intrinsics and any other ABI doesn't pass non-power-of-2 vectors as { [3 x i32] }.
7358ce7 to
eacedff
Compare
|
Looks like compiler-builtins still has some |
ef2938a to
e2873a0
Compare
|
cc @tgross35 |
There was a problem hiding this comment.
interpreter changes mostly LGTM.
compiler-builtins changes will need a review by @tgross35 .
| #[cfg_attr(target_os = "uefi", unadjusted_on_win64)] | ||
| #[cfg(not(all(target_os = "uefi", target_arch = "x86_64")))] | ||
| pub extern "C" fn __floattisf(i: i128) -> f32 { | ||
| int_to_float::signed(i, int_to_float::u128_to_f32_bits) | ||
| } | ||
|
|
||
| #[cfg_attr(target_os = "uefi", unadjusted_on_win64)] | ||
| #[cfg(all(target_os = "uefi", target_arch = "x86_64"))] | ||
| pub extern "C" fn __floattisf(lo: u64, hi: u64) -> f32 { | ||
| int_to_float::signed((i128::from(hi) << 64) | i128::from(lo), int_to_float::u128_to_f32_bits) | ||
| } | ||
|
|
||
| #[cfg(not(all(target_os = "uefi", target_arch = "x86_64")))] | ||
| pub extern "C" fn __floattidf(i: i128) -> f64 { | ||
| int_to_float::signed(i, int_to_float::u128_to_f64_bits) | ||
| } | ||
|
|
||
| #[cfg(all(target_os = "uefi", target_arch = "x86_64"))] | ||
| pub extern "C" fn __floattidf(lo: u64, hi: u64) -> f64 { | ||
| int_to_float::signed((i128::from(hi) << 64) | i128::from(lo), int_to_float::u128_to_f64_bits) | ||
| } |
There was a problem hiding this comment.
Do we even need the special casing anymore? i128 has gone through some ABI changes on Windows and it doesn't look like https://github.com/llvm/llvm-project/blob/41322057c3af16d75e239ec6679c6c2bf7aec157/compiler-rt/lib/builtins/floattisf.c#L28 is doing anything special.
There was a problem hiding this comment.
Yes, they still have different ABIs: https://rust.godbolt.org/z/454nczzdr u128 is passed in xmm0 with extern "C", while u64 + u64 is passed in rdx/rcx just like u128 with extern "unadjusted": https://rust.godbolt.org/z/av1f38KrW
Co-authored-by: Ralf Jung <post@ralfj.de>
|
@rustbot author |
This comment has been minimized.
This comment has been minimized.
d2588c6 to
a457bee
Compare
|
@rustbot ready |
|
r=me on the Miri part and the test. |
|
|
View all comments
They don't have a sensible FnAbi, so the fact that we still compute an FnAbi for them requires us to make the ABI sanity check more lenient than it should be.
r? @RalfJung as all non-trivial changes are in Miri