| 1 | //! Contains the x86-64/x86 AVX2 UTF-8 validation implementation. |
| 2 | |
| 3 | #![allow(clippy::too_many_arguments)] |
| 4 | |
| 5 | #[cfg(target_arch = "x86")] |
| 6 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::archrust-analyzer cargo core https://github.com/rust-lang/rust/library/core arch/::x86::{ |
| 7 | __m256i, _mm256_alignr_epi8, _mm256_and_si256, _mm256_cmpgt_epi8, _mm256_loadu_si256, |
| 8 | _mm256_movemask_epi8, _mm256_or_si256, _mm256_permute2x128_si256, _mm256_set1_epi8, |
| 9 | _mm256_setr_epi8, _mm256_setzero_si256, _mm256_shuffle_epi8, _mm256_srli_epi16, |
| 10 | _mm256_subs_epu8, _mm256_testz_si256, _mm256_xor_si256, _mm_prefetch, _MM_HINT_T0, |
| 11 | }; |
| 12 | #[cfg(target_arch = "x86_64")] |
| 13 | use corerust-analyzer cargo core https://github.com/rust-lang/rust/library/core crate/::archrust-analyzer cargo core https://github.com/rust-lang/rust/library/core arch/::x86_64rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/arch/x86_64/::{ |
| 14 | __m256irust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/__m256i#, _mm256_alignr_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx2/_mm256_alignr_epi8()., _mm256_and_si256rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx2/_mm256_and_si256()., _mm256_cmpgt_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx2/_mm256_cmpgt_epi8()., _mm256_loadu_si256rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx/_mm256_loadu_si256()., |
| 15 | _mm256_movemask_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx2/_mm256_movemask_epi8()., _mm256_or_si256rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx2/_mm256_or_si256()., _mm256_permute2x128_si256rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx2/_mm256_permute2x128_si256()., _mm256_set1_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx/_mm256_set1_epi8()., |
| 16 | _mm256_setr_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx/_mm256_setr_epi8()., _mm256_setzero_si256rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx/_mm256_setzero_si256()., _mm256_shuffle_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx2/_mm256_shuffle_epi8()., _mm256_srli_epi16rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx2/_mm256_srli_epi16()., |
| 17 | _mm256_subs_epu8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx2/_mm256_subs_epu8()., _mm256_testz_si256rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx/_mm256_testz_si256()., _mm256_xor_si256rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx2/_mm256_xor_si256()., _mm_prefetchrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_prefetch()., _MM_HINT_T0rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_MM_HINT_T0., |
| 18 | }; |
| 19 | |
| 20 | use craterust-analyzer cargo simdutf8 0.1.5 crate/::implementationrust-analyzer cargo simdutf8 0.1.5 implementation/::helpersrust-analyzer cargo simdutf8 0.1.5 implementation/helpers/::Utf8CheckAlgorithmrust-analyzer cargo simdutf8 0.1.5 implementation/helpers/Utf8CheckAlgorithm#; |
| 21 | |
| 22 | // AVX 2 SIMD primitives |
| 23 | |
| 24 | type SimdU8Valuerust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/SimdU8Value# = craterust-analyzer cargo simdutf8 0.1.5 crate/::implementationrust-analyzer cargo simdutf8 0.1.5 implementation/::helpersrust-analyzer cargo simdutf8 0.1.5 implementation/helpers/::SimdU8Valuerust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#<__m256irust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/__m256i#>; |
| 25 | |
| 26 | impl SimdU8Valuerust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/SimdU8Value# { |
| 27 | #[target_feature(enable = "avx2")] |
| 28 | #[inline] |
| 29 | unsafe fn from_32_cut_off_leadingrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]from_32_cut_off_leading().( |
| 30 | v0: u8, |
| 31 | v1: u8, |
| 32 | v2: u8, |
| 33 | v3: u8, |
| 34 | v4: u8, |
| 35 | v5: u8, |
| 36 | v6: u8, |
| 37 | v7: u8, |
| 38 | v8: u8, |
| 39 | v9: u8, |
| 40 | v10: u8, |
| 41 | v11: u8, |
| 42 | v12: u8, |
| 43 | v13: u8, |
| 44 | v14: u8, |
| 45 | v15: u8, |
| 46 | v16: u8, |
| 47 | v17: u8, |
| 48 | v18: u8, |
| 49 | v19: u8, |
| 50 | v20: u8, |
| 51 | v21: u8, |
| 52 | v22: u8, |
| 53 | v23: u8, |
| 54 | v24: u8, |
| 55 | v25: u8, |
| 56 | v26: u8, |
| 57 | v27: u8, |
| 58 | v28: u8, |
| 59 | v29: u8, |
| 60 | v30: u8, |
| 61 | v31: u8, |
| 62 | ) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`] { |
| 63 | #[allow(clippy::cast_possible_wrap)] |
| 64 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`][`From<__m256i>`]from().(_mm256_setr_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx/_mm256_setr_epi8().( |
| 65 | v0 as i8, v1 as i8, v2 as i8, v3 as i8, v4 as i8, v5 as i8, v6 as i8, v7 as i8, |
| 66 | v8 as i8, v9 as i8, v10 as i8, v11 as i8, v12 as i8, v13 as i8, v14 as i8, v15 as i8, |
| 67 | v16 as i8, v17 as i8, v18 as i8, v19 as i8, v20 as i8, v21 as i8, v22 as i8, v23 as i8, |
| 68 | v24 as i8, v25 as i8, v26 as i8, v27 as i8, v28 as i8, v29 as i8, v30 as i8, v31 as i8, |
| 69 | )) |
| 70 | } |
| 71 | |
| 72 | #[target_feature(enable = "avx2")] |
| 73 | #[inline] |
| 74 | unsafe fn repeat_16rust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]repeat_16().( |
| 75 | v0: u8, |
| 76 | v1: u8, |
| 77 | v2: u8, |
| 78 | v3: u8, |
| 79 | v4: u8, |
| 80 | v5: u8, |
| 81 | v6: u8, |
| 82 | v7: u8, |
| 83 | v8: u8, |
| 84 | v9: u8, |
| 85 | v10: u8, |
| 86 | v11: u8, |
| 87 | v12: u8, |
| 88 | v13: u8, |
| 89 | v14: u8, |
| 90 | v15: u8, |
| 91 | ) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`] { |
| 92 | #[allow(clippy::cast_possible_wrap)] |
| 93 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]::from_32_cut_off_leadingrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]from_32_cut_off_leading().( |
| 94 | v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, v0, v1, v2, v3, |
| 95 | v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, |
| 96 | ) |
| 97 | } |
| 98 | |
| 99 | #[target_feature(enable = "avx2")] |
| 100 | #[inline] |
| 101 | unsafe fn load_fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]load_from().(ptr: *const u8) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`] { |
| 102 | #[allow(clippy::cast_ptr_alignment)] |
| 103 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`][`From<__m256i>`]from().(_mm256_loadu_si256rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx/_mm256_loadu_si256().(ptr.castrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/const_ptr/impl#[`*const T`]cast().::<__m256irust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/__m256i#>())) |
| 104 | } |
| 105 | |
| 106 | #[target_feature(enable = "avx2")] |
| 107 | #[inline] |
| 108 | unsafe fn lookup_16rust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]lookup_16().( |
| 109 | self, |
| 110 | v0: u8, |
| 111 | v1: u8, |
| 112 | v2: u8, |
| 113 | v3: u8, |
| 114 | v4: u8, |
| 115 | v5: u8, |
| 116 | v6: u8, |
| 117 | v7: u8, |
| 118 | v8: u8, |
| 119 | v9: u8, |
| 120 | v10: u8, |
| 121 | v11: u8, |
| 122 | v12: u8, |
| 123 | v13: u8, |
| 124 | v14: u8, |
| 125 | v15: u8, |
| 126 | ) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`] { |
| 127 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`][`From<__m256i>`]from().(_mm256_shuffle_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx2/_mm256_shuffle_epi8().( |
| 128 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]::repeat_16rust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]repeat_16().( |
| 129 | v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, |
| 130 | ) |
| 131 | .0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., |
| 132 | self.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., |
| 133 | )) |
| 134 | } |
| 135 | |
| 136 | #[target_feature(enable = "avx2")] |
| 137 | #[inline] |
| 138 | unsafe fn splatrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]splat().(val: u8) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`] { |
| 139 | #[allow(clippy::cast_possible_wrap)] |
| 140 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`][`From<__m256i>`]from().(_mm256_set1_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx/_mm256_set1_epi8().(val as i8)) |
| 141 | } |
| 142 | |
| 143 | #[target_feature(enable = "avx2")] |
| 144 | #[inline] |
| 145 | unsafe fn splat0rust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]splat0().() -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`] { |
| 146 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`][`From<__m256i>`]from().(_mm256_setzero_si256rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx/_mm256_setzero_si256().()) |
| 147 | } |
| 148 | |
| 149 | #[target_feature(enable = "avx2")] |
| 150 | #[inline] |
| 151 | unsafe fn orrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]or().(self, b: Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`] { |
| 152 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`][`From<__m256i>`]from().(_mm256_or_si256rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx2/_mm256_or_si256().(self.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., b.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0.)) |
| 153 | } |
| 154 | |
| 155 | #[target_feature(enable = "avx2")] |
| 156 | #[inline] |
| 157 | unsafe fn andrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]and().(self, b: Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`] { |
| 158 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`][`From<__m256i>`]from().(_mm256_and_si256rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx2/_mm256_and_si256().(self.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., b.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0.)) |
| 159 | } |
| 160 | |
| 161 | #[target_feature(enable = "avx2")] |
| 162 | #[inline] |
| 163 | unsafe fn xorrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]xor().(self, b: Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`] { |
| 164 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`][`From<__m256i>`]from().(_mm256_xor_si256rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx2/_mm256_xor_si256().(self.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., b.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0.)) |
| 165 | } |
| 166 | |
| 167 | #[target_feature(enable = "avx2")] |
| 168 | #[inline] |
| 169 | unsafe fn saturating_subrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]saturating_sub().(self, b: Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`] { |
| 170 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`][`From<__m256i>`]from().(_mm256_subs_epu8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx2/_mm256_subs_epu8().(self.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., b.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0.)) |
| 171 | } |
| 172 | |
| 173 | // ugly but shr<N> requires const generics |
| 174 | #[target_feature(enable = "avx2")] |
| 175 | #[inline] |
| 176 | unsafe fn shr4rust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]shr4().(self) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`] { |
| 177 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`][`From<__m256i>`]from().(_mm256_srli_epi16rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx2/_mm256_srli_epi16().(self.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., 4)).andrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]and().(Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]::splatrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]splat().(0xFF rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shr<i32>`]shr().>>rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shr<i32>`]shr(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/bit/impl#[u8][`Shr<i32>`]shr().4)) |
| 178 | } |
| 179 | |
| 180 | // ugly but prev<N> requires const generics |
| 181 | #[target_feature(enable = "avx2")] |
| 182 | #[inline] |
| 183 | unsafe fn prev1rust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]prev1().(self, prev: Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`] { |
| 184 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`][`From<__m256i>`]from().(_mm256_alignr_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx2/_mm256_alignr_epi8().( |
| 185 | self.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., |
| 186 | _mm256_permute2x128_si256rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx2/_mm256_permute2x128_si256().(prev.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., self.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., 0x21), |
| 187 | 16 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().1, |
| 188 | )) |
| 189 | } |
| 190 | |
| 191 | // ugly but prev<N> requires const generics |
| 192 | #[target_feature(enable = "avx2")] |
| 193 | #[inline] |
| 194 | unsafe fn prev2rust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]prev2().(self, prev: Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`] { |
| 195 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`][`From<__m256i>`]from().(_mm256_alignr_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx2/_mm256_alignr_epi8().( |
| 196 | self.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., |
| 197 | _mm256_permute2x128_si256rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx2/_mm256_permute2x128_si256().(prev.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., self.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., 0x21), |
| 198 | 16 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().2, |
| 199 | )) |
| 200 | } |
| 201 | |
| 202 | // ugly but prev<N> requires const generics |
| 203 | #[target_feature(enable = "avx2")] |
| 204 | #[inline] |
| 205 | unsafe fn prev3rust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]prev3().(self, prev: Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`] { |
| 206 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`][`From<__m256i>`]from().(_mm256_alignr_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx2/_mm256_alignr_epi8().( |
| 207 | self.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., |
| 208 | _mm256_permute2x128_si256rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx2/_mm256_permute2x128_si256().(prev.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., self.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., 0x21), |
| 209 | 16 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[i32][`Sub<Self>`]sub().3, |
| 210 | )) |
| 211 | } |
| 212 | |
| 213 | #[target_feature(enable = "avx2")] |
| 214 | #[inline] |
| 215 | unsafe fn signed_gtrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]signed_gt().(self, other: Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`] { |
| 216 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`][`From<__m256i>`]from().(_mm256_cmpgt_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx2/_mm256_cmpgt_epi8().(self.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., other.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0.)) |
| 217 | } |
| 218 | |
| 219 | #[target_feature(enable = "avx2")] |
| 220 | #[inline] |
| 221 | unsafe fn any_bit_setrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]any_bit_set().(self) -> bool { |
| 222 | _mm256_testz_si256rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx/_mm256_testz_si256().(self.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., self.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0.) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().!=rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]ne().1 |
| 223 | } |
| 224 | |
| 225 | #[target_feature(enable = "avx2")] |
| 226 | #[inline] |
| 227 | unsafe fn is_asciirust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]is_ascii().(self) -> bool { |
| 228 | _mm256_movemask_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/avx2/_mm256_movemask_epi8().(self.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0.) rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().==rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core cmp/impls/impl#[i32][`PartialEq<Self>`]eq().0 |
| 229 | } |
| 230 | } |
| 231 | |
| 232 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<__m256irust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/__m256i#> for SimdU8Valuerust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/SimdU8Value# { |
| 233 | #[inline] |
| 234 | fn fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`][`From<__m256i>`]from().(val: __m256irust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/__m256i#) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`][`From<__m256i>`] { |
| 235 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`][`From<__m256i>`](val) |
| 236 | } |
| 237 | } |
| 238 | |
| 239 | impl Utf8CheckAlgorithmrust-analyzer cargo simdutf8 0.1.5 implementation/helpers/Utf8CheckAlgorithm#<SimdU8Valuerust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/SimdU8Value#> { |
| 240 | #[target_feature(enable = "avx2")] |
| 241 | #[inline] |
| 242 | unsafe fn must_be_2_3_continuationrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`Utf8CheckAlgorithm<crate::implementation::helpers::SimdU8Value<__m256i>>`]must_be_2_3_continuation().(prev2: SimdU8Valuerust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/SimdU8Value#, prev3: SimdU8Valuerust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/SimdU8Value#) -> SimdU8Valuerust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/SimdU8Value# { |
| 243 | let is_third_byte = prev2.saturating_subrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]saturating_sub().(SimdU8Valuerust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/SimdU8Value#::splatrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]splat().(0b1110_0000 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub().1)); |
| 244 | let is_fourth_byte = prev3.saturating_subrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]saturating_sub().(SimdU8Valuerust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/SimdU8Value#::splatrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]splat().(0b1111_0000 rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub().-rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub(). rust-analyzer cargo core https://github.com/rust-lang/rust/library/core ops/arith/impl#[u8][`Sub<Self>`]sub().1)); |
| 245 | |
| 246 | is_third_byte |
| 247 | .orrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]or().(is_fourth_byte) |
| 248 | .signed_gtrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]signed_gt().(SimdU8Valuerust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/SimdU8Value#::splat0rust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/impl#[`crate::implementation::helpers::SimdU8Value<__m256i>`]splat0().()) |
| 249 | } |
| 250 | } |
| 251 | |
| 252 | #[target_feature(enable = "avx2")] |
| 253 | #[inline] |
| 254 | unsafe fn simd_prefetchrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/simd_prefetch().(ptr: *const u8) { |
| 255 | _mm_prefetchrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_prefetch().(ptr.castrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/const_ptr/impl#[`*const T`]cast().::<i8>(), _MM_HINT_T0rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_MM_HINT_T0.); |
| 256 | } |
| 257 | |
| 258 | const PREFETCHrust-analyzer cargo simdutf8 0.1.5 implementation/x86/avx2/PREFETCH.: bool = true; |
| 259 | use craterust-analyzer cargo simdutf8 0.1.5 crate/::implementationrust-analyzer cargo simdutf8 0.1.5 implementation/::helpersrust-analyzer cargo simdutf8 0.1.5 implementation/helpers/::TempSimdChunkA32rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/TempSimdChunkA32# as TempSimdChunkrust-analyzer cargo simdutf8 0.1.5 implementation/helpers/TempSimdChunkA32#; |
| 260 | simd_input_256_bitrust-analyzer cargo simdutf8 0.1.5 implementation/algorithm/simd_input_256_bit!!("avx2"); |
| 261 | algorithm_simdrust-analyzer cargo simdutf8 0.1.5 implementation/algorithm/algorithm_simd!!("avx2"); |