diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index a63411f9..1d60b0f5 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -101,6 +101,32 @@ jobs: path: crates/fff-core/tests/fuzz_git_watcher_stress.proptest-regressions if-no-files-found: ignore + build-i686: + name: Build i686-unknown-linux-gnu + runs-on: ubuntu-latest + # Verifies that fff-search compiles on 32-bit x86, where std::arch::x86_64 + # is unavailable. SIMD paths are disabled on this target; only the scalar + # fallback should build. See issue #656. + timeout-minutes: 15 + steps: + - uses: actions/checkout@v5 + + - name: Install cross toolchain + run: | + sudo apt-get update + sudo apt-get install -y gcc-multilib g++-multilib + + - name: Install Rust (i686 target) + uses: actions-rust-lang/setup-rust-toolchain@v1.15.4 + with: + target: i686-unknown-linux-gnu + cache: true + cache-on-failure: true + cache-key: "v1-rust-i686" + + - name: Build fff-search for i686 + run: cargo build -p fff-search --target i686-unknown-linux-gnu + fmt: name: cargo fmt runs-on: ubuntu-latest diff --git a/crates/fff-core/src/bigram_filter.rs b/crates/fff-core/src/bigram_filter.rs index b2dd18bb..6ce2a319 100644 --- a/crates/fff-core/src/bigram_filter.rs +++ b/crates/fff-core/src/bigram_filter.rs @@ -593,7 +593,7 @@ fn normalize_byte_scalar(b: u8) -> u8 { #[inline(always)] fn normalize_bytes(src: &[u8], dst: &mut [u8]) { debug_assert!(dst.len() >= src.len()); - #[cfg(any(target_arch = "x86_64", target_arch = "x86"))] + #[cfg(target_arch = "x86_64")] { if std::is_x86_feature_detected!("avx2") { unsafe { normalize_bytes_avx2(src, dst) }; @@ -620,7 +620,7 @@ fn normalize_bytes_scalar(src: &[u8], dst: &mut [u8]) { /// AVX2 normalize: 32 bytes/iter. AVX2 only has signed cmp, so unsigned /// range checks use `min(max(v, lo), hi) == v`. -#[cfg(any(target_arch = "x86_64", target_arch = "x86"))] +#[cfg(target_arch = "x86_64")] #[target_feature(enable = "avx2")] unsafe fn normalize_bytes_avx2(src: &[u8], dst: &mut [u8]) { use std::arch::x86_64::*; diff --git a/crates/fff-core/src/case_insensitive_memmem.rs b/crates/fff-core/src/case_insensitive_memmem.rs index e0d93a8a..bdbb8b84 100644 --- a/crates/fff-core/src/case_insensitive_memmem.rs +++ b/crates/fff-core/src/case_insensitive_memmem.rs @@ -496,6 +496,10 @@ pub fn search_packed_pair(haystack: &[u8], needle_lower: &[u8]) -> bool { return false; } + #[cfg_attr( + not(any(target_arch = "x86_64", target_arch = "aarch64")), + allow(unused_variables) + )] let (i1, i2) = select_rare_pair(needle_lower); #[cfg(target_arch = "x86_64")]