rust-lang / rust-lang/rust

`asm!` xmm16-31 register usage is reported as zmm on i686 targets in diagnostic

Open
#159,409 4 comments 0 reactions 1 assignee View on GitHub

@qaijuang is already working on this.

Since Jul 28, 2026.

A-diagnostics A-inline-assembly O-x86_32 T-compiler
Dominant language
Rust
Stars
119k
Forks
16.1k
PR merge metrics
PR metrics pending

Description

Code
pub fn foo() {
    unsafe {
        std::arch::asm!(
            "",
            lateout("xmm0") _,
            lateout("xmm8") _,
            lateout("xmm16") _,
            )
    }
}
Current output
error: cannot use register `xmm8`: register is only available on x86_64
 --> <source>:6:13
  |
6 |             lateout("xmm8") _,
  |             ^^^^^^^^^^^^^^^^^

error: cannot use register `zmm16`: register is only available on x86_64
 --> <source>:7:13
  |
7 |             lateout("xmm16") _,
  |             ^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors
Desired output
error: cannot use register `xmm8`: register is only available on x86_64
 --> <source>:6:13
  |
6 |             lateout("xmm8") _,
  |             ^^^^^^^^^^^^^^^^^

error: cannot use register `xmm16`: register is only available on x86_64
 --> <source>:7:13
  |
7 |             lateout("xmm16") _,
  |             ^^^^^^^^^^^^^^^^^^

error: aborting due to 2 previous errors
Rationale and extra context

Registers xmm8-xmm31 are unavailable on 32-bit x86 targets. However, the inline assembly error message reports xmm16 - xmm31 as zmm in the diagnostics (xmm8 - xmm15 are reported as xmm).

This isn't technically wrong due to the way x86 registers are laid out, but a confusing and unnecessary difference in the diagnostic.

Reproduced with i686-pc-windows-msvc and i686-unknown-linux-gnu.

Other cases

Rust Version
rustc 1.99.0-nightly (d0babd8b6 2026-07-15)
binary: rustc
commit-hash: d0babd8b6b05ef9bb65d42f928cef4129d64cf65
commit-date: 2026-07-15
host: x86_64-unknown-linux-gnu
release: 1.99.0-nightly
LLVM version: 22.1.8
Anything else?

No response

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.