Files
rust/tests/ui/simd/issue-105439.rs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

23 lines
598 B
Rust
Raw Normal View History

2023-05-05 14:58:52 -07:00
//@ run-pass
//@ compile-flags: -O -Zverify-llvm-ir
2022-12-12 15:52:02 -08:00
#![feature(repr_simd, core_intrinsics)]
2022-12-12 15:52:02 -08:00
#[allow(non_camel_case_types)]
#[derive(Clone, Copy)]
#[repr(simd)]
2023-05-05 14:58:52 -07:00
struct i32x4([i32; 4]);
#[inline(always)]
fn to_array(a: i32x4) -> [i32; 4] {
// This was originally just `a.0`, but that ended up being annoying enough
// that it was banned by <https://github.com/rust-lang/compiler-team/issues/838>
unsafe { std::mem::transmute(a) }
2023-05-05 14:58:52 -07:00
}
2022-12-12 15:52:02 -08:00
2023-05-05 14:58:52 -07:00
fn main() {
let a = i32x4([1, 2, 3, 4]);
let b = unsafe { std::intrinsics::simd::simd_add(a, a) };
2023-05-05 14:58:52 -07:00
assert_eq!(to_array(b), [2, 4, 6, 8]);
2022-12-11 19:21:51 -08:00
}