]> git.lizzy.rs Git - rust.git/blob - src/test/ui/asm/x86_64/multiple-clobber-abi.rs
Rollup merge of #85766 - workingjubilee:file-options, r=yaahc
[rust.git] / src / test / ui / asm / x86_64 / multiple-clobber-abi.rs
1 // run-pass
2 // needs-asm-support
3 // only-x86_64
4
5 // Checks that multiple clobber_abi options can be used
6
7 #![feature(asm, asm_sym)]
8
9 extern "sysv64" fn foo(x: i32) -> i32 {
10     x + 16
11 }
12
13 extern "win64" fn bar(x: i32) -> i32 {
14     x / 2
15 }
16
17 fn main() {
18     let x = 8;
19     let y: i32;
20     // call `foo` with `x` as the input, and then `bar` with the output of `foo`
21     // and output that to `y`
22     unsafe {
23         asm!(
24             "call {}; mov rcx, rax; call {}",
25             sym foo,
26             sym bar,
27             in("rdi") x,
28             out("rax") y,
29             clobber_abi("sysv64", "win64"),
30         );
31     }
32     assert_eq!((x, y), (8, 12));
33 }