2024-02-16 20:02:50 +00:00
|
|
|
//@ run-pass
|
|
|
|
//@ ignore-emscripten FIXME(#45351)
|
2018-03-16 18:42:42 +00:00
|
|
|
|
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)]
|
2019-12-31 20:25:16 +00:00
|
|
|
pub struct Char3(pub i8, pub i8, pub i8);
|
2017-07-25 02:31:59 +00:00
|
|
|
|
|
|
|
#[repr(simd)]
|
|
|
|
#[derive(Copy, Clone, Debug)]
|
2019-12-31 20:25:16 +00:00
|
|
|
pub struct Short3(pub i16, pub i16, pub i16);
|
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() {
|
2019-12-31 20:25:16 +00:00
|
|
|
let cast: Short3 = unsafe { simd_cast(Char3(10, -3, -9)) };
|
2017-07-25 02:31:59 +00:00
|
|
|
|
|
|
|
println!("{:?}", cast);
|
|
|
|
}
|