6 #![feature(asm, global_asm)]
17 fn add_asm(a: i64, b: i64) -> i64;
37 asm!("mov {input}, {output}",
39 input = in(reg) input,
57 asm!("mov {output}, {input}",
59 input = in(reg) input,
65 // check inout(reg_class) x
74 // check inout("reg") x
85 // inout(class) x => y
94 inout("eax") x => res,
111 // check const (ATT syntax)
123 extern "C" fn foo() -> u64 { 42 }
126 asm!("call {}", sym foo, lateout("rax") x);
130 // check sym fn (ATT syntax)
133 asm!("call {}", sym foo, lateout("rax") x, options(att_syntax));
138 static FOO: u64 = 42;
141 asm!("mov {1}, qword ptr [rip + {0}]", sym FOO, lateout(reg) x);
145 // check sym static (ATT syntax)
148 asm!("movq {0}(%rip), {1}", sym FOO, lateout(reg) x, options(att_syntax));
152 assert_eq!(unsafe { add_asm(40, 2) }, 42);