Skip to content

inline assembly register limits aren't correct when using instruction_set attribute #92378

Closed
@Lokathor

Description

@Lokathor

First discussed on zulip.

Quick summary: the set of what registers are available for inline assembly is related to the current target arch. However, the instruction_set attribute lets a function be compiled for what's effectively an alternate arch. This should allow the other arch's registers to be used, but currently that's not the case.

  • Specifically for ARM a32/t32, the thumb-mode target attribute is either not present (a32) or present (t32) in the target, and using the instruction_set attribute lets you have the opposite mode.
  • Note: The actual assembly code is already compiled correctly on LLVM's side, it's just that rustc gives you the incorrect register class limits.

Quoting Amanieu's Zulip post on the probable fix for this:

You'd need to somehow remove the thumb-mode target feature from the list passed to the asm handling code in ast_lowering and intrinsicck when the containing function uses the a32 ISA.

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-inline-assemblyArea: Inline assembly (`asm!(…)`)C-bugCategory: This is a bug.F-asm`#![feature(asm)]` (not `llvm_asm`)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