httparse/simd/
mod.rs

1mod swar;
2
3#[cfg(not(all(
4    httparse_simd,
5    any(
6        target_arch = "x86",
7        target_arch = "x86_64",
8        all(
9            target_arch = "aarch64",
10            httparse_simd_neon_intrinsics,
11        )
12    ),
13)))]
14pub use self::swar::*;
15
16#[cfg(all(
17    httparse_simd,
18    not(httparse_simd_target_feature_avx2),
19    any(
20        target_arch = "x86",
21        target_arch = "x86_64",
22    ),
23))]
24mod sse42;
25
26#[cfg(all(
27    httparse_simd,
28    any(
29        httparse_simd_target_feature_avx2,
30        not(httparse_simd_target_feature_sse42),
31    ),
32    any(
33        target_arch = "x86",
34        target_arch = "x86_64",
35    ),
36))]
37mod avx2;
38
39#[cfg(all(
40    httparse_simd,
41    not(any(
42        httparse_simd_target_feature_sse42,
43        httparse_simd_target_feature_avx2,
44    )),
45    any(
46        target_arch = "x86",
47        target_arch = "x86_64",
48    ),
49))]
50mod runtime;
51
52#[cfg(all(
53    httparse_simd,
54    not(any(
55        httparse_simd_target_feature_sse42,
56        httparse_simd_target_feature_avx2,
57    )),
58    any(
59        target_arch = "x86",
60        target_arch = "x86_64",
61    ),
62))]
63pub use self::runtime::*;
64
65#[cfg(all(
66    httparse_simd,
67    httparse_simd_target_feature_sse42,
68    not(httparse_simd_target_feature_avx2),
69    any(
70        target_arch = "x86",
71        target_arch = "x86_64",
72    ),
73))]
74mod sse42_compile_time {
75    #[inline(always)]
76    pub fn match_header_name_vectored(b: &mut crate::iter::Bytes<'_>) {
77        super::swar::match_header_name_vectored(b);
78    }
79
80    #[inline(always)]
81    pub fn match_uri_vectored(b: &mut crate::iter::Bytes<'_>) {
82        // SAFETY: calls are guarded by a compile time feature check
83        unsafe { crate::simd::sse42::match_uri_vectored(b) }
84    }
85    
86    #[inline(always)]
87    pub fn match_header_value_vectored(b: &mut crate::iter::Bytes<'_>) {
88        // SAFETY: calls are guarded by a compile time feature check
89        unsafe { crate::simd::sse42::match_header_value_vectored(b) }
90    }
91}
92
93#[cfg(all(
94    httparse_simd,
95    httparse_simd_target_feature_sse42,
96    not(httparse_simd_target_feature_avx2),
97    any(
98        target_arch = "x86",
99        target_arch = "x86_64",
100    ),
101))]
102pub use self::sse42_compile_time::*;
103
104#[cfg(all(
105    httparse_simd,
106    httparse_simd_target_feature_avx2,
107    any(
108        target_arch = "x86",
109        target_arch = "x86_64",
110    ),
111))]
112mod avx2_compile_time {
113    #[inline(always)]
114    pub fn match_header_name_vectored(b: &mut crate::iter::Bytes<'_>) {
115        super::swar::match_header_name_vectored(b);
116    }
117
118    #[inline(always)]
119    pub fn match_uri_vectored(b: &mut crate::iter::Bytes<'_>) {
120        // SAFETY: calls are guarded by a compile time feature check
121        unsafe { crate::simd::avx2::match_uri_vectored(b) }
122    }
123    
124    #[inline(always)]
125    pub fn match_header_value_vectored(b: &mut crate::iter::Bytes<'_>) {
126        // SAFETY: calls are guarded by a compile time feature check
127        unsafe { crate::simd::avx2::match_header_value_vectored(b) }
128    }
129}
130
131#[cfg(all(
132    httparse_simd,
133    httparse_simd_target_feature_avx2,
134    any(
135        target_arch = "x86",
136        target_arch = "x86_64",
137    ),
138))]
139pub use self::avx2_compile_time::*;
140
141#[cfg(all(
142    httparse_simd,
143    target_arch = "aarch64",
144    httparse_simd_neon_intrinsics,
145))]
146mod neon;
147
148#[cfg(all(
149    httparse_simd,
150    target_arch = "aarch64",
151    httparse_simd_neon_intrinsics,
152))]
153pub use self::neon::*;