Skip to content

Commit 06243d5

Browse files
alexcrichtongnzlbg
authored andcommitted
Add wasm intrinsics to documentation
1 parent 20dc114 commit 06243d5

File tree

2 files changed

+29
-3
lines changed

2 files changed

+29
-3
lines changed

coresimd/mod.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ mod simd;
2626
/// * [`PowerPC`]
2727
/// * [`PowerPC64`]
2828
/// * [`NVPTX`]
29+
/// * [`wasm32`]
2930
///
3031
/// [`x86`]: https://rust-lang-nursery.github.io/stdsimd/x86/stdsimd/arch/index.html
3132
/// [`x86_64`]: https://rust-lang-nursery.github.io/stdsimd/x86_64/stdsimd/arch/index.html
@@ -36,6 +37,7 @@ mod simd;
3637
/// [`PowerPC`]: https://rust-lang-nursery.github.io/stdsimd/powerpc/stdsimd/arch/index.html
3738
/// [`PowerPC64`]: https://rust-lang-nursery.github.io/stdsimd/powerpc64/stdsimd/arch/index.html
3839
/// [`NVPTX`]: https://rust-lang-nursery.github.io/stdsimd/nvptx/stdsimd/arch/index.html
40+
/// [`wasm32`]: https://rust-lang-nursery.github.io/stdsimd/wasm32/stdsimd/arch/index.html
3941
#[stable(feature = "simd_arch", since = "1.27.0")]
4042
pub mod arch {
4143
/// Platform-specific intrinsics for the `x86` platform.
@@ -86,6 +88,7 @@ pub mod arch {
8688
/// Platform-specific intrinsics for the `wasm32` platform.
8789
///
8890
/// See the [module documentation](../index.html) for more details.
91+
#[cfg(any(target_arch = "wasm32", dox))]
8992
#[cfg(target_arch = "wasm32")]
9093
#[unstable(feature = "stdsimd", issue = "27731")]
9194
pub mod wasm32 {
@@ -131,7 +134,7 @@ pub mod arch {
131134
pub mod powerpc64 {
132135
pub use coresimd::powerpc64::*;
133136
}
134-
137+
135138
/// Platform-specific intrinsics for the `NVPTX` platform.
136139
///
137140
/// See the [module documentation](../index.html) for more details.
@@ -158,7 +161,9 @@ mod aarch64;
158161
#[cfg(any(target_arch = "arm", target_arch = "aarch64", dox))]
159162
#[doc(cfg(any(target_arch = "arm", target_arch = "aarch64")))]
160163
mod arm;
161-
#[cfg(target_arch = "wasm32")]
164+
165+
#[cfg(any(target_arch = "wasm32", dox))]
166+
#[doc(cfg(target_arch = "wasm32"))]
162167
mod wasm32;
163168

164169
#[cfg(any(target_arch = "mips", target_arch = "mips64", dox))]

coresimd/wasm32/atomic.rs

Lines changed: 22 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
//!
77
//! [spec]: https://github.com/WebAssembly/threads
88
9-
#![cfg(target_feature = "atomics")]
9+
#![cfg(any(target_feature = "atomics", dox))]
1010

1111
#[cfg(test)]
1212
use stdsimd_test::assert_instr;
@@ -43,6 +43,13 @@ extern "C" {
4343
/// didn't block
4444
/// * 2 - the thread blocked, but the timeout expired.
4545
///
46+
/// # Availability
47+
///
48+
/// This intrinsic is only available **when the standard library itself is
49+
/// compiled with the `atomics` target feature**. This version of the standard
50+
/// library is not obtainable via `rustup`, but rather will require the standard
51+
/// library to be compiled from source.
52+
///
4653
/// [instr]: https://github.com/WebAssembly/threads/blob/master/proposals/threads/Overview.md#wait
4754
#[inline]
4855
#[cfg_attr(test, assert_instr("i32.atomic.wait"))]
@@ -71,6 +78,13 @@ pub unsafe fn wait_i32(ptr: *mut i32, expression: i32, timeout_ns: i64) -> i32 {
7178
/// didn't block
7279
/// * 2 - the thread blocked, but the timeout expired.
7380
///
81+
/// # Availability
82+
///
83+
/// This intrinsic is only available **when the standard library itself is
84+
/// compiled with the `atomics` target feature**. This version of the standard
85+
/// library is not obtainable via `rustup`, but rather will require the standard
86+
/// library to be compiled from source.
87+
///
7488
/// [instr]: https://github.com/WebAssembly/threads/blob/master/proposals/threads/Overview.md#wait
7589
#[inline]
7690
#[cfg_attr(test, assert_instr("i64.atomic.wait"))]
@@ -92,6 +106,13 @@ pub unsafe fn wait_i64(ptr: *mut i64, expression: i64, timeout_ns: i64) -> i32 {
92106
///
93107
/// Returns the number of waiters which were actually woken up.
94108
///
109+
/// # Availability
110+
///
111+
/// This intrinsic is only available **when the standard library itself is
112+
/// compiled with the `atomics` target feature**. This version of the standard
113+
/// library is not obtainable via `rustup`, but rather will require the standard
114+
/// library to be compiled from source.
115+
///
95116
/// [instr]: https://github.com/WebAssembly/threads/blob/master/proposals/threads/Overview.md#wake
96117
#[inline]
97118
#[cfg_attr(test, assert_instr("atomic.wake"))]

0 commit comments

Comments
 (0)