diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c05e38..75b3cfd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -30,6 +30,12 @@ jobs: feature: simd128 rust: [nightly, stable, 1.64] exclude: + # https://github.com/rust-lang/rust/issues/131031 + - target: + triple: wasm32-wasip1 + feature: simd128 + rust: nightly + # In 1.64 it's still called wasm32-wasi - target: triple: wasm32-wasip1 feature: simd128 diff --git a/src/arch/aarch64.rs b/src/arch/aarch64.rs index fcfb939..52dd045 100644 --- a/src/arch/aarch64.rs +++ b/src/arch/aarch64.rs @@ -59,24 +59,17 @@ pub(crate) fn check(input: &[u8]) -> bool { #[target_feature(enable = "neon")] pub(crate) unsafe fn check_neon(input: &[u8]) -> bool { - let ascii_zero = vdupq_n_u8(b'0' - 1); - let ascii_nine = vdupq_n_u8(b'9' + 1); - let ascii_ua = vdupq_n_u8(b'A' - 1); - let ascii_uf = vdupq_n_u8(b'F' + 1); - let ascii_la = vdupq_n_u8(b'a' - 1); - let ascii_lf = vdupq_n_u8(b'f' + 1); - generic::check_unaligned_chunks(input, |chunk: uint8x16_t| { - let ge0 = vcgtq_u8(chunk, ascii_zero); - let le9 = vcltq_u8(chunk, ascii_nine); + let ge0 = vcgeq_u8(chunk, vdupq_n_u8(b'0')); + let le9 = vcleq_u8(chunk, vdupq_n_u8(b'9')); let valid_digit = vandq_u8(ge0, le9); - let geua = vcgtq_u8(chunk, ascii_ua); - let leuf = vcltq_u8(chunk, ascii_uf); + let geua = vcgeq_u8(chunk, vdupq_n_u8(b'A')); + let leuf = vcleq_u8(chunk, vdupq_n_u8(b'F')); let valid_upper = vandq_u8(geua, leuf); - let gela = vcgtq_u8(chunk, ascii_la); - let lelf = vcltq_u8(chunk, ascii_lf); + let gela = vcgeq_u8(chunk, vdupq_n_u8(b'a')); + let lelf = vcleq_u8(chunk, vdupq_n_u8(b'f')); let valid_lower = vandq_u8(gela, lelf); let valid_letter = vorrq_u8(valid_lower, valid_upper); diff --git a/src/arch/wasm32.rs b/src/arch/wasm32.rs index 381ea96..f13f751 100644 --- a/src/arch/wasm32.rs +++ b/src/arch/wasm32.rs @@ -65,11 +65,11 @@ pub(crate) fn check(input: &[u8]) -> bool { if !has_simd128() { return generic::check(input); } - unsafe { check_simd128(input) } + check_simd128(input) } #[target_feature(enable = "simd128")] -unsafe fn check_simd128(input: &[u8]) -> bool { +fn check_simd128(input: &[u8]) -> bool { generic::check_unaligned_chunks(input, |chunk: v128| { let ge0 = u8x16_ge(chunk, u8x16_splat(b'0')); let le9 = u8x16_le(chunk, u8x16_splat(b'9'));