Skip to content

Commit

Permalink
Stabilize Wasm relaxed SIMD
Browse files Browse the repository at this point in the history
  • Loading branch information
daxpedda committed Feb 6, 2024
1 parent 7f186d5 commit 7bbd5f7
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 31 deletions.
2 changes: 1 addition & 1 deletion crates/core_arch/src/wasm32/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ mod simd128;
pub use self::simd128::*;

mod relaxed_simd;
#[unstable(feature = "stdarch_wasm_relaxed_simd", issue = "111196")]
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
pub use self::relaxed_simd::*;

mod memory;
Expand Down
60 changes: 30 additions & 30 deletions crates/core_arch/src/wasm32/relaxed_simd.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@ extern "C" {
#[link_name = "llvm.wasm.relaxed.trunc.unsigned.zero"]
fn llvm_relaxed_trunc_unsigned_zero(a: simd::f64x2) -> simd::i32x4;

#[link_name = "llvm.wasm.fma.v4f32"]
#[link_name = "llvm.wasm.relaxed.madd.v4f32"]
fn llvm_f32x4_fma(a: simd::f32x4, b: simd::f32x4, c: simd::f32x4) -> simd::f32x4;
#[link_name = "llvm.wasm.fms.v4f32"]
#[link_name = "llvm.wasm.relaxed.nmadd.v4f32"]
fn llvm_f32x4_fms(a: simd::f32x4, b: simd::f32x4, c: simd::f32x4) -> simd::f32x4;
#[link_name = "llvm.wasm.fma.v2f64"]
#[link_name = "llvm.wasm.relaxed.madd.v2f64"]
fn llvm_f64x2_fma(a: simd::f64x2, b: simd::f64x2, c: simd::f64x2) -> simd::f64x2;
#[link_name = "llvm.wasm.fms.v2f64"]
#[link_name = "llvm.wasm.relaxed.nmadd.v2f64"]
fn llvm_f64x2_fms(a: simd::f64x2, b: simd::f64x2, c: simd::f64x2) -> simd::f64x2;

#[link_name = "llvm.wasm.laneselect.v16i8"]
#[link_name = "llvm.wasm.relaxed.laneselect.v16i8"]
fn llvm_i8x16_laneselect(a: simd::i8x16, b: simd::i8x16, c: simd::i8x16) -> simd::i8x16;
#[link_name = "llvm.wasm.laneselect.v8i16"]
#[link_name = "llvm.wasm.relaxed.laneselect.v8i16"]
fn llvm_i16x8_laneselect(a: simd::i16x8, b: simd::i16x8, c: simd::i16x8) -> simd::i16x8;
#[link_name = "llvm.wasm.laneselect.v4i32"]
#[link_name = "llvm.wasm.relaxed.laneselect.v4i32"]
fn llvm_i32x4_laneselect(a: simd::i32x4, b: simd::i32x4, c: simd::i32x4) -> simd::i32x4;
#[link_name = "llvm.wasm.laneselect.v2i64"]
#[link_name = "llvm.wasm.relaxed.laneselect.v2i64"]
fn llvm_i64x2_laneselect(a: simd::i64x2, b: simd::i64x2, c: simd::i64x2) -> simd::i64x2;

#[link_name = "llvm.wasm.relaxed.min.v4f32"]
Expand All @@ -46,9 +46,9 @@ extern "C" {

#[link_name = "llvm.wasm.relaxed.q15mulr.signed"]
fn llvm_relaxed_q15mulr_signed(a: simd::i16x8, b: simd::i16x8) -> simd::i16x8;
#[link_name = "llvm.wasm.dot.i8x16.i7x16.signed"]
#[link_name = "llvm.wasm.relaxed.dot.i8x16.i7x16.signed"]
fn llvm_i16x8_relaxed_dot_i8x16_i7x16_s(a: simd::i8x16, b: simd::i8x16) -> simd::i16x8;
#[link_name = "llvm.wasm.dot.i8x16.i7x16.add.signed"]
#[link_name = "llvm.wasm.relaxed.dot.i8x16.i7x16.add.signed"]
fn llvm_i32x4_relaxed_dot_i8x16_i7x16_add_s(
a: simd::i8x16,
b: simd::i8x16,
Expand All @@ -68,7 +68,7 @@ extern "C" {
#[cfg_attr(test, assert_instr(i8x16.relaxed_swizzle))]
#[target_feature(enable = "relaxed-simd")]
#[doc(alias("i8x16.relaxed_swizzle"))]
#[unstable(feature = "stdarch_wasm_relaxed_simd", issue = "111196")]
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
pub fn i8x16_relaxed_swizzle(a: v128, s: v128) -> v128 {
unsafe { llvm_relaxed_swizzle(a.as_i8x16(), s.as_i8x16()).v128() }
}
Expand All @@ -82,7 +82,7 @@ pub fn i8x16_relaxed_swizzle(a: v128, s: v128) -> v128 {
#[cfg_attr(test, assert_instr(i32x4.relaxed_trunc_f32x4_s))]
#[target_feature(enable = "relaxed-simd")]
#[doc(alias("i32x4.relaxed_trunc_f32x4_s"))]
#[unstable(feature = "stdarch_wasm_relaxed_simd", issue = "111196")]
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
pub fn i32x4_relaxed_trunc_f32x4(a: v128) -> v128 {
unsafe { llvm_relaxed_trunc_signed(a.as_f32x4()).v128() }
}
Expand All @@ -96,7 +96,7 @@ pub fn i32x4_relaxed_trunc_f32x4(a: v128) -> v128 {
#[cfg_attr(test, assert_instr(i32x4.relaxed_trunc_f32x4_u))]
#[target_feature(enable = "relaxed-simd")]
#[doc(alias("i32x4.relaxed_trunc_f32x4_u"))]
#[unstable(feature = "stdarch_wasm_relaxed_simd", issue = "111196")]
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
pub fn u32x4_relaxed_trunc_f32x4(a: v128) -> v128 {
unsafe { llvm_relaxed_trunc_unsigned(a.as_f32x4()).v128() }
}
Expand All @@ -110,7 +110,7 @@ pub fn u32x4_relaxed_trunc_f32x4(a: v128) -> v128 {
#[cfg_attr(test, assert_instr(i32x4.relaxed_trunc_f64x2_s_zero))]
#[target_feature(enable = "relaxed-simd")]
#[doc(alias("i32x4.relaxed_trunc_f64x2_s_zero"))]
#[unstable(feature = "stdarch_wasm_relaxed_simd", issue = "111196")]
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
pub fn i32x4_relaxed_trunc_f64x2_zero(a: v128) -> v128 {
unsafe { llvm_relaxed_trunc_signed_zero(a.as_f64x2()).v128() }
}
Expand All @@ -124,7 +124,7 @@ pub fn i32x4_relaxed_trunc_f64x2_zero(a: v128) -> v128 {
#[cfg_attr(test, assert_instr(i32x4.relaxed_trunc_f64x2_u_zero))]
#[target_feature(enable = "relaxed-simd")]
#[doc(alias("i32x4.relaxed_trunc_f64x2_u_zero"))]
#[unstable(feature = "stdarch_wasm_relaxed_simd", issue = "111196")]
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
pub fn u32x4_relaxed_trunc_f64x2_zero(a: v128) -> v128 {
unsafe { llvm_relaxed_trunc_unsigned_zero(a.as_f64x2()).v128() }
}
Expand All @@ -134,7 +134,7 @@ pub fn u32x4_relaxed_trunc_f64x2_zero(a: v128) -> v128 {
#[cfg_attr(test, assert_instr(f32x4.relaxed_madd))]
#[target_feature(enable = "relaxed-simd")]
#[doc(alias("f32x4.relaxed_madd"))]
#[unstable(feature = "stdarch_wasm_relaxed_simd", issue = "111196")]
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
pub fn f32x4_relaxed_madd(a: v128, b: v128, c: v128) -> v128 {
unsafe { llvm_f32x4_fma(a.as_f32x4(), b.as_f32x4(), c.as_f32x4()).v128() }
}
Expand All @@ -144,7 +144,7 @@ pub fn f32x4_relaxed_madd(a: v128, b: v128, c: v128) -> v128 {
#[cfg_attr(test, assert_instr(f32x4.relaxed_nmadd))]
#[target_feature(enable = "relaxed-simd")]
#[doc(alias("f32x4.relaxed_nmadd"))]
#[unstable(feature = "stdarch_wasm_relaxed_simd", issue = "111196")]
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
pub fn f32x4_relaxed_nmadd(a: v128, b: v128, c: v128) -> v128 {
unsafe { llvm_f32x4_fms(a.as_f32x4(), b.as_f32x4(), c.as_f32x4()).v128() }
}
Expand All @@ -154,7 +154,7 @@ pub fn f32x4_relaxed_nmadd(a: v128, b: v128, c: v128) -> v128 {
#[cfg_attr(test, assert_instr(f64x2.relaxed_madd))]
#[target_feature(enable = "relaxed-simd")]
#[doc(alias("f64x2.relaxed_madd"))]
#[unstable(feature = "stdarch_wasm_relaxed_simd", issue = "111196")]
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
pub fn f64x2_relaxed_madd(a: v128, b: v128, c: v128) -> v128 {
unsafe { llvm_f64x2_fma(a.as_f64x2(), b.as_f64x2(), c.as_f64x2()).v128() }
}
Expand All @@ -164,7 +164,7 @@ pub fn f64x2_relaxed_madd(a: v128, b: v128, c: v128) -> v128 {
#[cfg_attr(test, assert_instr(f64x2.relaxed_nmadd))]
#[target_feature(enable = "relaxed-simd")]
#[doc(alias("f64x2.relaxed_nmadd"))]
#[unstable(feature = "stdarch_wasm_relaxed_simd", issue = "111196")]
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
pub fn f64x2_relaxed_nmadd(a: v128, b: v128, c: v128) -> v128 {
unsafe { llvm_f64x2_fms(a.as_f64x2(), b.as_f64x2(), c.as_f64x2()).v128() }
}
Expand All @@ -180,7 +180,7 @@ pub fn f64x2_relaxed_nmadd(a: v128, b: v128, c: v128) -> v128 {
#[cfg_attr(test, assert_instr(i8x16.relaxed_laneselect))]
#[target_feature(enable = "relaxed-simd")]
#[doc(alias("i8x16.relaxed_laneselect"))]
#[unstable(feature = "stdarch_wasm_relaxed_simd", issue = "111196")]
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
pub fn i8x16_relaxed_laneselect(a: v128, b: v128, m: v128) -> v128 {
unsafe { llvm_i8x16_laneselect(a.as_i8x16(), b.as_i8x16(), m.as_i8x16()).v128() }
}
Expand All @@ -196,7 +196,7 @@ pub fn i8x16_relaxed_laneselect(a: v128, b: v128, m: v128) -> v128 {
#[cfg_attr(test, assert_instr(i16x8.relaxed_laneselect))]
#[target_feature(enable = "relaxed-simd")]
#[doc(alias("i16x8.relaxed_laneselect"))]
#[unstable(feature = "stdarch_wasm_relaxed_simd", issue = "111196")]
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
pub fn i16x8_relaxed_laneselect(a: v128, b: v128, m: v128) -> v128 {
unsafe { llvm_i16x8_laneselect(a.as_i16x8(), b.as_i16x8(), m.as_i16x8()).v128() }
}
Expand All @@ -212,7 +212,7 @@ pub fn i16x8_relaxed_laneselect(a: v128, b: v128, m: v128) -> v128 {
#[cfg_attr(test, assert_instr(i32x4.relaxed_laneselect))]
#[target_feature(enable = "relaxed-simd")]
#[doc(alias("i32x4.relaxed_laneselect"))]
#[unstable(feature = "stdarch_wasm_relaxed_simd", issue = "111196")]
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
pub fn i32x4_relaxed_laneselect(a: v128, b: v128, m: v128) -> v128 {
unsafe { llvm_i32x4_laneselect(a.as_i32x4(), b.as_i32x4(), m.as_i32x4()).v128() }
}
Expand All @@ -228,7 +228,7 @@ pub fn i32x4_relaxed_laneselect(a: v128, b: v128, m: v128) -> v128 {
#[cfg_attr(test, assert_instr(i64x2.relaxed_laneselect))]
#[target_feature(enable = "relaxed-simd")]
#[doc(alias("i64x2.relaxed_laneselect"))]
#[unstable(feature = "stdarch_wasm_relaxed_simd", issue = "111196")]
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
pub fn i64x2_relaxed_laneselect(a: v128, b: v128, m: v128) -> v128 {
unsafe { llvm_i64x2_laneselect(a.as_i64x2(), b.as_i64x2(), m.as_i64x2()).v128() }
}
Expand All @@ -239,7 +239,7 @@ pub fn i64x2_relaxed_laneselect(a: v128, b: v128, m: v128) -> v128 {
#[cfg_attr(test, assert_instr(f32x4.relaxed_min))]
#[target_feature(enable = "relaxed-simd")]
#[doc(alias("f32x4.relaxed_min"))]
#[unstable(feature = "stdarch_wasm_relaxed_simd", issue = "111196")]
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
pub fn f32x4_relaxed_min(a: v128, b: v128) -> v128 {
unsafe { llvm_f32x4_relaxed_min(a.as_f32x4(), b.as_f32x4()).v128() }
}
Expand All @@ -250,7 +250,7 @@ pub fn f32x4_relaxed_min(a: v128, b: v128) -> v128 {
#[cfg_attr(test, assert_instr(f32x4.relaxed_max))]
#[target_feature(enable = "relaxed-simd")]
#[doc(alias("f32x4.relaxed_max"))]
#[unstable(feature = "stdarch_wasm_relaxed_simd", issue = "111196")]
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
pub fn f32x4_relaxed_max(a: v128, b: v128) -> v128 {
unsafe { llvm_f32x4_relaxed_max(a.as_f32x4(), b.as_f32x4()).v128() }
}
Expand All @@ -261,7 +261,7 @@ pub fn f32x4_relaxed_max(a: v128, b: v128) -> v128 {
#[cfg_attr(test, assert_instr(f64x2.relaxed_min))]
#[target_feature(enable = "relaxed-simd")]
#[doc(alias("f64x2.relaxed_min"))]
#[unstable(feature = "stdarch_wasm_relaxed_simd", issue = "111196")]
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
pub fn f64x2_relaxed_min(a: v128, b: v128) -> v128 {
unsafe { llvm_f64x2_relaxed_min(a.as_f64x2(), b.as_f64x2()).v128() }
}
Expand All @@ -272,7 +272,7 @@ pub fn f64x2_relaxed_min(a: v128, b: v128) -> v128 {
#[cfg_attr(test, assert_instr(f64x2.relaxed_max))]
#[target_feature(enable = "relaxed-simd")]
#[doc(alias("f64x2.relaxed_max"))]
#[unstable(feature = "stdarch_wasm_relaxed_simd", issue = "111196")]
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
pub fn f64x2_relaxed_max(a: v128, b: v128) -> v128 {
unsafe { llvm_f64x2_relaxed_max(a.as_f64x2(), b.as_f64x2()).v128() }
}
Expand All @@ -283,7 +283,7 @@ pub fn f64x2_relaxed_max(a: v128, b: v128) -> v128 {
#[cfg_attr(test, assert_instr(i16x8.relaxed_q15mulr_s))]
#[target_feature(enable = "relaxed-simd")]
#[doc(alias("i16x8.relaxed_q15mulr_s"))]
#[unstable(feature = "stdarch_wasm_relaxed_simd", issue = "111196")]
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
pub fn i16x8_relaxed_q15mulr(a: v128, b: v128) -> v128 {
unsafe { llvm_relaxed_q15mulr_signed(a.as_i16x8(), b.as_i16x8()).v128() }
}
Expand All @@ -303,7 +303,7 @@ pub fn i16x8_relaxed_q15mulr(a: v128, b: v128) -> v128 {
#[cfg_attr(test, assert_instr(i16x8.relaxed_dot_i8x16_i7x16_s))]
#[target_feature(enable = "relaxed-simd")]
#[doc(alias("i16x8.relaxed_dot_i8x16_i7x16_s"))]
#[unstable(feature = "stdarch_wasm_relaxed_simd", issue = "111196")]
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
pub fn i16x8_relaxed_dot_i8x16_i7x16(a: v128, b: v128) -> v128 {
unsafe { llvm_i16x8_relaxed_dot_i8x16_i7x16_s(a.as_i8x16(), b.as_i8x16()).v128() }
}
Expand All @@ -315,7 +315,7 @@ pub fn i16x8_relaxed_dot_i8x16_i7x16(a: v128, b: v128) -> v128 {
#[cfg_attr(test, assert_instr(i32x4.relaxed_dot_i8x16_i7x16_add_s))]
#[target_feature(enable = "relaxed-simd")]
#[doc(alias("i32x4.relaxed_dot_i8x16_i7x16_add_s"))]
#[unstable(feature = "stdarch_wasm_relaxed_simd", issue = "111196")]
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
pub fn i32x4_relaxed_dot_i8x16_i7x16_add(a: v128, b: v128, c: v128) -> v128 {
unsafe {
llvm_i32x4_relaxed_dot_i8x16_i7x16_add_s(a.as_i8x16(), b.as_i8x16(), c.as_i32x4()).v128()
Expand Down

0 comments on commit 7bbd5f7

Please sign in to comment.