]>
git.proxmox.com Git - rustc.git/blob - src/test/ui/asm-in-out-operand.rs
5 #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
6 unsafe fn next_power_of_2(n
: u32) -> u32 {
8 asm
!("dec $0" : "+rm"(tmp
) :: "cc");
15 : "+&rm"(tmp
), "+{ecx}"(shift
) : "r"(tmp
) : "cc"
18 asm
!("inc $0" : "+rm"(tmp
) :: "cc");
22 #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
25 assert_eq
!(64, next_power_of_2(37));
26 assert_eq
!(2147483648, next_power_of_2(2147483647));
32 // Treat the output as initialization.
37 : "=r"(x
), "+r"(y
) : "i"(3_usize
), "ir"(7_usize
) : "cc"
47 // Assignment to mutable.
49 // Forbids the use of a single register by both operands.
50 asm
!("shr $$2, $1; add $1, $0" : "+&r"(x
) : "r"(x
) : "cc");
55 #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]