-
Notifications
You must be signed in to change notification settings - Fork 12.9k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Failure in run-pass/simd/simd-intrinsic-generic-select on Big-Endian Targets #59356
Comments
From rust-lang/stdarch#310 (comment) it looks like that the bitcast is the intended semantics, so that would mean the test is invalid on big-endian targets. Thoughts, @gnzlbg @alexcrichton ? |
This, we should only enable the test for little endian platforms, maybe adding a new test for big endian platforms. |
c-link-to-rust-va-list-fn: unstable feature, broken on aarch64, rust-lang#56475 env-funky-keys: can't handle LD_PRELOAD (e.g. sandbox) long-linker-command-lines: takes >10 minutes to run (but still passes) simd-intrinsic-generic-bitmask.rs: broken on BE, rust-lang#59356 simd-intrinsic-generic-select.rs: broken on BE, rust-lang#59356 sparc-struct-abi: no sparc target sysroot-crates-are-unstable: can't run rustc without RPATH
Per rust-lang#59356 it is expected that the interpretation of the bitmask depends on target endianness. Closes rust-lang#59356
Disable simd_select_bitmask test on big endian Per rust-lang#59356 it is expected that the interpretation of the bitmask depends on target endianness. Closes rust-lang#59356
c-link-to-rust-va-list-fn: unstable feature, broken on aarch64, rust-lang#56475 env-funky-keys: can't handle LD_PRELOAD (e.g. sandbox) long-linker-command-lines: takes >10 minutes to run (but still passes) simd-intrinsic-generic-bitmask.rs: broken on BE, rust-lang#59356 sparc-struct-abi: no sparc target sysroot-crates-are-unstable: can't run rustc without RPATH
c-link-to-rust-va-list-fn: unstable feature, broken on aarch64, rust-lang#56475 env-funky-keys: can't handle LD_PRELOAD (e.g. sandbox) long-linker-command-lines: takes >10 minutes to run (but still passes) simd-intrinsic-generic-bitmask.rs: broken on BE, rust-lang#59356 sparc-struct-abi: no sparc target sysroot-crates-are-unstable: can't run rustc without RPATH
c-link-to-rust-va-list-fn: unstable feature, broken on aarch64, rust-lang#56475 env-funky-keys: can't handle LD_PRELOAD (e.g. sandbox) long-linker-command-lines: takes >10 minutes to run (but still passes) simd-intrinsic-generic-bitmask.rs: broken on BE, rust-lang#59356 sparc-struct-abi: no sparc target sysroot-crates-are-unstable: can't run rustc without RPATH
c-link-to-rust-va-list-fn: unstable feature, broken on aarch64, rust-lang#56475 env-funky-keys: can't handle LD_PRELOAD (e.g. sandbox) long-linker-command-lines: takes >10 minutes to run (but still passes) simd-intrinsic-generic-bitmask.rs: broken on BE, rust-lang#59356 sparc-struct-abi: no sparc target sysroot-crates-are-unstable: can't run rustc without RPATH
c-link-to-rust-va-list-fn: unstable feature, broken on aarch64, rust-lang#56475 env-funky-keys: can't handle LD_PRELOAD (e.g. sandbox) long-linker-command-lines: takes >10 minutes to run (but still passes) simd-intrinsic-generic-bitmask.rs: broken on BE, rust-lang#59356 sparc-struct-abi: no sparc target sysroot-crates-are-unstable: can't run rustc without RPATH
c-link-to-rust-va-list-fn: unstable feature, broken on aarch64, rust-lang#56475 env-funky-keys: can't handle LD_PRELOAD (e.g. sandbox) long-linker-command-lines: takes >10 minutes to run (but still passes) simd-intrinsic-generic-bitmask.rs: broken on BE, rust-lang#59356 sparc-struct-abi: no sparc target sysroot-crates-are-unstable: can't run rustc without RPATH
This was found while building rustc 1.33.0 on
powerpc64-unknown-linux-musl
. Testrun-pass/simd/simd-intrinsic-generic-select
fails at the thirdsimd_select_bitmask
test:The LLVM IR generated for this test case on
x86_64-unknown-linux-musl
andpowerpc64-unknown-linux-musl
(respectively) is identical:The test appears to expect that the bitmask is interpreted as bitwise little-endian (in other words, the LSB selects the first element from the vectors). However, the implementation uses a bitcast to a vector of
i1
. On big-endian architectures such as powerpc64, the LSB becomes the last element of thisi1
vector, not the first.Unfortunately, all of the upstream test cases are symmetrical, so "choosing the wrong vector" and "reading the bitmask backwards" are indistinguishable. I added an additional test case:
This passes on
x86_64-unknown-linux-musl
, but fails onpowerpc64-unknown-linux-musl
with:The two "unlike" elements were chosen from the wrong place in the vector.
Since the vectors are 256 bits, and the POWER VSX registers are only 128 bits wide, LLVM must split each vector across two registers. The following powerpc64 assembly is from the last test case (
0b11110000u8
), and clearly shows that LLVM (not the hardware) picks the first half ofa
and the second half ofb
:So is this a bug in the test, because it should be ensuring that the bitmask is in native vector/endian order? Or in the implementation of
simd_select_bitmask
, because it should always take a little-endian bitmask and reverse the bits as necessary?The text was updated successfully, but these errors were encountered: