2022-06-23 00:21:58 -05:00
|
|
|
#![feature(portable_simd, strict_provenance)]
|
|
|
|
|
|
|
|
use core_simd::{Simd, SimdConstPtr, SimdMutPtr};
|
|
|
|
|
|
|
|
macro_rules! common_tests {
|
|
|
|
{ $constness:ident } => {
|
|
|
|
test_helpers::test_lanes! {
|
|
|
|
fn is_null<const LANES: usize>() {
|
|
|
|
test_helpers::test_unary_mask_elementwise(
|
2022-06-24 00:26:24 -05:00
|
|
|
&Simd::<*$constness u32, LANES>::is_null,
|
|
|
|
&<*$constness u32>::is_null,
|
2022-06-23 00:21:58 -05:00
|
|
|
&|_| true,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
fn addr<const LANES: usize>() {
|
|
|
|
test_helpers::test_unary_elementwise(
|
2022-06-24 00:26:24 -05:00
|
|
|
&Simd::<*$constness u32, LANES>::addr,
|
|
|
|
&<*$constness u32>::addr,
|
2022-06-23 00:21:58 -05:00
|
|
|
&|_| true,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-06-23 23:13:36 -05:00
|
|
|
fn wrapping_offset<const LANES: usize>() {
|
|
|
|
test_helpers::test_binary_elementwise(
|
2022-06-24 00:26:24 -05:00
|
|
|
&Simd::<*$constness u32, LANES>::wrapping_offset,
|
|
|
|
&<*$constness u32>::wrapping_offset,
|
2022-06-23 23:13:36 -05:00
|
|
|
&|_, _| true,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2022-06-23 00:21:58 -05:00
|
|
|
fn wrapping_add<const LANES: usize>() {
|
|
|
|
test_helpers::test_binary_elementwise(
|
2022-06-24 00:26:24 -05:00
|
|
|
&Simd::<*$constness u32, LANES>::wrapping_add,
|
|
|
|
&<*$constness u32>::wrapping_add,
|
2022-06-23 00:21:58 -05:00
|
|
|
&|_, _| true,
|
|
|
|
);
|
|
|
|
}
|
2022-06-23 23:13:36 -05:00
|
|
|
|
|
|
|
fn wrapping_sub<const LANES: usize>() {
|
|
|
|
test_helpers::test_binary_elementwise(
|
2022-06-24 00:26:24 -05:00
|
|
|
&Simd::<*$constness u32, LANES>::wrapping_sub,
|
|
|
|
&<*$constness u32>::wrapping_sub,
|
2022-06-23 23:13:36 -05:00
|
|
|
&|_, _| true,
|
|
|
|
);
|
|
|
|
}
|
2022-06-23 00:21:58 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
mod const_ptr {
|
|
|
|
use super::*;
|
|
|
|
common_tests! { const }
|
|
|
|
}
|
|
|
|
|
|
|
|
mod mut_ptr {
|
|
|
|
use super::*;
|
|
|
|
common_tests! { mut }
|
|
|
|
}
|