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