Skip to content

Commit

Permalink
[derive] Use fallback types for big endian types on aarch64
Browse files Browse the repository at this point in the history
  • Loading branch information
lucarlig committed Oct 3, 2024
1 parent a9f09d7 commit fc4691e
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 2 deletions.
36 changes: 35 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -575,6 +575,40 @@ jobs:
# `roll-pinned-toolchain-versions.yml`.
kani-version: 0.55.0

# NEON intrinsics are currently broken on big-endian platforms. [1] This test ensures
# that we don't accidentally attempt to compile these intrinsics on such platforms. We
# can't use this as part of the build matrix because rustup doesn't support the
# `aarch64_be-unknown-linux-gnu` target.
#
# [1] https://github.com/rust-lang/stdarch/issues/1484
check_be_aarch64:
runs-on: ubuntu-latest
name: Build (zerocopy / nightly / --simd / aarch64_be-unknown-linux-gnu)
steps:
- uses: actions/checkout@d632683dd7b4114ad314bca15554477dd762a938 # v4.2.0
- name: Configure environment variables
run: |
set -eo pipefail
ZC_TOOLCHAIN="$(./cargo.sh --version nightly)"
RUSTFLAGS="$RUSTFLAGS $ZC_NIGHTLY_RUSTFLAGS"
echo "RUSTFLAGS=$RUSTFLAGS" >> $GITHUB_ENV
echo "ZC_TOOLCHAIN=$ZC_TOOLCHAIN" >> $GITHUB_ENV
- name: Rust Cache
uses: Swatinem/rust-cache@23bce251a8cd2ffc3c1075eaa2367cf899916d84 # v2.7.3
with:
key: aarch64_be-unknown-linux-gnu
- name: Install stable Rust for use in 'cargo.sh'
uses: dtolnay/rust-toolchain@00b49be78f40fba4e87296b2ead62868750bdd83 # stable
with:
toolchain: stable
- name: Install Rust with nightly toolchain (${{ env.ZC_TOOLCHAIN }}) and target aarch64_be-unknown-linux-gnu
uses: dtolnay/rust-toolchain@00b49be78f40fba4e87296b2ead62868750bdd83 # stable
with:
toolchain: ${{ env.ZC_TOOLCHAIN }}
components: clippy, rust-src
- name: Check big endian for aarch64_be-unknown-linux-gnu target
run: ./cargo.sh +nightly build --target=aarch64_be-unknown-linux-gnu -Zbuild-std --features simd

check_fmt:
runs-on: ubuntu-latest
name: Check Rust formatting
Expand Down Expand Up @@ -704,7 +738,7 @@ jobs:
# https://docs.github.com/en/pull-requests/collaborating-with-pull-requests/collaborating-on-repositories-with-code-quality-features/troubleshooting-required-status-checks#handling-skipped-but-required-checks
if: failure()
runs-on: ubuntu-latest
needs: [build_test, kani, check_fmt, check_readme, check_versions, generate_cache, check-all-toolchains-tested, check-job-dependencies, run-git-hooks]
needs: [build_test, kani,check_be_aarch64 , check_fmt, check_readme, check_versions, generate_cache, check-all-toolchains-tested, check-job-dependencies, run-git-hooks]
steps:
- name: Mark the job as failed
run: exit 1
4 changes: 3 additions & 1 deletion src/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -934,7 +934,9 @@ mod simd {
);
#[cfg(zerocopy_aarch64_simd)]
simd_arch_mod!(
#[cfg(target_arch = "aarch64")]
// NOTE(https://github.com/rust-lang/stdarch/issues/1484): NEON intrinsics are currently
// broken on big-endian platforms.
#[cfg(all(target_arch = "aarch64", target_endian = "little"))]
aarch64, aarch64, float32x2_t, float32x4_t, float64x1_t, float64x2_t, int8x8_t, int8x8x2_t,
int8x8x3_t, int8x8x4_t, int8x16_t, int8x16x2_t, int8x16x3_t, int8x16x4_t, int16x4_t,
int16x8_t, int32x2_t, int32x4_t, int64x1_t, int64x2_t, poly8x8_t, poly8x8x2_t, poly8x8x3_t,
Expand Down

0 comments on commit fc4691e

Please sign in to comment.