Skip to content

[zerocopy] Re-enable big endian aarch64 types#3073

Open
197g wants to merge 1 commit intogoogle:mainfrom
197g:main
Open

[zerocopy] Re-enable big endian aarch64 types#3073
197g wants to merge 1 commit intogoogle:mainfrom
197g:main

Conversation

@197g
Copy link

@197g 197g commented Feb 27, 2026

When initially released the LLVM semantics did not agree with the intrinsics in the order of lanes and hence they got removed from stable on big endian targets. The fix of these semantics was shipped with Rust 1.87 in March 2025 (rust-lang/rust#136831).

To keep the library working in these previous compiler versions the intrinsics are enabled by their prior condition, a little endian target is detected, or the feature detection cfg of the more recent rust release is present.

Interesting point: the tests were never gated on target_endian = "little" so it seems that CI is not configured for any big endian aarch64 platform.

@gemini-code-assist
Copy link
Contributor

Warning

You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again!

@google-cla
Copy link

google-cla bot commented Feb 27, 2026

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

@codecov-commenter
Copy link

codecov-commenter commented Feb 27, 2026

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 91.87%. Comparing base (ff5ab2d) to head (d8cae7c).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #3073   +/-   ##
=======================================
  Coverage   91.87%   91.87%           
=======================================
  Files          20       20           
  Lines        6057     6057           
=======================================
  Hits         5565     5565           
  Misses        492      492           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@197g
Copy link
Author

197g commented Feb 27, 2026

I don't know what it wants me to change in the CI file. Adding the new flag to the matrix is straightforward but the jobs/build_test/matrix/exclude section is odd. I suppose it should copy whatever is defined for no-zerocopy-aarch64-simd-1-59-0?

When initially released the LLVM semantics did not agree with the
intrinsics in the order of lanes and hence they got removed from stable
on big endian targets. The fix of these semantics was shipped with Rust
1.87 in March 2025 (<rust-lang/rust#136831>).

To keep the library working in these previous compiler versions the
intrinsics are enabled by their prior condition, a little endian target
is detected, or the feature detection cfg of the more recent rust
release is present.
Copy link
Collaborator

@jswrenn jswrenn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this, and sorry for the late reply! Looks great, just a few small nits.

Comment on lines -1355 to -1356
// NOTE(https://github.com/rust-lang/stdarch/issues/1484): NEON intrinsics are currently
// broken on big-endian platforms.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you keep some sort of comment here, that explains the fairly complex cfg below?

Comment on lines +1359 to +1362
#[cfg_attr(
all(doc_cfg, target_endian = "little"),
doc(cfg(rust = "1.59.0"))
)]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#[cfg_attr(
all(doc_cfg, target_endian = "little"),
doc(cfg(rust = "1.59.0"))
)]
#[cfg_attr(
doc_cfg,
doc(cfg(all(target_arch = "aarch64", any(
all(rust = "1.59.0", target_endian = "little"),
rust = "1.87.0",
))))
)]

Comment on lines +1355 to +1358
#[cfg(any(
all(target_arch = "aarch64", target_endian = "little"),
all(target_arch = "aarch64", not(no_zerocopy_aarch64_simd_be_1_87_0))
))]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Factor out the target_arch = "aarch64"?

Suggested change
#[cfg(any(
all(target_arch = "aarch64", target_endian = "little"),
all(target_arch = "aarch64", not(no_zerocopy_aarch64_simd_be_1_87_0))
))]
#[cfg(all(
target_arch = "aarch64",
any(
target_endian = "little",
not(no_zerocopy_aarch64_simd_be_1_87_0)
)
))]

no-zerocopy-aarch64-simd-1-59-0 = "1.59.0"

# Include SIMD types from `core::arch::aarch64` on big endian targets. Prior to
# 1.87.0 (#136831) the types were only correct on little endian and backed off
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
# 1.87.0 (#136831) the types were only correct on little endian and backed off
# 1.87.0 (https://github.com/rust-lang/rust/pull/136831) the types were only correct on little endian and backed off

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants