Skip to content

Commit 1e8e134

Browse files
committed
add wasm64 support
1 parent 15babf5 commit 1e8e134

File tree

7 files changed

+32
-19
lines changed

7 files changed

+32
-19
lines changed

crates/core_arch/src/core_arch_docs.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -191,6 +191,7 @@ others at:
191191
* [`powerpc64`]
192192
* [`nvptx`]
193193
* [`wasm32`]
194+
* [`wasm64`]
194195

195196
[`x86`]: x86/index.html
196197
[`x86_64`]: x86_64/index.html
@@ -201,7 +202,8 @@ others at:
201202
[`powerpc`]: powerpc/index.html
202203
[`powerpc64`]: powerpc64/index.html
203204
[`nvptx`]: nvptx/index.html
204-
[`wasm32`]: wasm32/index.html
205+
[`wasm32`]: wasm/index.html
206+
[`wasm64`]: wasm/index.html
205207

206208
# Examples
207209

crates/core_arch/src/lib.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@
3939
extended_key_value_attributes
4040
)]
4141
#![cfg_attr(test, feature(test, abi_vectorcall))]
42-
#![cfg_attr(all(test, target_arch = "wasm32"), feature(wasm_simd))]
42+
#![cfg_attr(all(test, wasm), feature(wasm_simd))]
4343
#![deny(clippy::missing_inline_in_public_items)]
4444
#![allow(
4545
clippy::inline_always,

crates/core_arch/src/mod.rs

Lines changed: 22 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,17 @@ pub mod arch {
5858

5959
/// Platform-specific intrinsics for the `wasm32` platform.
6060
///
61+
/// See the [module documentation](../index.html) for more details.
62+
#[cfg(any(target_arch = "wasm32", doc))]
63+
#[doc(cfg(target_arch = "wasm32"))]
64+
#[stable(feature = "simd_wasm32", since = "1.33.0")]
65+
pub mod wasm32 {
66+
#[stable(feature = "simd_wasm32", since = "1.33.0")]
67+
pub use crate::core_arch::wasm::*;
68+
}
69+
70+
/// Platform-specific intrinsics for `wasm32` and `wasm64` platforms.
71+
///
6172
/// This module provides intrinsics specific to the WebAssembly
6273
/// architecture. Here you'll find intrinsics specific to WebAssembly that
6374
/// aren't otherwise surfaced somewhere in a cross-platform abstraction of
@@ -120,10 +131,10 @@ pub mod arch {
120131
/// example. You'd write a function such as:
121132
///
122133
/// ```rust,ignore
123-
/// #[cfg(target_arch = "wasm32")]
134+
/// #[cfg(wasm)]
124135
/// #[target_feature(enable = "simd128")]
125136
/// unsafe fn uses_simd() {
126-
/// use std::arch::wasm32::*;
137+
/// use std::arch::wasm::*;
127138
/// // ...
128139
/// }
129140
/// ```
@@ -163,12 +174,12 @@ pub mod arch {
163174
/// generated in your program. This means to generate a binary without SIMD
164175
/// you'll need to avoid both options above plus calling into any intrinsics
165176
/// in this module.
166-
#[cfg(any(target_arch = "wasm32", doc))]
167-
#[doc(cfg(target_arch = "wasm32"))]
168-
#[stable(feature = "simd_wasm32", since = "1.33.0")]
169-
pub mod wasm32 {
170-
#[stable(feature = "simd_wasm32", since = "1.33.0")]
171-
pub use crate::core_arch::wasm32::*;
177+
#[cfg(any(wasm, doc))]
178+
#[doc(cfg(wasm))]
179+
#[stable(feature = "", since = "0.0.0")]
180+
pub mod wasm {
181+
#[stable(feature = "", since = "0.0.0")]
182+
pub use crate::core_arch::wasm::*;
172183
}
173184

174185
/// Platform-specific intrinsics for the `mips` platform.
@@ -238,9 +249,9 @@ mod aarch64;
238249
#[doc(cfg(any(target_arch = "arm", target_arch = "aarch64")))]
239250
mod arm;
240251

241-
#[cfg(any(target_arch = "wasm32", doc))]
242-
#[doc(cfg(target_arch = "wasm32"))]
243-
mod wasm32;
252+
#[cfg(any(wasm, doc))]
253+
#[doc(cfg(wasm))]
254+
mod wasm;
244255

245256
#[cfg(any(target_arch = "mips", target_arch = "mips64", doc))]
246257
#[doc(cfg(any(target_arch = "mips", target_arch = "mips64")))]

crates/core_arch/src/wasm32/memory.rs renamed to crates/core_arch/src/wasm/memory.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
use stdarch_test::assert_instr;
33

44
extern "C" {
5-
#[link_name = "llvm.wasm.memory.grow.i32"]
6-
fn llvm_memory_grow(mem: u32, pages: i32) -> i32;
7-
#[link_name = "llvm.wasm.memory.size.i32"]
8-
fn llvm_memory_size(mem: u32) -> i32;
5+
#[link_name = "llvm.wasm.memory.grow"]
6+
fn llvm_memory_grow(mem: u32, pages: isize) -> isize;
7+
#[link_name = "llvm.wasm.memory.size"]
8+
fn llvm_memory_size(mem: u32) -> isize;
99
}
1010

1111
/// Corresponding intrinsic to wasm's [`memory.size` instruction][instr]
@@ -51,6 +51,6 @@ pub fn memory_size<const MEM: u32>() -> usize {
5151
pub fn memory_grow<const MEM: u32>(delta: usize) -> usize {
5252
unsafe {
5353
static_assert!(MEM: u32 where MEM == 0);
54-
llvm_memory_grow(MEM, delta as i32) as isize as usize
54+
llvm_memory_grow(MEM, delta as isize) as usize
5555
}
5656
}

crates/core_arch/src/wasm32/mod.rs renamed to crates/core_arch/src/wasm/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//! WASM32 intrinsics
1+
//! WebAssembly intrinsics
22
33
#[cfg(test)]
44
use stdarch_test::assert_instr;

0 commit comments

Comments
 (0)