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

aarch64 fix for big endian types #1786

Merged
merged 1 commit into from
Oct 3, 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
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:
lucarlig marked this conversation as resolved.
Show resolved Hide resolved
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"))]
lucarlig marked this conversation as resolved.
Show resolved Hide resolved
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