Skip to content

Commit

Permalink
init commit for the gf2 avx256 fix
Browse files Browse the repository at this point in the history
  • Loading branch information
tonyfloatersu committed Jan 22, 2025
1 parent 21678ef commit 9c817ac
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
matrix:
include:
- os: macos-latest
# - os: ubuntu-latest
- os: ubuntu-latest

steps:
- name: Checkout code
Expand Down
24 changes: 12 additions & 12 deletions arith/gf2_128/src/gf2_ext128x8/avx256.rs
Original file line number Diff line number Diff line change
Expand Up @@ -596,10 +596,10 @@ impl ExtensionField for AVX256GF2_128x8 {
let v7 = -((base.v & 1u8) as i64);

let mut res = *self;
res.data[0] = unsafe { _mm256_and_si256(res.data[0], _mm256_set_epi64x(v0, v0, v2, v2)) };
res.data[1] = unsafe { _mm256_and_si256(res.data[1], _mm256_set_epi64x(v4, v4, v6, v6)) };
res.data[2] = unsafe { _mm256_and_si256(res.data[2], _mm256_set_epi64x(v1, v1, v3, v3)) };
res.data[3] = unsafe { _mm256_and_si256(res.data[3], _mm256_set_epi64x(v5, v5, v7, v7)) };
res.data[0] = unsafe { _mm256_and_si256(res.data[0], _mm256_set_epi64x(v1, v1, v0, v0)) };
res.data[1] = unsafe { _mm256_and_si256(res.data[1], _mm256_set_epi64x(v3, v3, v2, v2)) };
res.data[2] = unsafe { _mm256_and_si256(res.data[2], _mm256_set_epi64x(v5, v5, v4, v4)) };
res.data[3] = unsafe { _mm256_and_si256(res.data[3], _mm256_set_epi64x(v7, v7, v6, v6)) };

res
}
Expand All @@ -616,10 +616,10 @@ impl ExtensionField for AVX256GF2_128x8 {
let v7 = (base.v & 1u8) as i64;

let mut res = *self;
res.data[0] = unsafe { _mm256_xor_si256(res.data[0], _mm256_set_epi64x(0, v0, 0, v2)) };
res.data[1] = unsafe { _mm256_xor_si256(res.data[1], _mm256_set_epi64x(0, v4, 0, v6)) };
res.data[2] = unsafe { _mm256_xor_si256(res.data[2], _mm256_set_epi64x(0, v1, 0, v3)) };
res.data[3] = unsafe { _mm256_xor_si256(res.data[3], _mm256_set_epi64x(0, v5, 0, v7)) };
res.data[0] = unsafe { _mm256_xor_si256(res.data[0], _mm256_set_epi64x(0, v1, 0, v0)) };
res.data[1] = unsafe { _mm256_xor_si256(res.data[1], _mm256_set_epi64x(0, v3, 0, v2)) };
res.data[2] = unsafe { _mm256_xor_si256(res.data[2], _mm256_set_epi64x(0, v5, 0, v4)) };
res.data[3] = unsafe { _mm256_xor_si256(res.data[3], _mm256_set_epi64x(0, v7, 0, v6)) };

res
}
Expand Down Expand Up @@ -729,10 +729,10 @@ impl From<GF2x8> for AVX256GF2_128x8 {

AVX256GF2_128x8 {
data: [
unsafe { _mm256_set_epi64x(0, v0, 0, v2) }, // even
unsafe { _mm256_set_epi64x(0, v4, 0, v6) }, // even
unsafe { _mm256_set_epi64x(0, v1, 0, v3) }, // odd
unsafe { _mm256_set_epi64x(0, v5, 0, v7) }, // odd
unsafe { _mm256_set_epi64x(0, v1, 0, v0) },
unsafe { _mm256_set_epi64x(0, v3, 0, v2) },
unsafe { _mm256_set_epi64x(0, v5, 0, v4) },
unsafe { _mm256_set_epi64x(0, v7, 0, v6) },
],
}
}
Expand Down

0 comments on commit 9c817ac

Please sign in to comment.