Skip to content

Commit 77bd4dc

Browse files
committed
Disable big-endian simd in swap_nonoverlapping_bytes
This is a workaround for #42778, which was git-bisected to #40454's optimizations to `mem::swap`, later moved to `ptr` in #42819. Natively compiled rustc couldn't even compile stage1 libcore on powerpc64 and s390x, but they work fine without this `repr(simd)`. Since powerpc64le works OK, it seems probably related to being big-endian. The underlying problem is not yet known, but this at least makes those architectures functional again in the meantime. cc @arielb1
1 parent bf0a9e0 commit 77bd4dc

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/libcore/ptr.rs

+4-1
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,10 @@ unsafe fn swap_nonoverlapping_bytes(x: *mut u8, y: *mut u8, len: usize) {
160160
// #[repr(simd)], even if we don't actually use this struct directly.
161161
//
162162
// FIXME repr(simd) broken on emscripten and redox
163-
#[cfg_attr(not(any(target_os = "emscripten", target_os = "redox")), repr(simd))]
163+
// It's also broken on big-endian powerpc64 and s390x. #42778
164+
#[cfg_attr(not(any(target_os = "emscripten", target_os = "redox",
165+
target_endian = "big")),
166+
repr(simd))]
164167
struct Block(u64, u64, u64, u64);
165168
struct UnalignedBlock(u64, u64, u64, u64);
166169

0 commit comments

Comments
 (0)