Skip to content

target_features for bit manipulation instruction sets #30462

Closed
@gnzlbg

Description

@gnzlbg

There are currently no target features for bit manipulation instruction sets, in particular:

  • AMD's Advanced Bit Manipulation (ABM) and Trailing Bit Manipulation (TBM) instructions, and
  • Intel's Bit Manipulation Instructions (BMI1 and BMI2).

Since clang has macros to detect these I guess llvm offers the ability to obtain this functionality from the CPUID as well.

Wikipedia offers a pretty good and brief review of the situation. Basically all modern processors support ABM and BMI1. Modern Intel CPUs support BMI2, and next generation AMD CPUs will as well.

AMD also has TBM but these won't be supported anymore in future CPUs.

Huon's llvmin offers intrinsics for all these instruction sets but without a target config macro there is no way of wrapping these into a higher level safer abstraction portably.

So basically I would like to have target features to use in #[cfg(_)] for: amb, bmi1,bmi2, and tmb.

Metadata

Metadata

Assignees

No one assigned

    Labels

    C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-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