2023-07-30 14:40:32 -05:00
|
|
|
//@ run-pass
|
2024-02-23 11:36:24 -06:00
|
|
|
#![feature(repr_simd, intrinsics)]
|
2023-07-30 14:40:32 -05:00
|
|
|
#![allow(non_camel_case_types)]
|
|
|
|
|
|
|
|
#[repr(simd)]
|
|
|
|
#[derive(Copy, Clone)]
|
|
|
|
struct i8x4([i8; 4]);
|
|
|
|
|
|
|
|
#[repr(simd)]
|
|
|
|
#[derive(Copy, Clone)]
|
|
|
|
struct u8x4([u8; 4]);
|
|
|
|
|
2024-02-23 11:36:24 -06:00
|
|
|
extern "rust-intrinsic" {
|
2023-07-30 14:40:32 -05:00
|
|
|
fn simd_bswap<T>(x: T) -> T;
|
|
|
|
}
|
|
|
|
|
|
|
|
fn main() {
|
|
|
|
unsafe {
|
|
|
|
assert_eq!(simd_bswap(i8x4([0, 1, 2, 3])).0, [0, 1, 2, 3]);
|
|
|
|
assert_eq!(simd_bswap(u8x4([0, 1, 2, 3])).0, [0, 1, 2, 3]);
|
|
|
|
}
|
|
|
|
}
|