Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

AArch64: target_feature=pmuv3 should not be assumed by default for all CPUs. #95319

Open
pthariensflame opened this issue Mar 25, 2022 · 1 comment
Labels
C-bug Category: This is a bug. O-AArch64 Armv8-A or later processors in AArch64 mode

Comments

@pthariensflame
Copy link
Contributor

(This is a continuation from the discussion at the end of #95122.)

I tried this shell invocation:

rustc --target aarch64-unknown-none-softfloat --print cfg

I expected to see this happen:
No meaningful target_features should be printed.

Instead, this happened:

debug_assertions
panic="abort"
target_abi="softfloat"
target_arch="aarch64"
target_endian="little"
target_env=""
target_feature="llvm14-builtins-abi"
target_feature="pmuv3"
target_has_atomic="128"
target_has_atomic="16"
target_has_atomic="32"
target_has_atomic="64"
target_has_atomic="8"
target_has_atomic="ptr"
target_has_atomic_equal_alignment="128"
target_has_atomic_equal_alignment="16"
target_has_atomic_equal_alignment="32"
target_has_atomic_equal_alignment="64"
target_has_atomic_equal_alignment="8"
target_has_atomic_equal_alignment="ptr"
target_has_atomic_load_store="128"
target_has_atomic_load_store="16"
target_has_atomic_load_store="32"
target_has_atomic_load_store="64"
target_has_atomic_load_store="8"
target_has_atomic_load_store="ptr"
target_os="none"
target_pointer_width="64"
target_vendor="unknown"

There's apparently an assumption that pmuv3 is always unconditionally available, which is demonstrably not true; this originally came up as an issue for the Apple M1 family of platforms, which have their own non-standard PMU instead, but even in the Arm ARM it states that FEAT_PMUv3 is optional. This problem occurs not just for aarch64-unknown-none-softfloat but for all aarch64 targets in current (2022-03-24) nightly.

Meta

rustc --version --verbose:

rustc 1.61.0-nightly (63b8f01bb 2022-03-24)
binary: rustc
commit-hash: 63b8f01bb5ca277e7df8d7efe094ed4244c1790c
commit-date: 2022-03-24
host: x86_64-apple-darwin
release: 1.61.0-nightly
LLVM version: 14.0.0
@pthariensflame pthariensflame added the C-bug Category: This is a bug. label Mar 25, 2022
@workingjubilee workingjubilee added the O-AArch64 Armv8-A or later processors in AArch64 mode label Mar 27, 2022
@briansmith
Copy link
Contributor

briansmith commented May 12, 2024

$ rustc +1.61.0 --target aarch64-unknown-none-softfloat --print cfg | grep feature
target_feature="pmuv3"
$ rustc +1.61.0 --target aarch64-unknown-none --print cfg | grep feature
target_feature="neon"
target_feature="pmuv3"
$ rustc +1.71.0 --target aarch64-unknown-none-softfloat --print cfg | grep feature
$ rustc +1.71.0 --target aarch64-unknown-none --print cfg | grep feature
target_feature="neon"
$ rustc +stable --version
rustc 1.78.0 (9b00956e5 2024-04-29)
$ rustc +stable --target aarch64-unknown-none-softfloat --print cfg | grep feature
$ rustc +stable --target aarch64-unknown-none --print cfg | grep feature
target_feature="neon"

So this seems to have been fixed sometime before 1.71.0.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
C-bug Category: This is a bug. O-AArch64 Armv8-A or later processors in AArch64 mode
Projects
None yet
Development

No branches or pull requests

3 participants