Skip to content

Commit ddec001

Browse files
committed
Move simd out of unstable
It's still marked experimental. Also add documentation.
1 parent bbd034c commit ddec001

File tree

6 files changed

+53
-17
lines changed

6 files changed

+53
-17
lines changed

src/libstd/lib.rs

+2
Original file line numberDiff line numberDiff line change
@@ -238,6 +238,8 @@ pub mod io;
238238
pub mod path;
239239
pub mod fmt;
240240
pub mod cleanup;
241+
#[experimental]
242+
pub mod simd;
241243

242244
/* Unsupported interfaces */
243245

Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
1+
// Copyright 2014 The Rust Project Developers. See the COPYRIGHT
22
// file at the top-level directory of this distribution and at
33
// http://rust-lang.org/COPYRIGHT.
44
//
@@ -8,54 +8,88 @@
88
// option. This file may not be copied, modified, or distributed
99
// except according to those terms.
1010

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.
1236
1337
#![allow(non_camel_case_types)]
38+
#![allow(missing_doc)]
1439

15-
#[experimental]
1640
#[simd]
41+
#[experimental]
42+
#[deriving(Show)]
1743
pub struct i8x16(pub i8, pub i8, pub i8, pub i8,
1844
pub i8, pub i8, pub i8, pub i8,
1945
pub i8, pub i8, pub i8, pub i8,
2046
pub i8, pub i8, pub i8, pub i8);
2147

22-
#[experimental]
2348
#[simd]
49+
#[experimental]
50+
#[deriving(Show)]
2451
pub struct i16x8(pub i16, pub i16, pub i16, pub i16,
2552
pub i16, pub i16, pub i16, pub i16);
26-
27-
#[experimental]
2853
#[simd]
54+
#[experimental]
55+
#[deriving(Show)]
2956
pub struct i32x4(pub i32, pub i32, pub i32, pub i32);
3057

31-
#[experimental]
3258
#[simd]
59+
#[experimental]
60+
#[deriving(Show)]
3361
pub struct i64x2(pub i64, pub i64);
3462

35-
#[experimental]
3663
#[simd]
64+
#[experimental]
65+
#[deriving(Show)]
3766
pub struct u8x16(pub u8, pub u8, pub u8, pub u8,
3867
pub u8, pub u8, pub u8, pub u8,
3968
pub u8, pub u8, pub u8, pub u8,
4069
pub u8, pub u8, pub u8, pub u8);
4170

42-
#[experimental]
4371
#[simd]
72+
#[experimental]
73+
#[deriving(Show)]
4474
pub struct u16x8(pub u16, pub u16, pub u16, pub u16,
4575
pub u16, pub u16, pub u16, pub u16);
4676

47-
#[experimental]
4877
#[simd]
78+
#[experimental]
79+
#[deriving(Show)]
4980
pub struct u32x4(pub u32, pub u32, pub u32, pub u32);
5081

51-
#[experimental]
5282
#[simd]
83+
#[experimental]
84+
#[deriving(Show)]
5385
pub struct u64x2(pub u64, pub u64);
5486

55-
#[experimental]
5687
#[simd]
88+
#[experimental]
89+
#[deriving(Show)]
5790
pub struct f32x4(pub f32, pub f32, pub f32, pub f32);
5891

59-
#[experimental]
6092
#[simd]
93+
#[experimental]
94+
#[deriving(Show)]
6195
pub struct f64x2(pub f64, pub f64);

src/libstd/unstable/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ pub use core::finally;
1616

1717
pub mod dynamic_lib;
1818

19-
pub mod simd;
19+
pub mod finally;
2020
pub mod sync;
2121
pub mod mutex;
2222

src/test/compile-fail/simd-experimental.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#![deny(experimental)]
1212

13-
use std::unstable::simd;
13+
use std::simd;
1414

1515
fn main() {
1616
let _ = simd::i64x2(0, 0); //~ ERROR: experimental

src/test/run-pass/simd-binop.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
#![allow(experimental)]
1212

13-
use std::unstable::simd::{i32x4, f32x4, u32x4};
13+
use std::simd::{i32x4, f32x4, u32x4};
1414

1515
fn eq_u32x4(u32x4(x0, x1, x2, x3): u32x4, u32x4(y0, y1, y2, y3): u32x4) -> bool {
1616
(x0 == y0) && (x1 == y1) && (x2 == y2) && (x3 == y3)

src/test/run-pass/simd-issue-10604.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -13,5 +13,5 @@
1313
#![feature(simd)]
1414

1515
pub fn main() {
16-
let _o = None::<std::unstable::simd::i32x4>;
16+
let _o = None::<std::simd::i32x4>;
1717
}

0 commit comments

Comments
 (0)