Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
bkolobara opened this issue Aug 21, 2020 · 0 comments · Fixed by #75781
Closed

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

bkolobara opened this issue Aug 21, 2020 · 0 comments · Fixed by #75781
Assignees
Labels
C-bug Category: This is a bug. F-asm `#![feature(asm)]` (not `llvm_asm`) O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.

Comments

@bkolobara
Copy link

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.

@bkolobara bkolobara added the C-bug Category: This is a bug. label Aug 21, 2020
@jonas-schievink jonas-schievink added F-asm `#![feature(asm)]` (not `llvm_asm`) O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state T-compiler Relevant to the compiler team, which will review and decide on the PR/issue. labels Aug 21, 2020
@Amanieu Amanieu self-assigned this Aug 21, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Aug 22, 2020
More inline asm register name fixups for LLVM

Fixes rust-lang#75761

r? @nagisa
@bors bors closed this as completed in 60b7c2a Aug 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-bug Category: This is a bug. F-asm `#![feature(asm)]` (not `llvm_asm`) O-Arm Target: 32-bit Arm processors (armv6, armv7, thumb...), including 64-bit Arm in AArch32 state T-compiler Relevant to the compiler team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants