]> git.lizzy.rs Git - rust.git/blob - src/test/ui/asm-out-assign.rs
Auto merge of #67000 - spastorino:remove-promoted-from-place, r=oli-obk
[rust.git] / src / test / ui / asm-out-assign.rs
1 // run-pass
2
3 #![feature(asm)]
4
5 #[cfg(any(target_arch = "x86", target_arch = "x86_64"))]
6 pub fn main() {
7     let x: isize;
8     unsafe {
9         // Treat the output as initialization.
10         asm!("mov $1, $0" : "=r"(x) : "r"(5_usize));
11     }
12     assert_eq!(x, 5);
13
14     let mut x = x + 1;
15     assert_eq!(x, 6);
16
17     unsafe {
18         // Assignment to mutable.
19         asm!("mov $1, $0" : "=r"(x) : "r"(x + 7));
20     }
21     assert_eq!(x, 13);
22 }
23
24 #[cfg(not(any(target_arch = "x86", target_arch = "x86_64")))]
25 pub fn main() {}