about summary refs log tree commit diff
path: root/src/libcore
diff options
context:
space:
mode:
authorCorey Farwell <coreyf@rwell.org>2017-07-14 20:57:15 -0700
committerGitHub <noreply@github.com>2017-07-14 20:57:15 -0700
commit721f736b1b5a6b80c58dcd302c0200e831320ec9 (patch)
tree9ebb86e24156b95201fbf94b9f3c554934243c4c /src/libcore
parentc3a8347349fcde088f8dffaa0467ba77ccb5b4de (diff)
parent77bd4dc65406ba3cedbc779e6f6280868231912e (diff)
downloadrust-721f736b1b5a6b80c58dcd302c0200e831320ec9.tar.gz
rust-721f736b1b5a6b80c58dcd302c0200e831320ec9.zip
Rollup merge of #43159 - cuviper:ptr-swap-simd, r=arielb1
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
Diffstat (limited to 'src/libcore')
-rw-r--r--src/libcore/ptr.rs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/libcore/ptr.rs b/src/libcore/ptr.rs
index 92470299366..4f118f58441 100644
--- a/src/libcore/ptr.rs
+++ b/src/libcore/ptr.rs
@@ -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);