Skip to content

asm macro does not understand that enabling the target feature avx2 implies avx  #128125

Closed
@shepmaster

Description

@shepmaster

I tried this code:

#[target_feature(enable = "avx2")]
unsafe fn demo(v: std::arch::x86_64::__m256i) {
    std::arch::asm!("/* {v} */", v = in(ymm_reg) v);
}

According to the Rust Reference, the avx2 feature should imply the avx feature (and further features), so I expected the code to compile.

Instead, this happened:

error: register class `ymm_reg` requires the `avx` target feature
 --> src/lib.rs:3:34
  |
3 |     std::arch::asm!("/* {v} */", v = in(ymm_reg) v);
  |                                  ^^^^^^^^^^^^^^^^^

Meta

  • 1.79.0
  • 1.81.0-nightly (2024-07-12 c6727fc)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-inline-assemblyArea: Inline assembly (`asm!(…)`)A-target-featureArea: Enabling/disabling target features like AVX, Neon, etc.C-bugCategory: This is a bug.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.T-libsRelevant to the library 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