Change:
<ins> //@ build-pass //@ compile-flags: -Copt-level=3 //@ only-x86_64 // ignore-tidy-linelength // regression test for https://github.com/rust-lang/rust/issues/110707 // in --release we were optimizing to invalid bitcasts, due to a combination of MIR inlining and // mostly bad repr(simd) lowering which prevented even basic splats from working #![crate_type = "rlib"] #![feature(portable_simd)] use std::simd::*; use std::arch::x86_64::*; #[target_feature(enable = "sse4.1")] pub unsafe fn fast_round_sse(i: f32x8) -> f32x8 { let a = i.to_array(); let [low, high]: [[f32; 4]; 2] = unsafe { std::mem::transmute::<[f32; 8], [[f32; 4]; 2]>(a) }; let low = f32x4::from(_mm_round_ps::<{_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC}>(f32x4::from_array(low).into())); let high = f32x4::from(_mm_round_ps::<{_MM_FROUND_TO_NEAREST_INT | _MM_FROUND_NO_EXC}>(f32x4::from_array(high).into())); let a: [f32; 8] = unsafe { std::mem::transmute::<[[f32; 4]; 2], [f32; 8]>([low.to_array(), high.to_array()]) }; f32x8::from_array(a) } </ins>

Discussion:
<!-- Thank you for filing a bug report! Please provide a short summary of the bug, along with any information you feel relevant to replicating the bug. --I updated some benchmark code using portable simd to a current nightly (which included the llvm version bump from 15 to 16) and ran into the compiler getting killed with SIGILL, or when trying to simplify the code, an LLVM error about an invalid bitcast. It is likely that the problem is inside llvm itself, but so far I was not able to reduce the code to a minimal LLVM IR example. The initial problematic code involved : I could later reproduce it also with casting masks between bitmask, and : In compiler explorer, with arguments the output is the following: Compiling the same function, with an function in the rust playground (in release mode) leads to the compiler receiving a SIGILL <!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --:
Duplicate of
Not sure if this should be a separate issue, but I've also encountered the error with the trait: Using instead works
Resolved on latest nightlies. Needs a regression test.

<!-- Thank you for finding an Internal Compiler Error! If possible, try to provide a minimal verifiable example. You can read "Rust Bug Minimization Patterns" for how to create smaller examples. --Compiling the following in release on the recent nightlies causes a crash. Note that compiling in debug succeeds. <!-- If you're using the stable version of the compiler, you should also check if the bug also exists in the beta or nightly versions. --: If the function is uncommented, rustc instead crashes with an illegal instruction searched nightlies: from nightly-2023-04-17 to nightly-2023-04-23 regressed nightly: nightly-2023-04-18 searched commit range: regressed commit: <details<summarybisected with <a href=''cargo-bisect-rustc</av0.6.6</summaryHost triple: x8664-unknown-linux-gnu Reproduce with: </details
This bisects to a MIR inlining PR, but the actual bug here is related to lowering of . It's possible to write code that gets lowered to invalid LLVM IR without MIR inlining, but the code required is rather contrived. This has been extensively discussed on the Zulip: https://rust- I'm surprised nobody else opened an issue for this. Thanks!