Skip to content

Commit

Permalink
Rollup merge of rust-lang#43159 - cuviper:ptr-swap-simd, r=arielb1
Browse files Browse the repository at this point in the history
Disable big-endian simd in swap_nonoverlapping_bytes

This is a workaround for rust-lang#42778, which was git-bisected to rust-lang#40454's
optimizations to `mem::swap`, later moved to `ptr` in rust-lang#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
  • Loading branch information
frewsxcv authored Jul 15, 2017
2 parents c3a8347 + 77bd4dc commit 721f736
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/libcore/ptr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,10 @@ unsafe fn swap_nonoverlapping_bytes(x: *mut u8, y: *mut u8, len: usize) {
// #[repr(simd)], even if we don't actually use this struct directly.
//
// FIXME repr(simd) broken on emscripten and redox
#[cfg_attr(not(any(target_os = "emscripten", target_os = "redox")), repr(simd))]
// It's also broken on big-endian powerpc64 and s390x. #42778
#[cfg_attr(not(any(target_os = "emscripten", target_os = "redox",
target_endian = "big")),
repr(simd))]
struct Block(u64, u64, u64, u64);
struct UnalignedBlock(u64, u64, u64, u64);

Expand Down

0 comments on commit 721f736

Please sign in to comment.