summaryrefslogtreecommitdiffstats
path: root/tests/ui/simd/intrinsic/generic-bswap-byte.rs
blob: 13fc942c25a35b1335eb36839793f59aea765ff9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
// run-pass
#![feature(repr_simd, platform_intrinsics)]
#![allow(non_camel_case_types)]

#[repr(simd)]
#[derive(Copy, Clone)]
struct i8x4([i8; 4]);

#[repr(simd)]
#[derive(Copy, Clone)]
struct u8x4([u8; 4]);

extern "platform-intrinsic" {
    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]);
    }
}