|
8 | 8 | // option. This file may not be copied, modified, or distributed |
9 | 9 | // except according to those terms. |
10 | 10 |
|
11 | | -//! SIMD vectors |
| 11 | +//! SIMD vectors. |
| 12 | +//! |
| 13 | +//! These types can be used for accessing basic SIMD operations. Each of them |
| 14 | +//! implements the standard arithmetic operator traits (Add, Sub, Mul, Div, |
| 15 | +//! Rem, Shl, Shr) through compiler magic, rather than explicitly. Currently |
| 16 | +//! comparison operators are not implemented. To use SSE3+, you must enable |
| 17 | +//! the features, like `-C target-feature=sse3,sse4.1,sse4.2`, or a more |
| 18 | +//! specific `target-cpu`. No other SIMD intrinsics or high-level wrappers are |
| 19 | +//! provided beyond this module. |
| 20 | +//! |
| 21 | +//! ```rust |
| 22 | +//! #[allow(experimental)]; |
| 23 | +//! |
| 24 | +//! fn main() { |
| 25 | +//! use std::simd::f32x4; |
| 26 | +//! let a = f32x4(40.0, 41.0, 42.0, 43.0); |
| 27 | +//! let b = f32x4(1.0, 1.1, 3.4, 9.8); |
| 28 | +//! println!("{}", a + b); |
| 29 | +//! } |
| 30 | +//! ``` |
| 31 | +//! |
| 32 | +//! ## Stability Note |
| 33 | +//! |
| 34 | +//! These are all experimental. The inferface may change entirely, without |
| 35 | +//! warning. |
12 | 36 |
|
13 | 37 | #![allow(non_camel_case_types)] |
| 38 | +#![allow(missing_doc)] |
14 | 39 |
|
15 | 40 | #[experimental] |
16 | 41 | #[simd] |
| 42 | +#[deriving(Show)] |
17 | 43 | pub struct i8x16(pub i8, pub i8, pub i8, pub i8, |
18 | 44 | pub i8, pub i8, pub i8, pub i8, |
19 | 45 | pub i8, pub i8, pub i8, pub i8, |
20 | 46 | pub i8, pub i8, pub i8, pub i8); |
21 | 47 |
|
22 | 48 | #[experimental] |
23 | 49 | #[simd] |
| 50 | +#[deriving(Show)] |
24 | 51 | pub struct i16x8(pub i16, pub i16, pub i16, pub i16, |
25 | 52 | pub i16, pub i16, pub i16, pub i16); |
26 | 53 |
|
27 | 54 | #[experimental] |
28 | 55 | #[simd] |
| 56 | +#[deriving(Show)] |
29 | 57 | pub struct i32x4(pub i32, pub i32, pub i32, pub i32); |
30 | 58 |
|
31 | 59 | #[experimental] |
32 | 60 | #[simd] |
| 61 | +#[deriving(Show)] |
33 | 62 | pub struct i64x2(pub i64, pub i64); |
34 | 63 |
|
35 | 64 | #[experimental] |
36 | 65 | #[simd] |
| 66 | +#[deriving(Show)] |
37 | 67 | pub struct u8x16(pub u8, pub u8, pub u8, pub u8, |
38 | 68 | pub u8, pub u8, pub u8, pub u8, |
39 | 69 | pub u8, pub u8, pub u8, pub u8, |
40 | 70 | pub u8, pub u8, pub u8, pub u8); |
41 | 71 |
|
42 | 72 | #[experimental] |
43 | 73 | #[simd] |
| 74 | +#[deriving(Show)] |
44 | 75 | pub struct u16x8(pub u16, pub u16, pub u16, pub u16, |
45 | 76 | pub u16, pub u16, pub u16, pub u16); |
46 | 77 |
|
47 | 78 | #[experimental] |
48 | 79 | #[simd] |
| 80 | +#[deriving(Show)] |
49 | 81 | pub struct u32x4(pub u32, pub u32, pub u32, pub u32); |
50 | 82 |
|
51 | 83 | #[experimental] |
52 | 84 | #[simd] |
| 85 | +#[deriving(Show)] |
53 | 86 | pub struct u64x2(pub u64, pub u64); |
54 | 87 |
|
55 | 88 | #[experimental] |
56 | 89 | #[simd] |
| 90 | +#[deriving(Show)] |
57 | 91 | pub struct f32x4(pub f32, pub f32, pub f32, pub f32); |
58 | 92 |
|
59 | 93 | #[experimental] |
60 | 94 | #[simd] |
| 95 | +#[deriving(Show)] |
61 | 96 | pub struct f64x2(pub f64, pub f64); |
0 commit comments