Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci: check x86 without simd #170

Merged
merged 2 commits into from
Jun 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 12 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,15 +123,23 @@ jobs:
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.36.0
toolchain: stable
override: true
target: i686-unknown-linux-musl

# Only build, dev-dependencies don't compile on 1.36.0
- name: Build
- name: Test without SIMD
uses: actions-rs/cargo@v1
with:
command: build
command: test
args: --target i686-unknown-linux-musl
env:
CARGO_CFG_HTTPARSE_DISABLE_SIMD_COMPILETIME: 1

- name: Test

uses: actions-rs/cargo@v1
with:
command: test
args: --target i686-unknown-linux-musl

msrv_x64:
Expand Down
14 changes: 2 additions & 12 deletions src/simd/avx2.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,4 @@
#[cfg(target_arch = "x86")]
pub(crate) unsafe fn match_uri_vectored(_: &[u8]) -> usize {
unreachable!("AVX2 detection should be disabled for x86");
}

#[inline]
#[cfg(target_arch = "x86_64")]
#[target_feature(enable = "avx2", enable = "sse4.2")]
pub(crate) unsafe fn match_uri_vectored(bytes: &[u8]) -> usize {
let mut len = 0usize;
Expand All @@ -26,6 +20,7 @@ pub(crate) unsafe fn match_uri_vectored(bytes: &[u8]) -> usize {

#[inline(always)]
#[allow(non_snake_case, overflowing_literals)]
#[allow(unused)]
unsafe fn match_url_char_32_avx(buf: &[u8]) -> usize {
debug_assert!(buf.len() >= 32);

Expand Down Expand Up @@ -64,12 +59,6 @@ unsafe fn match_url_char_32_avx(buf: &[u8]) -> usize {
r.trailing_zeros() as usize
}

#[cfg(target_arch = "x86")]
pub(crate) unsafe fn match_header_value_vectored(_: &[u8]) -> usize {
unreachable!("AVX2 detection should be disabled for x86");
}

#[cfg(target_arch = "x86_64")]
#[target_feature(enable = "avx2", enable = "sse4.2")]
pub(crate) unsafe fn match_header_value_vectored(bytes: &[u8]) -> usize {
let mut len = 0usize;
Expand All @@ -91,6 +80,7 @@ pub(crate) unsafe fn match_header_value_vectored(bytes: &[u8]) -> usize {

#[inline(always)]
#[allow(non_snake_case)]
#[allow(unused)]
unsafe fn match_header_value_char_32_avx(buf: &[u8]) -> usize {
debug_assert!(buf.len() >= 32);

Expand Down
10 changes: 7 additions & 3 deletions src/simd/swar.rs
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,13 @@ fn test_is_header_value_block() {
assert!(!is_header_value_block([b; BLOCK_SIZE]), "b={}", b);
}

// A few sanity checks on non-uniform bytes for safe-measure
assert!(!is_header_value_block(*b"foo.com\n"));
assert!(!is_header_value_block(*b"o.com\r\nU"));

#[cfg(target_pointer_width = "64")]
{
// A few sanity checks on non-uniform bytes for safe-measure
assert!(!is_header_value_block(*b"foo.com\n"));
assert!(!is_header_value_block(*b"o.com\r\nU"));
}
}

#[test]
Expand Down
Loading