Skip to content

Inline ASM: Registers in the dreg_low16 register class fail cause compilation failures when the d32 target feature is disabled #126797

Closed
@beetrees

Description

@beetrees

I tried this code, compiled for the armv7-unknown-linux-gnueabihf target:

// Fails to compile
fn f(x: f64) {
    unsafe {
        let out: f64;
        std::arch::asm!("vmov.f64 d1, d0", out("d1") out, in("d0") x);
    }
}

I expected to see this happen: Successful compilation, as the following code successfully compiles, and d0 and d1 are members of the dreg_low16 register class:

// Successfully compiles
fn f(x: f64) {
    unsafe {
        let out: f64;
        std::arch::asm!("vmov.f64 {}, {}", out(dreg_low16) out, in(dreg_low16) x);
    }
}

Instead, this happened: Compilation fails with the following error message:

error: register class `dreg` requires the `d32` target feature
 --> <source>:5:44
  |
5 |         std::arch::asm!("vmov.f64 d1, d0", out("d1") out, in("d0") x);
  |                                            ^^^^^^^^^^^^^

error: register class `dreg` requires the `d32` target feature
 --> <source>:5:59
  |
5 |         std::arch::asm!("vmov.f64 d1, d0", out("d1") out, in("d0") x);
  |                                                           ^^^^^^^^^^

error: aborting due to 2 previous errors

Meta

rustc --version --verbose:

rustc 1.81.0-nightly (d8a38b000 2024-06-19)
binary: rustc
commit-hash: d8a38b00024cd7156dea4ce8fd8ae113a2745e7f
commit-date: 2024-06-19
host: x86_64-unknown-linux-gnu
release: 1.81.0-nightly
LLVM version: 18.1.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-inline-assemblyArea: Inline assembly (`asm!(…)`)C-bugCategory: This is a bug.O-ArmTarget: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions