Files
rust/tests/pretty/asm-operand-order.pp
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

20 lines
458 B
Rust

#![feature(prelude_import)]
#![no_std]
extern crate std;
#[prelude_import]
use ::std::prelude::rust_2015::*;
//@ pretty-mode:expanded
//@ pp-exact:asm-operand-order.pp
//@ only-x86_64
use std::arch::asm;
pub fn main() {
unsafe {
asm!("{0}", in(reg) 4, out("rax") _);
asm!("{0}", in(reg) 4, out("rax") _, options(nostack));
asm!("{0} {1}", in(reg) 4, in(reg) 5, out("rax") _);
asm!("{0}", const 5, out("rax") _);
}
}