Skip to content

Commit 8d10013

Browse files
committed
[zerocopy] Re-enable big endian aarch64 types
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.
1 parent ff5ab2d commit 8d10013

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,11 @@ no-zerocopy-target-has-atomics-1-60-0 = "1.60.0"
7979
# versions, these types require the "simd-nightly" feature.
8080
no-zerocopy-aarch64-simd-1-59-0 = "1.59.0"
8181

82+
# Include SIMD types from `core::arch::aarch64` on big endian targets. Prior to
83+
# 1.87.0 (#136831) the types were only correct on little endian and backed off
84+
# from stable in a breaking change.
85+
no-zerocopy-aarch64-simd-be-1-87-0 = "1.87.0"
86+
8287
# Permit panicking in `const fn`s and calling `Vec::try_reserve`.
8388
no-zerocopy-panic-in-const-and-vec-try-reserve-1-57-0 = "1.57.0"
8489

src/impls.rs

Lines changed: 12 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1352,10 +1352,18 @@ mod simd {
13521352
);
13531353
#[cfg(not(no_zerocopy_aarch64_simd_1_59_0))]
13541354
simd_arch_mod!(
1355-
// NOTE(https://github.com/rust-lang/stdarch/issues/1484): NEON intrinsics are currently
1356-
// broken on big-endian platforms.
1357-
#[cfg(all(target_arch = "aarch64", target_endian = "little"))]
1358-
#[cfg_attr(doc_cfg, doc(cfg(rust = "1.59.0")))]
1355+
#[cfg(any(
1356+
all(target_arch = "aarch64", target_endian = "little"),
1357+
all(target_arch = "aarch64", not(no_zerocopy_aarch64_simd_be_1_87_0))
1358+
))]
1359+
#[cfg_attr(
1360+
all(doc_cfg, target_endian = "little"),
1361+
doc(cfg(rust = "1.59.0"))
1362+
)]
1363+
#[cfg_attr(
1364+
all(doc_cfg, not(target_endian = "little")),
1365+
doc(cfg(rust = "1.87.0"))
1366+
)]
13591367
aarch64, aarch64, float32x2_t, float32x4_t, float64x1_t, float64x2_t, int8x8_t, int8x8x2_t,
13601368
int8x8x3_t, int8x8x4_t, int8x16_t, int8x16x2_t, int8x16x3_t, int8x16x4_t, int16x4_t,
13611369
int16x8_t, int32x2_t, int32x4_t, int64x1_t, int64x2_t, poly8x8_t, poly8x8x2_t, poly8x8x3_t,

0 commit comments

Comments
 (0)