Files
rust/tests/pretty/asm-operand-order.rs
Andrew V. Teylu 23411ce166 Refactor asm pretty-print operand reordering and broaden regression coverage
Extract the inline asm operand reorder/remap logic into a dedicated helper so
`print_inline_asm` stays focused on assembling the printed argument list.
This keeps the reordered-template logic local to the AST pretty printer while
making the main printing path easier to read.

Also extend the pretty regression test with a `const` operand case. That checks
that non-register operands other than `in(reg)` are also moved ahead of explicit
register operands and that the remapped template indices still match the new
operand order.

Signed-off-by: Andrew V. Teylu <andrew.teylu@vector.com>
2026-03-23 08:47:54 +00:00

15 lines
381 B
Rust

//@ pretty-mode:expanded
//@ pp-exact:asm-operand-order.pp
//@ only-x86_64
use std::arch::asm;
pub fn main() {
unsafe {
asm!("{val}", out("rax") _, val = in(reg) 4);
asm!("{val}", out("rax") _, val = in(reg) 4, options(nostack));
asm!("{a} {b}", out("rax") _, a = in(reg) 4, b = in(reg) 5);
asm!("{val}", out("rax") _, val = const 5);
}
}