Skip to content

Commit

Permalink
Provide new asm test case for amd64
Browse files Browse the repository at this point in the history
gcc/testsuite/ChangeLog:

	* rust/execute/torture/inline_asm_mov_x_5.rs: Move to...
	* rust/execute/torture/inline_asm_mov_x_5_ARM.rs: ...here.
	* rust/execute/torture/inline_asm_mov_x_5_x86_64.rs: New test.
  • Loading branch information
badumbatish authored and CohenArthur committed Sep 2, 2024
1 parent 3aca66b commit e4953b4
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
/* { dg-do run { target arm*-*-* } } */
/* { dg-output "5\r*\n" }*/

#![feature(rustc_attrs)]
Expand Down
24 changes: 24 additions & 0 deletions gcc/testsuite/rust/execute/torture/inline_asm_mov_x_5_x86_64.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
/* { dg-do run { target x86_64*-*-* } } */
/* { dg-output "5\r*\n" }*/

#![feature(rustc_attrs)]
#[rustc_builtin_macro]
macro_rules! asm {
() => {};
}

extern "C" {
fn printf(s: *const i8, ...);
}

fn main() -> i32 {
let mut _x: i32 = 0;
unsafe {
asm!(
"mov $5, {}",
out(reg) _x
);
printf("%d\n\0" as *const str as *const i8, _x);
}
0
}

0 comments on commit e4953b4

Please sign in to comment.