-
Notifications
You must be signed in to change notification settings - Fork 12.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
wasm: Make simd types passed via indirection again
This commit updates wasm target specs to use `simd_types_indirect: true` again. Long ago this was added since wasm simd types were always translated to `v128` under-the-hood in LLVM, meaning that it didn't matter whether that target feature was enabled or not. Now, however, `v128` is conditionally used in codegen depending on target features enabled, meaning that it's possible to get linker errors about different signatures in code that correctly uses simd types. The fix is the same as for all other platforms, which is to pass the type indirectly.
- Loading branch information
1 parent
835150e
commit 55769a5
Showing
2 changed files
with
33 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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() {} |