From c10b6382425aef0787ad11163dc121ee1831ae65 Mon Sep 17 00:00:00 2001 From: 0xb-s <145866191+0xb-s@users.noreply.github.com> Date: Sat, 28 Dec 2024 10:57:07 -0800 Subject: [PATCH] Create asm.rs --- tests_data/basic/rust/asm.rs | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 tests_data/basic/rust/asm.rs diff --git a/tests_data/basic/rust/asm.rs b/tests_data/basic/rust/asm.rs new file mode 100644 index 00000000..90b5e17b --- /dev/null +++ b/tests_data/basic/rust/asm.rs @@ -0,0 +1,21 @@ +use std::arch::asm; + +fn main() { + + let mut x: u64 = 5; + + println!("Original value of x: {}", x); + + unsafe { + asm!( + "mov rax, {x}", + "mul rax", + "mov {x}, rax", + x = inout(reg) x, + ); + } + + println!("Squared value of x: {}", x); + + assert_eq!(x, 5 * 5); +}