| 1 |
/* { dg-do run { target arm*-*-* } } */ |
| 2 |
/* { dg-output "5\r*\n9\r*\n" }*/ |
| 3 |
|
| 4 |
#![feature(rustc_attrs)] |
| 5 |
#[rustc_builtin_macro] |
| 6 |
macro_rules! asm { |
| 7 |
() => {}; |
| 8 |
} |
| 9 |
|
| 10 |
extern "C" { |
| 11 |
fn printf(s: *const i8, ...); |
| 12 |
} |
| 13 |
|
| 14 |
fn main() -> i32 { |
| 15 |
let mut _x: i32 = 0; |
| 16 |
let mut _y: i32 = 9; |
| 17 |
|
| 18 |
unsafe { |
| 19 |
asm!( |
| 20 |
"mov {}, 5", |
| 21 |
out(reg) _x |
| 22 |
); |
| 23 |
printf("%d\n\0" as *const str as *const i8, _x); |
| 24 |
}; |
| 25 |
|
| 26 |
unsafe { |
| 27 |
asm!( |
| 28 |
"mov {}, {}", |
| 29 |
in(reg) _y, |
| 30 |
out(reg) _x |
| 31 |
); |
| 32 |
printf("%d\n\0" as *const str as *const i8, _x); |
| 33 |
} |
| 34 |
|
| 35 |
0 |
| 36 |
} |