| 1 | //! Contains the x86-64/x86 SSE4.2 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 | __m128i, _mm_alignr_epi8, _mm_and_si128, _mm_cmpgt_epi8, _mm_loadu_si128, _mm_movemask_epi8, |
| 8 | _mm_or_si128, _mm_prefetch, _mm_set1_epi8, _mm_setr_epi8, _mm_setzero_si128, _mm_shuffle_epi8, |
| 9 | _mm_srli_epi16, _mm_subs_epu8, _mm_testz_si128, _mm_xor_si128, _MM_HINT_T0, |
| 10 | }; |
| 11 | #[cfg(target_arch = "x86_64")] |
| 12 | 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/::{ |
| 13 | __m128irust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/__m128i#, _mm_alignr_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/ssse3/_mm_alignr_epi8()., _mm_and_si128rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_and_si128()., _mm_cmpgt_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_cmpgt_epi8()., _mm_loadu_si128rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_loadu_si128()., _mm_movemask_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_movemask_epi8()., |
| 14 | _mm_or_si128rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_or_si128()., _mm_prefetchrust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_mm_prefetch()., _mm_set1_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_set1_epi8()., _mm_setr_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_setr_epi8()., _mm_setzero_si128rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_setzero_si128()., _mm_shuffle_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/ssse3/_mm_shuffle_epi8()., |
| 15 | _mm_srli_epi16rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_srli_epi16()., _mm_subs_epu8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_subs_epu8()., _mm_testz_si128rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse41/_mm_testz_si128()., _mm_xor_si128rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_xor_si128()., _MM_HINT_T0rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse/_MM_HINT_T0., |
| 16 | }; |
| 17 | |
| 18 | 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#; |
| 19 | |
| 20 | // SSE 4.2 SIMD primitives |
| 21 | |
| 22 | type SimdU8Valuerust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/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#<__m128irust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/__m128i#>; |
| 23 | |
| 24 | impl SimdU8Valuerust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/SimdU8Value# { |
| 25 | #[target_feature(enable = "sse4.2")] |
| 26 | #[inline] |
| 27 | unsafe fn from_32_cut_off_leadingrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]from_32_cut_off_leading().( |
| 28 | _v0: u8, |
| 29 | _v1: u8, |
| 30 | _v2: u8, |
| 31 | _v3: u8, |
| 32 | _v4: u8, |
| 33 | _v5: u8, |
| 34 | _v6: u8, |
| 35 | _v7: u8, |
| 36 | _v8: u8, |
| 37 | _v9: u8, |
| 38 | _v10: u8, |
| 39 | _v11: u8, |
| 40 | _v12: u8, |
| 41 | _v13: u8, |
| 42 | _v14: u8, |
| 43 | _v15: u8, |
| 44 | v16: u8, |
| 45 | v17: u8, |
| 46 | v18: u8, |
| 47 | v19: u8, |
| 48 | v20: u8, |
| 49 | v21: u8, |
| 50 | v22: u8, |
| 51 | v23: u8, |
| 52 | v24: u8, |
| 53 | v25: u8, |
| 54 | v26: u8, |
| 55 | v27: u8, |
| 56 | v28: u8, |
| 57 | v29: u8, |
| 58 | v30: u8, |
| 59 | v31: u8, |
| 60 | ) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`] { |
| 61 | #[allow(clippy::cast_possible_wrap)] |
| 62 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`][`From<__m128i>`]from().(_mm_setr_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_setr_epi8().( |
| 63 | v16 as i8, v17 as i8, v18 as i8, v19 as i8, v20 as i8, v21 as i8, v22 as i8, v23 as i8, |
| 64 | v24 as i8, v25 as i8, v26 as i8, v27 as i8, v28 as i8, v29 as i8, v30 as i8, v31 as i8, |
| 65 | )) |
| 66 | } |
| 67 | |
| 68 | #[target_feature(enable = "sse4.2")] |
| 69 | #[inline] |
| 70 | unsafe fn repeat_16rust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]repeat_16().( |
| 71 | v0: u8, |
| 72 | v1: u8, |
| 73 | v2: u8, |
| 74 | v3: u8, |
| 75 | v4: u8, |
| 76 | v5: u8, |
| 77 | v6: u8, |
| 78 | v7: u8, |
| 79 | v8: u8, |
| 80 | v9: u8, |
| 81 | v10: u8, |
| 82 | v11: u8, |
| 83 | v12: u8, |
| 84 | v13: u8, |
| 85 | v14: u8, |
| 86 | v15: u8, |
| 87 | ) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`] { |
| 88 | #[allow(clippy::cast_possible_wrap)] |
| 89 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`][`From<__m128i>`]from().(_mm_setr_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_setr_epi8().( |
| 90 | v0 as i8, v1 as i8, v2 as i8, v3 as i8, v4 as i8, v5 as i8, v6 as i8, v7 as i8, |
| 91 | v8 as i8, v9 as i8, v10 as i8, v11 as i8, v12 as i8, v13 as i8, v14 as i8, v15 as i8, |
| 92 | )) |
| 93 | } |
| 94 | |
| 95 | #[target_feature(enable = "sse4.2")] |
| 96 | #[inline] |
| 97 | unsafe fn load_fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]load_from().(ptr: *const u8) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`] { |
| 98 | #[allow(clippy::cast_ptr_alignment)] |
| 99 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`][`From<__m128i>`]from().(_mm_loadu_si128rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_loadu_si128().(ptr.castrust-analyzer cargo core https://github.com/rust-lang/rust/library/core ptr/const_ptr/impl#[`*const T`]cast().::<__m128irust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/__m128i#>())) |
| 100 | } |
| 101 | |
| 102 | #[target_feature(enable = "sse4.2")] |
| 103 | #[inline] |
| 104 | unsafe fn lookup_16rust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]lookup_16().( |
| 105 | self, |
| 106 | v0: u8, |
| 107 | v1: u8, |
| 108 | v2: u8, |
| 109 | v3: u8, |
| 110 | v4: u8, |
| 111 | v5: u8, |
| 112 | v6: u8, |
| 113 | v7: u8, |
| 114 | v8: u8, |
| 115 | v9: u8, |
| 116 | v10: u8, |
| 117 | v11: u8, |
| 118 | v12: u8, |
| 119 | v13: u8, |
| 120 | v14: u8, |
| 121 | v15: u8, |
| 122 | ) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`] { |
| 123 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`][`From<__m128i>`]from().(_mm_shuffle_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/ssse3/_mm_shuffle_epi8().( |
| 124 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]::repeat_16rust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]repeat_16().( |
| 125 | v0, v1, v2, v3, v4, v5, v6, v7, v8, v9, v10, v11, v12, v13, v14, v15, |
| 126 | ) |
| 127 | .0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., |
| 128 | self.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., |
| 129 | )) |
| 130 | } |
| 131 | |
| 132 | #[target_feature(enable = "sse4.2")] |
| 133 | #[inline] |
| 134 | unsafe fn splatrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]splat().(val: u8) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`] { |
| 135 | #[allow(clippy::cast_possible_wrap)] |
| 136 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`][`From<__m128i>`]from().(_mm_set1_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_set1_epi8().(val as i8)) |
| 137 | } |
| 138 | |
| 139 | #[target_feature(enable = "sse4.2")] |
| 140 | #[inline] |
| 141 | unsafe fn splat0rust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]splat0().() -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`] { |
| 142 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`][`From<__m128i>`]from().(_mm_setzero_si128rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_setzero_si128().()) |
| 143 | } |
| 144 | |
| 145 | #[target_feature(enable = "sse4.2")] |
| 146 | #[inline] |
| 147 | unsafe fn orrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]or().(self, b: Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`] { |
| 148 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`][`From<__m128i>`]from().(_mm_or_si128rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_or_si128().(self.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., b.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0.)) |
| 149 | } |
| 150 | |
| 151 | #[target_feature(enable = "sse4.2")] |
| 152 | #[inline] |
| 153 | unsafe fn andrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]and().(self, b: Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`] { |
| 154 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`][`From<__m128i>`]from().(_mm_and_si128rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_and_si128().(self.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., b.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0.)) |
| 155 | } |
| 156 | |
| 157 | #[target_feature(enable = "sse4.2")] |
| 158 | #[inline] |
| 159 | unsafe fn xorrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]xor().(self, b: Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`] { |
| 160 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`][`From<__m128i>`]from().(_mm_xor_si128rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_xor_si128().(self.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., b.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0.)) |
| 161 | } |
| 162 | |
| 163 | #[target_feature(enable = "sse4.2")] |
| 164 | #[inline] |
| 165 | unsafe fn saturating_subrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]saturating_sub().(self, b: Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`] { |
| 166 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`][`From<__m128i>`]from().(_mm_subs_epu8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_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.)) |
| 167 | } |
| 168 | |
| 169 | // ugly but shr<N> requires const generics |
| 170 | #[target_feature(enable = "sse4.2")] |
| 171 | #[inline] |
| 172 | unsafe fn shr4rust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]shr4().(self) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`] { |
| 173 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`][`From<__m128i>`]from().(_mm_srli_epi16rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_srli_epi16().(self.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., 4)).andrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]and().(Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]::splatrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]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)) |
| 174 | } |
| 175 | |
| 176 | // ugly but prev<N> requires const generics |
| 177 | #[target_feature(enable = "sse4.2")] |
| 178 | #[inline] |
| 179 | unsafe fn prev1rust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]prev1().(self, prev: Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`] { |
| 180 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`][`From<__m128i>`]from().(_mm_alignr_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/ssse3/_mm_alignr_epi8().(self.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., prev.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., 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)) |
| 181 | } |
| 182 | |
| 183 | // ugly but prev<N> requires const generics |
| 184 | #[target_feature(enable = "sse4.2")] |
| 185 | #[inline] |
| 186 | unsafe fn prev2rust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]prev2().(self, prev: Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`] { |
| 187 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`][`From<__m128i>`]from().(_mm_alignr_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/ssse3/_mm_alignr_epi8().(self.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., prev.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., 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)) |
| 188 | } |
| 189 | |
| 190 | // ugly but prev<N> requires const generics |
| 191 | #[target_feature(enable = "sse4.2")] |
| 192 | #[inline] |
| 193 | unsafe fn prev3rust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]prev3().(self, prev: Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`] { |
| 194 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`][`From<__m128i>`]from().(_mm_alignr_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/ssse3/_mm_alignr_epi8().(self.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., prev.0rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/SimdU8Value#0., 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)) |
| 195 | } |
| 196 | |
| 197 | #[target_feature(enable = "sse4.2")] |
| 198 | #[inline] |
| 199 | unsafe fn signed_gtrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]signed_gt().(self, other: Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`] { |
| 200 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]::fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`][`From<__m128i>`]from().(_mm_cmpgt_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_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.)) |
| 201 | } |
| 202 | |
| 203 | #[target_feature(enable = "sse4.2")] |
| 204 | #[inline] |
| 205 | unsafe fn any_bit_setrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]any_bit_set().(self) -> bool { |
| 206 | _mm_testz_si128rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse41/_mm_testz_si128().(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 |
| 207 | } |
| 208 | |
| 209 | #[target_feature(enable = "sse4.2")] |
| 210 | #[inline] |
| 211 | unsafe fn is_asciirust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]is_ascii().(self) -> bool { |
| 212 | _mm_movemask_epi8rust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/sse2/_mm_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 |
| 213 | } |
| 214 | } |
| 215 | |
| 216 | impl Fromrust-analyzer cargo core https://github.com/rust-lang/rust/library/core convert/From#<__m128irust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/__m128i#> for SimdU8Valuerust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/SimdU8Value# { |
| 217 | #[inline] |
| 218 | fn fromrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`][`From<__m128i>`]from().(val: __m128irust-analyzer cargo core https://github.com/rust-lang/rust/library/core core_arch/x86/__m128i#) -> Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`][`From<__m128i>`] { |
| 219 | Selfrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`][`From<__m128i>`](val) |
| 220 | } |
| 221 | } |
| 222 | |
| 223 | impl Utf8CheckAlgorithmrust-analyzer cargo simdutf8 0.1.5 implementation/helpers/Utf8CheckAlgorithm#<SimdU8Valuerust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/SimdU8Value#> { |
| 224 | #[target_feature(enable = "sse4.2")] |
| 225 | #[inline] |
| 226 | unsafe fn must_be_2_3_continuationrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`Utf8CheckAlgorithm<crate::implementation::helpers::SimdU8Value<__m128i>>`]must_be_2_3_continuation().(prev2: SimdU8Valuerust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/SimdU8Value#, prev3: SimdU8Valuerust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/SimdU8Value#) -> SimdU8Valuerust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/SimdU8Value# { |
| 227 | let is_third_byte = prev2.saturating_subrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]saturating_sub().(SimdU8Valuerust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/SimdU8Value#::splatrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]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)); |
| 228 | let is_fourth_byte = prev3.saturating_subrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]saturating_sub().(SimdU8Valuerust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/SimdU8Value#::splatrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]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)); |
| 229 | |
| 230 | is_third_byte |
| 231 | .orrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]or().(is_fourth_byte) |
| 232 | .signed_gtrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]signed_gt().(SimdU8Valuerust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/SimdU8Value#::splat0rust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/impl#[`crate::implementation::helpers::SimdU8Value<__m128i>`]splat0().()) |
| 233 | } |
| 234 | } |
| 235 | |
| 236 | #[target_feature(enable = "sse4.2")] |
| 237 | #[inline] |
| 238 | unsafe fn simd_prefetchrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/simd_prefetch().(ptr: *const u8) { |
| 239 | _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.); |
| 240 | } |
| 241 | |
| 242 | const PREFETCHrust-analyzer cargo simdutf8 0.1.5 implementation/x86/sse42/PREFETCH.: bool = false; |
| 243 | 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/::TempSimdChunkA16rust-analyzer cargo simdutf8 0.1.5 implementation/helpers/TempSimdChunkA16# as TempSimdChunkrust-analyzer cargo simdutf8 0.1.5 implementation/helpers/TempSimdChunkA16#; |
| 244 | simd_input_128_bitrust-analyzer cargo simdutf8 0.1.5 implementation/algorithm/simd_input_128_bit!!("sse4.2"); |
| 245 | algorithm_simdrust-analyzer cargo simdutf8 0.1.5 implementation/algorithm/algorithm_simd!!("sse4.2"); |