Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 0 additions & 6 deletions compiler/rustc_target/src/spec/wasm_base.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,12 +103,6 @@ pub fn options() -> TargetOptions {
linker: Some("rust-lld".to_owned()),
lld_flavor: LldFlavor::Wasm,

// No need for indirection here, simd types can always be passed by
// value as the whole module either has simd or not, which is different
// from x86 (for example) where programs can have functions that don't
// enable simd features.
simd_types_indirect: false,

pre_link_args,

crt_objects_fallback: Some(CrtObjectsFallback::Wasm),
Expand Down
33 changes: 33 additions & 0 deletions src/test/ui/simd/wasm-simd-indirect.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
// build-pass

#![cfg_attr(target_arch = "wasm32", feature(wasm_simd, wasm_target_feature))]

#[cfg(target_arch = "wasm32")]
fn main() {
unsafe {
a::api_with_simd_feature();
}
}

#[cfg(target_arch = "wasm32")]
mod a {
use std::arch::wasm32::*;

#[target_feature(enable = "simd128")]
pub unsafe fn api_with_simd_feature() {
crate::b::api_takes_v128(u64x2(0, 1));
}
}

#[cfg(target_arch = "wasm32")]
mod b {
use std::arch::wasm32::*;

#[inline(never)]
pub fn api_takes_v128(a: v128) -> v128 {
a
}
}

#[cfg(not(target_arch = "wasm32"))]
fn main() {}