rust-lang / rust

Empowering everyone to build reliable and efficient software.
https://www.rust-lang.org
Other
97.95k stars 12.68k forks source link

aarch64 neon intrinsics broken after #90621 #95002

Closed hkratz closed 2 years ago

hkratz commented 2 years ago

90621 causes a compile-time error on every aarch64 function which just has the neon feature explicitly enabled via #[target_feature(enable = "neon"), even if fp is enabled implicitly. This will cause a good amount of breakage across the ecosystem - Github Code Search. After this change even running TARGET=aarch64-apple-darwin cargo test on stdarch fails with lots of compile-time errors.

Apparently the stdarch build problems also cause any usage of aarch64 intrinsics to fail in current nightly. Trying to compile this:

fn main() {
    unsafe {
        let _ = core::arch::aarch64::vmovq_n_u8(0);
    }
}

results in:

$ cargo +nightly build
   Compiling xx v0.1.0 (/Users/hans/dev/xx)
error: the target features fp, neon must all be either enabled or disabled together
    --> /Users/hans/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/arm_shared/neon/mod.rs:5191:1
     |
5191 | #[target_feature(enable = "neon")]
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = help: add the missing features in a `target_feature` attribute

error: the target features fp, neon must all be either enabled or disabled together
    --> /Users/hans/.rustup/toolchains/nightly-aarch64-apple-darwin/lib/rustlib/src/rust/library/core/src/../../stdarch/crates/core_arch/src/arm_shared/neon/mod.rs:5721:1
     |
5721 | #[target_feature(enable = "neon")]
     | ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
     |
     = help: add the missing features in a `target_feature` attribute

error: could not compile `xx` due to 2 previous errors

(I found out because of a sudden CI failure for simdutf8 here.)

Originally posted by @hkratz in https://github.com/rust-lang/rust/issues/90621#issuecomment-1068998914

@rustbot label O-arm A-simd C-bug

adamgemmell commented 2 years ago

Working on a fix for this.