|
1 |
| -// Copyright 2013 The Rust Project Developers. See the COPYRIGHT |
| 1 | +// Copyright 2014 The Rust Project Developers. See the COPYRIGHT |
2 | 2 | // file at the top-level directory of this distribution and at
|
3 | 3 | // http://rust-lang.org/COPYRIGHT.
|
4 | 4 | //
|
|
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 |
| -#[experimental] |
16 | 40 | #[simd]
|
| 41 | +#[experimental] |
| 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 |
| -#[experimental] |
23 | 48 | #[simd]
|
| 49 | +#[experimental] |
| 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 |
| - |
27 |
| -#[experimental] |
28 | 53 | #[simd]
|
| 54 | +#[experimental] |
| 55 | +#[deriving(Show)] |
29 | 56 | pub struct i32x4(pub i32, pub i32, pub i32, pub i32);
|
30 | 57 |
|
31 |
| -#[experimental] |
32 | 58 | #[simd]
|
| 59 | +#[experimental] |
| 60 | +#[deriving(Show)] |
33 | 61 | pub struct i64x2(pub i64, pub i64);
|
34 | 62 |
|
35 |
| -#[experimental] |
36 | 63 | #[simd]
|
| 64 | +#[experimental] |
| 65 | +#[deriving(Show)] |
37 | 66 | pub struct u8x16(pub u8, pub u8, pub u8, pub u8,
|
38 | 67 | pub u8, pub u8, pub u8, pub u8,
|
39 | 68 | pub u8, pub u8, pub u8, pub u8,
|
40 | 69 | pub u8, pub u8, pub u8, pub u8);
|
41 | 70 |
|
42 |
| -#[experimental] |
43 | 71 | #[simd]
|
| 72 | +#[experimental] |
| 73 | +#[deriving(Show)] |
44 | 74 | pub struct u16x8(pub u16, pub u16, pub u16, pub u16,
|
45 | 75 | pub u16, pub u16, pub u16, pub u16);
|
46 | 76 |
|
47 |
| -#[experimental] |
48 | 77 | #[simd]
|
| 78 | +#[experimental] |
| 79 | +#[deriving(Show)] |
49 | 80 | pub struct u32x4(pub u32, pub u32, pub u32, pub u32);
|
50 | 81 |
|
51 |
| -#[experimental] |
52 | 82 | #[simd]
|
| 83 | +#[experimental] |
| 84 | +#[deriving(Show)] |
53 | 85 | pub struct u64x2(pub u64, pub u64);
|
54 | 86 |
|
55 |
| -#[experimental] |
56 | 87 | #[simd]
|
| 88 | +#[experimental] |
| 89 | +#[deriving(Show)] |
57 | 90 | pub struct f32x4(pub f32, pub f32, pub f32, pub f32);
|
58 | 91 |
|
59 |
| -#[experimental] |
60 | 92 | #[simd]
|
| 93 | +#[experimental] |
| 94 | +#[deriving(Show)] |
61 | 95 | pub struct f64x2(pub f64, pub f64);
|
0 commit comments