diff --git a/tests/ui/simd/issue-105439.rs b/tests/ui/simd/issue-105439.rs index f3291f1bffeab..35ca76e989b91 100644 --- a/tests/ui/simd/issue-105439.rs +++ b/tests/ui/simd/issue-105439.rs @@ -1,6 +1,5 @@ -// build-pass - -#![crate_type = "lib"] +// run-pass +// compile-flags: -O -Zverify-llvm-ir #![feature(repr_simd)] #![feature(platform_intrinsics)] @@ -8,9 +7,19 @@ #[allow(non_camel_case_types)] #[derive(Clone, Copy)] #[repr(simd)] -pub struct i32x4([i32; 4]); +struct i32x4([i32; 4]); + +extern "platform-intrinsic" { + pub(crate) fn simd_add(x: T, y: T) -> T; +} + +#[inline(always)] +fn to_array(a: i32x4) -> [i32; 4] { + a.0 +} -pub fn f(a: i32x4) -> [i32; 4] { - let b = a; - b.0 +fn main() { + let a = i32x4([1, 2, 3, 4]); + let b = unsafe { simd_add(a, a) }; + assert_eq!(to_array(b), [2, 4, 6, 8]); }