Skip to content

Commit 325b8db

Browse files
committed
Add unsigned aliases
1 parent 0555f61 commit 325b8db

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

crates/core_arch/src/wasm32/relaxed_simd.rs

+40
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,9 @@ pub fn i8x16_relaxed_swizzle(a: v128, s: v128) -> v128 {
7373
unsafe { llvm_relaxed_swizzle(a.as_i8x16(), s.as_i8x16()).v128() }
7474
}
7575

76+
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
77+
pub use i8x16_relaxed_swizzle as u8x16_relaxed_swizzle;
78+
7679
/// A relaxed version of `i32x4_trunc_sat_f32x4(a)` converts the `f32` lanes
7780
/// of `a` to signed 32-bit integers.
7881
///
@@ -185,6 +188,9 @@ pub fn i8x16_relaxed_laneselect(a: v128, b: v128, m: v128) -> v128 {
185188
unsafe { llvm_i8x16_laneselect(a.as_i8x16(), b.as_i8x16(), m.as_i8x16()).v128() }
186189
}
187190

191+
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
192+
pub use i8x16_relaxed_laneselect as u8x16_relaxed_laneselect;
193+
188194
/// A relaxed version of `v128_bitselect` where this either behaves the same as
189195
/// `v128_bitselect` or the high bit of each lane `m` is inspected and the
190196
/// corresponding lane of `a` is chosen if the bit is 1 or the lane of `b` is
@@ -201,6 +207,9 @@ pub fn i16x8_relaxed_laneselect(a: v128, b: v128, m: v128) -> v128 {
201207
unsafe { llvm_i16x8_laneselect(a.as_i16x8(), b.as_i16x8(), m.as_i16x8()).v128() }
202208
}
203209

210+
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
211+
pub use i16x8_relaxed_laneselect as u16x8_relaxed_laneselect;
212+
204213
/// A relaxed version of `v128_bitselect` where this either behaves the same as
205214
/// `v128_bitselect` or the high bit of each lane `m` is inspected and the
206215
/// corresponding lane of `a` is chosen if the bit is 1 or the lane of `b` is
@@ -217,6 +226,9 @@ pub fn i32x4_relaxed_laneselect(a: v128, b: v128, m: v128) -> v128 {
217226
unsafe { llvm_i32x4_laneselect(a.as_i32x4(), b.as_i32x4(), m.as_i32x4()).v128() }
218227
}
219228

229+
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
230+
pub use i32x4_relaxed_laneselect as u32x4_relaxed_laneselect;
231+
220232
/// A relaxed version of `v128_bitselect` where this either behaves the same as
221233
/// `v128_bitselect` or the high bit of each lane `m` is inspected and the
222234
/// corresponding lane of `a` is chosen if the bit is 1 or the lane of `b` is
@@ -233,6 +245,9 @@ pub fn i64x2_relaxed_laneselect(a: v128, b: v128, m: v128) -> v128 {
233245
unsafe { llvm_i64x2_laneselect(a.as_i64x2(), b.as_i64x2(), m.as_i64x2()).v128() }
234246
}
235247

248+
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
249+
pub use i64x2_relaxed_laneselect as u64x2_relaxed_laneselect;
250+
236251
/// A relaxed version of `f32x4_min` which is either `f32x4_min` or
237252
/// `f32x4_pmin`.
238253
#[inline]
@@ -288,6 +303,9 @@ pub fn i16x8_relaxed_q15mulr(a: v128, b: v128) -> v128 {
288303
unsafe { llvm_relaxed_q15mulr_signed(a.as_i16x8(), b.as_i16x8()).v128() }
289304
}
290305

306+
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
307+
pub use i16x8_relaxed_q15mulr as u16x8_relaxed_q15mulr;
308+
291309
/// A relaxed dot-product instruction.
292310
///
293311
/// This instruction will perform pairwise products of the 8-bit values in `a`
@@ -308,6 +326,9 @@ pub fn i16x8_relaxed_dot_i8x16_i7x16(a: v128, b: v128) -> v128 {
308326
unsafe { llvm_i16x8_relaxed_dot_i8x16_i7x16_s(a.as_i8x16(), b.as_i8x16()).v128() }
309327
}
310328

329+
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
330+
pub use i16x8_relaxed_dot_i8x16_i7x16 as u16x8_relaxed_dot_i8x16_i7x16;
331+
311332
/// Similar to [`i16x8_relaxed_dot_i8x16_i7x16`] except that the intermediate
312333
/// `i16x8` result is fed into `i32x4_extadd_pairwise_i16x8` followed by
313334
/// `i32x4_add` to add the value `c` to the result.
@@ -322,6 +343,9 @@ pub fn i32x4_relaxed_dot_i8x16_i7x16_add(a: v128, b: v128, c: v128) -> v128 {
322343
}
323344
}
324345

346+
#[stable(feature = "stdarch_wasm_relaxed_simd", since = "CURRENT_RUSTC_VERSION")]
347+
pub use i32x4_relaxed_dot_i8x16_i7x16_add as u32x4_relaxed_dot_i8x16_i7x16_add;
348+
325349
#[cfg(test)]
326350
mod tests {
327351
use super::super::simd128::*;
@@ -367,6 +391,22 @@ mod tests {
367391
i8x16(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
368392
],
369393
);
394+
compare_bytes(
395+
u8x16_relaxed_swizzle(
396+
u8x16(
397+
128, 129, 130, 131, 132, 133, 134, 135, 136, 137, 138, 139, 140, 141, 142, 143,
398+
),
399+
u8x16(0x80, 0xff, 16, 17, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0),
400+
),
401+
&[
402+
u8x16(
403+
128, 128, 128, 129, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
404+
),
405+
u8x16(
406+
0, 0, 0, 0, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128, 128,
407+
),
408+
],
409+
);
370410
}
371411

372412
#[test]

0 commit comments

Comments
 (0)