Skip to content

Commit

Permalink
Sse4 fix (#178)
Browse files Browse the repository at this point in the history
* restore a test that wasn't marked as a test.

* remove the case that calls non-existing functions

* add a CI to prevent this from happening again.

* conditional sse4.1 testing
  • Loading branch information
Lokathor authored Aug 12, 2024
1 parent f218560 commit d099f72
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 11 deletions.
12 changes: 8 additions & 4 deletions .github/workflows/rust.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ jobs:
- { target: i686-pc-windows-msvc, toolchain: beta, os: windows-latest }
- { target: i686-pc-windows-msvc, toolchain: nightly, os: windows-latest }
# x86_64
- { target: x86_64-pc-windows-msvc, toolchain: "1.61", os: windows-latest }
- { target: x86_64-pc-windows-msvc, toolchain: stable, os: windows-latest }
- { target: x86_64-pc-windows-msvc, toolchain: beta, os: windows-latest }
- { target: x86_64-pc-windows-msvc, toolchain: nightly, os: windows-latest }
- { target: x86_64-unknown-linux-gnu, toolchain: "1.61", os: ubuntu-latest }
- { target: x86_64-unknown-linux-gnu, toolchain: stable, os: ubuntu-latest }
- { target: x86_64-unknown-linux-gnu, toolchain: beta, os: ubuntu-latest }
- { target: x86_64-unknown-linux-gnu, toolchain: nightly, os: ubuntu-latest }
# aarch64
- { target: aarch64-apple-darwin, toolchain: "1.61", os: macos-latest }
- { target: aarch64-apple-darwin, toolchain: stable, os: macos-latest }
Expand Down Expand Up @@ -59,6 +59,10 @@ jobs:
env:
CARGO_TARGET_WASM32_WASI_RUNNER: wasmtime run --wasm-features all --dir .
run: cargo test --target ${{ matrix.rust.target }} --all-features

- name: Build the crate with SSE4.1 (the "native" of CI will be above this)
if: matrix.rust.os == 'ubuntu-latest' && matrix.rust.target == 'x86_64-unknown-linux-gnu'
run: RUSTFLAGS="-Ctarget-feature=+sse4.1" cargo build --target ${{ matrix.rust.target }}

- name: switch over to native cpu features
run: mv .cargo-ci .cargo
Expand Down
7 changes: 1 addition & 6 deletions src/u16x16_.rs
Original file line number Diff line number Diff line change
Expand Up @@ -231,18 +231,13 @@ impl Mul for u16x16 {
}

impl From<u8x16> for u16x16 {
/// widens and sign extends to i16x16
/// widens and sign extends to u16x16
#[inline]
#[must_use]
fn from(v: u8x16) -> Self {
pick! {
if #[cfg(target_feature="avx2")] {
u16x16 { avx2:convert_to_i16_m256i_from_u8_m128i(v.sse) }
} else if #[cfg(target_feature="sse4.1")] {
u16x16 {
a: u16x8 { sse: convert_to_i16_m128i_from_lower8_u8_m128i(v.sse) },
b: u16x8 { sse: convert_to_i16_m128i_from_lower8_u8_m128i(unpack_high_i64_m128i(v.sse, v.sse)) }
}
} else if #[cfg(target_feature="sse2")] {
u16x16 {
a: u16x8 { sse: shr_imm_u16_m128i::<8>( unpack_low_i8_m128i(v.sse, v.sse)) },
Expand Down
3 changes: 2 additions & 1 deletion tests/all_tests/t_u32x8.rs
Original file line number Diff line number Diff line change
Expand Up @@ -268,7 +268,8 @@ fn impl_u32x8_from_u16x8() {
|a, _b| a as u32,
);
}


#[test]
fn test_u32x8_any() {
let a = u32x8::from([0, 0, 0, u32::MAX, 0, 0, 0, 0]);
assert!(a.any());
Expand Down

0 comments on commit d099f72

Please sign in to comment.