2021-03-02 08:41:41 +00:00
|
|
|
//@ run-pass
|
2018-03-16 18:42:42 +00:00
|
|
|
//@ ignore-emscripten FIXME(#45351)
|
|
|
|
|
2024-02-23 17:36:24 +00:00
|
|
|
#![feature(repr_simd, intrinsics)]
|
2017-07-25 02:31:59 +00:00
|
|
|
|
|
|
|
#[repr(simd)]
|
|
|
|
#[derive(Copy, Clone, Debug)]
|
2024-08-22 08:28:20 +00:00
|
|
|
pub struct Char3(pub [i8; 3]);
|
2017-07-25 02:31:59 +00:00
|
|
|
|
|
|
|
#[repr(simd)]
|
|
|
|
#[derive(Copy, Clone, Debug)]
|
2024-08-22 08:28:20 +00:00
|
|
|
pub struct Short3(pub [i16; 3]);
|
2017-07-25 02:31:59 +00:00
|
|
|
|
2024-02-23 17:36:24 +00:00
|
|
|
extern "rust-intrinsic" {
|
2017-07-25 02:31:59 +00:00
|
|
|
fn simd_cast<T, U>(x: T) -> U;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
2024-08-22 08:28:20 +00:00
|
|
|
let cast: Short3 = unsafe { simd_cast(Char3([10, -3, -9])) };
|
2017-07-25 02:31:59 +00:00
|
|
|
|
|
|
|
println!("{:?}", cast);
|
|
|
|
}
|