rust-lang / portable-simd

The testing ground for the future of portable SIMD in Rust
Apache License 2.0
903 stars 81 forks source link

Fix build error on big endian arm/aarch64 #348

Closed taiki-e closed 1 year ago

taiki-e commented 1 year ago

stdarch provides arm/aarch64 table lookup intrinsics instructions only on little endian targets (https://github.com/rust-lang/stdarch/commit/51904cd6e53eaeae2450a96fc83f0e5b7f813504), so core_simd currently fails to build on big endian arm/aarch64 targets.

$ cargo build --target armeb-unknown-linux-gnueabi -Z build-std
   Compiling core_simd v0.1.0 (/Users/taiki/projects/forks/rust-lang/portable-simd/crates/core_simd)
error[E0432]: unresolved import `core::arch::arm::vtbl1_u8`
  --> crates/core_simd/src/swizzle_dyn.rs:22:42
   |
22 |         use core::arch::arm::{uint8x8_t, vtbl1_u8};
   |                                          ^^^^^^^^ no `vtbl1_u8` in `core_arch::arch::arm`

$ cargo build --target aarch64_be-unknown-linux-gnu -Z build-std
   Compiling core_simd v0.1.0 (/Users/taiki/projects/forks/rust-lang/portable-simd/crates/core_simd)
error[E0432]: unresolved imports `core::arch::aarch64::vqtbl1q_u8`, `core::arch::aarch64::vtbl1_u8`
  --> crates/core_simd/src/swizzle_dyn.rs:20:46
   |
20 |         use core::arch::aarch64::{uint8x8_t, vqtbl1q_u8, vtbl1_u8};
   |                                              ^^^^^^^^^^  ^^^^^^^^ no `vtbl1_u8` in `core_arch::arch::aarch64`
   |                                              |
   |                                              no `vqtbl1q_u8` in `core_arch::arch::aarch64`
   |
help: a similar name exists in the module
   |
20 |         use core::arch::aarch64::{uint8x8_t, vst1q_u8, vtbl1_u8};
   |                                              ~~~~~~~~
help: a similar name exists in the module
   |
20 |         use core::arch::aarch64::{uint8x8_t, vqtbl1q_u8, vtrn1_u8};
   |                                                          ~~~~~~~~

Since https://github.com/rust-lang/rust/pull/111475 (nightly-2023-05-13), builds of these targets are broken due to this bug.

calebzulawski commented 1 year ago

@workingjubilee I assume this is fine?

workingjubilee commented 1 year ago

...wild.

workingjubilee commented 1 year ago

This needs to be slightly different, gimme a bit.

Amanieu commented 1 year ago

Can this be synced into rust-lang/rust? It is breaking the build for big-endian AArch64.

workingjubilee commented 1 year ago

Signed and delivered, should be next in the pipe. Sorry about that!