Skip to content

Marking registers as clobbered on AArch64 inside an asm! block fails to compile #75761

Closed

Description

@bkolobara

If any of the floating point registers (v0-31) or x30 on AArch64 are used as an out parameter the code doesn't compile. The following code using v0 fails to compile on rustc 1.47.0-nightly (e15510ca3 2020-08-20):

#![feature(asm)]

fn main() {
    unsafe {
        asm!(
             "",
             out("v0") _
        );
    }
}

with an error:

error: non-trivial scalar-to-vector conversion, possible invalid constraint for vector type
 --> src/main.rs:6:15
  |
6 |              "",
  |               ^

If x30 is used instead of v0 another error message is shown:

error: couldn't allocate output register for constraint '{x30}'
 --> src/main.rs:6:15
  |
6 |              "",
  |               ^

I expect it to be possible to use all these registers as parameters to out.

Activity

  1. added
    F-asm`#![feature(asm)]` (not `llvm_asm`)
    O-ArmTarget: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state
    T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.
    on Aug 21, 2020
  2. self-assigned this
    on Aug 21, 2020
  3. added a commit that references this issue on Aug 21, 2020
    60b7c2a
  4. added a commit that references this issue on Aug 22, 2020
    cb9ef09
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

C-bugCategory: This is a bug.F-asm`#![feature(asm)]` (not `llvm_asm`)O-ArmTarget: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 stateT-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