Skip to content

Commit f596e24

Browse files
committed
enable assert_instr on splat operations
1 parent 366fe55 commit f596e24

File tree

2 files changed

+10
-9
lines changed

2 files changed

+10
-9
lines changed

coresimd/wasm32/simd128.rs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -114,13 +114,13 @@ mod sealed {
114114
// Macros implementing the spec APIs:
115115

116116
macro_rules! impl_splat {
117-
($id:ident[$ivec_ty:ident : $elem_ty:ident] <= $x_ty:ident | $($lane_id:ident),*) => {
117+
($id:ident[$ivec_ty:ident : $elem_ty:ident => $instr:tt] <= $x_ty:ident | $($lane_id:ident),*) => {
118118
/// Create vector with identical lanes
119119
///
120120
/// Construct a vector with `x` replicated to all lanes.
121121
#[inline]
122-
// #[target_feature(enable = "simd128")]
123-
// FIXME: #[cfg_attr(test, assert_instr($ident.splat))]
122+
#[target_feature(enable = "simd128")]
123+
#[cfg_attr(test, assert_instr($instr))]
124124
pub const unsafe fn splat(x: $x_ty) -> v128 {
125125
union U {
126126
vec: self::sealed::$ivec_ty,
@@ -735,7 +735,7 @@ macro_rules! v8x16_shuffle {
735735
pub mod i8x16 {
736736
use super::*;
737737
impl_splat!(
738-
i8x16[v8x16: i8] <= i32 | x0,
738+
i8x16[v8x16: i8 => "i8x16.splat"] <= i32 | x0,
739739
x1,
740740
x2,
741741
x3,
@@ -765,7 +765,7 @@ pub mod i8x16 {
765765
/// WASM-specific v16x8 instructions with modulo-arithmetic semantics
766766
pub mod i16x8 {
767767
use super::*;
768-
impl_splat!(i16x8[v16x8: i16] <= i32 | x0, x1, x2, x3, x4, x5, x6, x7);
768+
impl_splat!(i16x8[v16x8: i16 => "i16x8.splat"] <= i32 | x0, x1, x2, x3, x4, x5, x6, x7);
769769
impl_extract_lane!(i16x8[v16x8:i16|u16](LaneIdx8) => i32);
770770
impl_replace_lane!(i16x8[v16x8: i16](LaneIdx8) <= i32);
771771
impl_wrapping_add_sub_neg!(i16x8[v16x8]);
@@ -779,7 +779,7 @@ pub mod i16x8 {
779779
/// WASM-specific v32x4 instructions with modulo-arithmetic semantics
780780
pub mod i32x4 {
781781
use super::*;
782-
impl_splat!(i32x4[v32x4: i32] <= i32 | x0, x1, x2, x3);
782+
impl_splat!(i32x4[v32x4: i32 => "i32x4.splat"] <= i32 | x0, x1, x2, x3);
783783
impl_extract_lane!(i32x4[v32x4](LaneIdx4) => i32);
784784
impl_replace_lane!(i32x4[v32x4: i32](LaneIdx4) <= i32);
785785
impl_wrapping_add_sub_neg!(i32x4[v32x4]);
@@ -795,7 +795,7 @@ pub mod i32x4 {
795795
/// WASM-specific v64x2 instructions with modulo-arithmetic semantics
796796
pub mod i64x2 {
797797
use super::*;
798-
impl_splat!(i64x2[v64x2: i64] <= i64 | x0, x1);
798+
impl_splat!(i64x2[v64x2: i64 => "i64x2.splat"] <= i64 | x0, x1);
799799
impl_extract_lane!(i64x2[v64x2](LaneIdx2) => i64);
800800
impl_replace_lane!(i64x2[v64x2: i64](LaneIdx2) <= i64);
801801
impl_wrapping_add_sub_neg!(i64x2[v64x2]);
@@ -811,7 +811,7 @@ pub mod i64x2 {
811811
/// WASM-specific v32x4 floating-point instructions
812812
pub mod f32x4 {
813813
use super::*;
814-
impl_splat!(f32x4[f32x4: f32] <= f32 | x0, x1, x2, x3);
814+
impl_splat!(f32x4[f32x4: f32 => "f32x4.splat"] <= f32 | x0, x1, x2, x3);
815815
impl_extract_lane!(f32x4[f32x4](LaneIdx4) => f32);
816816
impl_replace_lane!(f32x4[f32x4: f32](LaneIdx4) <= f32);
817817
impl_comparisons!(f32x4[f32x4=>v32x4]);
@@ -824,7 +824,7 @@ pub mod f32x4 {
824824
/// WASM-specific v64x2 floating-point instructions
825825
pub mod f64x2 {
826826
use super::*;
827-
impl_splat!(f64x2[f64x2: f64] <= f64 | x0, x1);
827+
impl_splat!(f64x2[f64x2: f64 => "f64x2.splat"] <= f64 | x0, x1);
828828
impl_extract_lane!(f64x2[f64x2](LaneIdx2) => f64);
829829
impl_replace_lane!(f64x2[f64x2: f64](LaneIdx2) <= f64);
830830
impl_comparisons!(f64x2[f64x2=>v64x2]);

crates/coresimd/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
aarch64_target_feature,
3636
mips_target_feature,
3737
powerpc_target_feature,
38+
wasm_target_feature
3839
)]
3940
#![cfg_attr(
4041
test,

0 commit comments

Comments
 (0)