summaryrefslogtreecommitdiffstats
path: root/tests/pretty/asm.rs
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-04-17 12:19:03 +0000
commit64d98f8ee037282c35007b64c2649055c56af1db (patch)
tree5492bcf97fce41ee1c0b1cc2add283f3e66cdab0 /tests/pretty/asm.rs
parentAdding debian version 1.67.1+dfsg1-1. (diff)
downloadrustc-64d98f8ee037282c35007b64c2649055c56af1db.tar.xz
rustc-64d98f8ee037282c35007b64c2649055c56af1db.zip
Merging upstream version 1.68.2+dfsg1.
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'tests/pretty/asm.rs')
-rw-r--r--tests/pretty/asm.rs31
1 files changed, 31 insertions, 0 deletions
diff --git a/tests/pretty/asm.rs b/tests/pretty/asm.rs
new file mode 100644
index 000000000..1a3f972c8
--- /dev/null
+++ b/tests/pretty/asm.rs
@@ -0,0 +1,31 @@
+// pretty-mode:expanded
+// pp-exact:asm.pp
+// only-x86_64
+
+use std::arch::asm;
+
+pub fn main() {
+ let a: i32;
+ let mut b = 4i32;
+ unsafe {
+ asm!("");
+ asm!("", options());
+ asm!("", options(nostack, nomem));
+ asm!("{}", in(reg) 4);
+ asm!("{0}", out(reg) a);
+ asm!("{name}", name = inout(reg) b);
+ asm!("{} {}", out(reg) _, inlateout(reg) b => _);
+ asm!("", out("al") _, lateout("rcx") _);
+ asm!("inst1", "inst2");
+ asm!("inst1 {}, 42", "inst2 {}, 24", in(reg) a, out(reg) b);
+ asm!("inst2 {1}, 24", "inst1 {0}, 42", in(reg) a, out(reg) b);
+ asm!("inst1 {}, 42", "inst2 {name}, 24", in(reg) a, name = out(reg) b);
+ asm!(
+ "inst1
+inst2"
+ );
+ asm!("inst1\ninst2");
+ asm!("inst1\n\tinst2");
+ asm!("inst1\ninst2", "inst3\ninst4");
+ }
+}