]> git.lizzy.rs Git - rust.git/blob - src/test/run-pass/simd-size-align.rs
rustdoc: Replace no-pretty-expanded with pretty-expanded
[rust.git] / src / test / run-pass / simd-size-align.rs
1 // Copyright 2015 The Rust Project Developers. See the COPYRIGHT
2 // file at the top-level directory of this distribution and at
3 // http://rust-lang.org/COPYRIGHT.
4 //
5 // Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
6 // http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
7 // <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
8 // option. This file may not be copied, modified, or distributed
9 // except according to those terms.
10
11 // pretty-expanded FIXME #23616
12
13 #![feature(simd)]
14 #![allow(non_camel_case_types)]
15
16 use std::mem;
17
18 /// `T` should satisfy `size_of T (mod min_align_of T) === 0` to be stored at `Vec<T>` properly
19 /// Please consult the issue #20460
20 fn check<T>() {
21     assert_eq!(mem::size_of::<T>() % mem::min_align_of::<T>(), 0)
22 }
23
24 fn main() {
25     check::<u8x2>();
26     check::<u8x3>();
27     check::<u8x4>();
28     check::<u8x5>();
29     check::<u8x6>();
30     check::<u8x7>();
31     check::<u8x8>();
32
33     check::<i16x2>();
34     check::<i16x3>();
35     check::<i16x4>();
36     check::<i16x5>();
37     check::<i16x6>();
38     check::<i16x7>();
39     check::<i16x8>();
40
41     check::<f32x2>();
42     check::<f32x3>();
43     check::<f32x4>();
44     check::<f32x5>();
45     check::<f32x6>();
46     check::<f32x7>();
47     check::<f32x8>();
48 }
49
50 #[simd] struct u8x2(u8, u8);
51 #[simd] struct u8x3(u8, u8, u8);
52 #[simd] struct u8x4(u8, u8, u8, u8);
53 #[simd] struct u8x5(u8, u8, u8, u8, u8);
54 #[simd] struct u8x6(u8, u8, u8, u8, u8, u8);
55 #[simd] struct u8x7(u8, u8, u8, u8, u8, u8, u8);
56 #[simd] struct u8x8(u8, u8, u8, u8, u8, u8, u8, u8);
57
58 #[simd] struct i16x2(i16, i16);
59 #[simd] struct i16x3(i16, i16, i16);
60 #[simd] struct i16x4(i16, i16, i16, i16);
61 #[simd] struct i16x5(i16, i16, i16, i16, i16);
62 #[simd] struct i16x6(i16, i16, i16, i16, i16, i16);
63 #[simd] struct i16x7(i16, i16, i16, i16, i16, i16, i16);
64 #[simd] struct i16x8(i16, i16, i16, i16, i16, i16, i16, i16);
65
66 #[simd] struct f32x2(f32, f32);
67 #[simd] struct f32x3(f32, f32, f32);
68 #[simd] struct f32x4(f32, f32, f32, f32);
69 #[simd] struct f32x5(f32, f32, f32, f32, f32);
70 #[simd] struct f32x6(f32, f32, f32, f32, f32, f32);
71 #[simd] struct f32x7(f32, f32, f32, f32, f32, f32, f32);
72 #[simd] struct f32x8(f32, f32, f32, f32, f32, f32, f32, f32);