Skip to content

Arm feature detection: Never detecting neon on Raspberry pi 4 #966

Closed
@bluss

Description

@bluss

Testing on an rpi 4 (64-bit ARM) with 32-bit userland target armv7-unknown-linux-gnueabihf (common rpi configuration).

is_arm_feature_detected!("neon") always returns false.

Test program test.rs:

#![feature(stdsimd)]
fn main() {
    dbg!(is_arm_feature_detected!("neon"));
    dbg!(cfg!(target_feature = "neon"));
    dbg!(is_arm_feature_detected!("crc"));
    dbg!(cfg!(target_feature = "crc"));
}

Running the program, detection reports false:

$ rustc +nightly test.rs  && ./test
[test.rs:5] is_arm_feature_detected!("neon") = false
[test.rs:6] cfg!(target_feature = "neon") = false
[test.rs:7] is_arm_feature_detected!("crc") = false
[test.rs:8] cfg!(target_feature = "crc") = false

$ rustc +nightly -Ctarget-feature=+neon test.rs  && ./test
[test.rs:5] is_arm_feature_detected!("neon") = false
[test.rs:6] cfg!(target_feature = "neon") = true
[test.rs:7] is_arm_feature_detected!("crc") = false
[test.rs:8] cfg!(target_feature = "crc") = false

$ rustc +nightly -Ctarget-feature=+neon,+crc test.rs  && ./test
[test.rs:5] is_arm_feature_detected!("neon") = false
[test.rs:6] cfg!(target_feature = "neon") = true
[test.rs:7] is_arm_feature_detected!("crc") = false
[test.rs:8] cfg!(target_feature = "crc") = true

The auxvec should report neon in this case, looks like it does:

$ LD_SHOW_AUXV=1 cat /dev/null
AT_SYSINFO_EHDR: 0xbefe1000
AT_HWCAP:        half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae evtstrm
...

And for intrinsics like vaddq_f32 it does emit the expected add instruction.

Rust version: rustc 1.50.0-nightly (0f6f2d681 2020-12-06)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions