Skip to content

AArch64 target feature cfgs are being incorrectly enabled #95122

Closed

Description

@Amanieu

This seems to have been introduced in nightly 2022-03-16 which includes #90621.

Previous correct behavior:

# rustc +nightly-2022-03-15 --print cfg --target aarch64-unknown-linux-gnu | grep target_feature
target_feature="fp"
target_feature="llvm14-builtins-abi"
target_feature="neon"
target_feature="pmuv3"

New incorrect behavior:

# rustc +nightly-2022-03-16 --print cfg --target aarch64-unknown-linux-gnu | grep target_feature
target_feature="f32mm"
target_feature="f64mm"
target_feature="fhm"
target_feature="fp"
target_feature="fp16"
target_feature="jsconv"
target_feature="llvm14-builtins-abi"
target_feature="neon"
target_feature="pmuv3"
target_feature="sve"
target_feature="sve2"
target_feature="sve2-aes"
target_feature="sve2-bitperm"
target_feature="sve2-sha3"
target_feature="sve2-sm4"

cc @adamgemmell

Activity

  1. added
    C-bugCategory: This is a bug.
    O-AArch64Armv8-A or later processors in AArch64 mode
    on Mar 19, 2022
  2. workingjubilee commented on Mar 19, 2022

    @workingjubilee
    Member

    Commenting out the match arm in to_llvm_features for a given mapping alters the emitted features:

            // Rust ties fp and neon together. In LLVM neon implicitly enables fp,
            // but we manually enable neon when a feature only implicitly enables fp
            ("aarch64", "f32mm") => smallvec!["f32mm", "neon"],
            // ("aarch64", "f64mm") => smallvec!["f64mm", "neon"],
            ("aarch64", "fhm") => smallvec!["fp16fml", "neon"],
            // ("aarch64", "fp16") => smallvec!["fullfp16", "neon"],
            ("aarch64", "jsconv") => smallvec!["jsconv", "neon"],
            // ("aarch64", "sve") => smallvec!["sve", "neon"],
            ("aarch64", "sve2") => smallvec!["sve2", "neon"],
            // ("aarch64", "sve2-aes") => smallvec!["sve2-aes", "neon"],
            ("aarch64", "sve2-sm4") => smallvec!["sve2-sm4", "neon"],
            // ("aarch64", "sve2-sha3") => smallvec!["sve2-sha3", "neon"],
            ("aarch64", "sve2-bitperm") => smallvec!["sve2-bitperm", "neon"],
            (_, s) => smallvec![s],

    Result is:

    $ rustc +stage1 --print cfg --target aarch64-unknown-linux-gnu | grep target_feature
    '+fp16' is not a recognized feature for this target (ignoring feature)
    '+fp16' is not a recognized feature for this target (ignoring feature)
    target_feature="f32mm"
    target_feature="fhm"
    target_feature="fp16"
    target_feature="jsconv"
    target_feature="llvm14-builtins-abi"
    target_feature="neon"
    target_feature="pmuv3"
    target_feature="sve2"
    target_feature="sve2-bitperm"
    target_feature="sve2-sm4"
    
  3. added
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Mar 22, 2022
  4. added a commit that references this issue on Mar 22, 2022
    e77d593
  5. added a commit that references this issue on Mar 23, 2022
    67d6cc6
  6. pthariensflame commented on Mar 24, 2022

    @pthariensflame
    Contributor

    @workingjubilee Should I open a separate issue for the pmuv3 part?

  7. workingjubilee commented on Mar 24, 2022

    @workingjubilee
    Member

    That seems to have been a preexisting feature but yes, if you believe it is in error then feel free to open a new issue about it.

    EDIT: Ah, yeah, I think our target for darwin isn't "an M1", in actuality, and that's what's causing conflict.

  8. pthariensflame commented on Mar 25, 2022

    @pthariensflame
    Contributor

    @workingjubilee Alright; I've opened #95319.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-bugCategory: This is a bug.O-AArch64Armv8-A or later processors in AArch64 modeT-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions