Skip to content

Commit 75ed0d2

Browse files
committed
review: implement additional tests covering unsigned & mask types
1 parent ea8f414 commit 75ed0d2

File tree

1 file changed

+78
-0
lines changed

1 file changed

+78
-0
lines changed

fearless_simd_tests/tests/wasm.rs

Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,3 +283,81 @@ test_wasm_simd_parity! {
283283
}
284284
}
285285
}
286+
287+
test_wasm_simd_parity! {
288+
fn and_u8x16() {
289+
|s| -> [u8; 16] {
290+
let a = u8x16::from_slice(s, &[1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]);
291+
let b = u8x16::from_slice(s, &[85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85]);
292+
(a & b).into()
293+
}
294+
}
295+
}
296+
297+
test_wasm_simd_parity! {
298+
fn or_u8x16() {
299+
|s| -> [u8; 16] {
300+
let a = u8x16::from_slice(s, &[0, 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 8]);
301+
let b = u8x16::from_slice(s, &[1, 1, 1, 1, 2, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0]);
302+
(a | b).into()
303+
}
304+
}
305+
}
306+
307+
test_wasm_simd_parity! {
308+
fn xor_u8x16() {
309+
|s| -> [u8; 16] {
310+
let a = u8x16::from_slice(s, &[0, 1, 2, 3, 4, 5, 6, 7, 1, 1, 1, 1, 0, 0, 0, 0]);
311+
let b = u8x16::from_slice(s, &[1, 1, 0, 0, 5, 4, 7, 6, 1, 0, 1, 0, 1, 0, 1, 0]);
312+
(a ^ b).into()
313+
}
314+
}
315+
}
316+
317+
test_wasm_simd_parity! {
318+
fn not_u8x16() {
319+
|s| -> [u8; 16] {
320+
let a = u8x16::from_slice(s, &[0, 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 8]);
321+
u8x16::not(a).into()
322+
}
323+
}
324+
}
325+
326+
test_wasm_simd_parity! {
327+
fn and_mask8x16() {
328+
|s| -> [i8; 16] {
329+
let a = mask8x16::from_slice(s, &[1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0, 1, 0]);
330+
let b = mask8x16::from_slice(s, &[85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85, 85]);
331+
(a & b).into()
332+
}
333+
}
334+
}
335+
336+
test_wasm_simd_parity! {
337+
fn or_mask8x16() {
338+
|s| -> [i8; 16] {
339+
let a = mask8x16::from_slice(s, &[0, 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 8]);
340+
let b = mask8x16::from_slice(s, &[1, 1, 1, 1, 2, 3, 4, 5, 0, 0, 0, 0, 0, 0, 0, 0]);
341+
(a | b).into()
342+
}
343+
}
344+
}
345+
346+
test_wasm_simd_parity! {
347+
fn xor_mask8x16() {
348+
|s| -> [i8; 16] {
349+
let a = mask8x16::from_slice(s, &[0, 1, 2, 3, 4, 5, 6, 7, 1, 1, 1, 1, 0, 0, 0, 0]);
350+
let b = mask8x16::from_slice(s, &[1, 1, 0, 0, 5, 4, 7, 6, 1, 0, 1, 0, 1, 0, 1, 0]);
351+
(a ^ b).into()
352+
}
353+
}
354+
}
355+
356+
test_wasm_simd_parity! {
357+
fn not_mask8x16() {
358+
|s| -> [i8; 16] {
359+
let a = mask8x16::from_slice(s, &[0, 1, 2, 3, 4, 5, 6, 7, 1, 2, 3, 4, 5, 6, 7, 8]);
360+
mask8x16::not(a).into()
361+
}
362+
}
363+
}

0 commit comments

Comments
 (0)