]> git.lizzy.rs Git - rust.git/blob - tests/assembly/asm/global_asm.rs
Rollup merge of #106714 - Ezrashaw:remove-e0490, r=davidtwco
[rust.git] / tests / assembly / asm / global_asm.rs
1 // only-x86_64
2 // only-linux
3 // assembly-output: emit-asm
4 // compile-flags: -C llvm-args=--x86-asm-syntax=intel
5 // compile-flags: -C symbol-mangling-version=v0
6
7 #![feature(asm_const)]
8 #![crate_type = "rlib"]
9
10 use std::arch::global_asm;
11
12 #[no_mangle]
13 fn my_func() {}
14
15 #[no_mangle]
16 static MY_STATIC: i32 = 0;
17
18 // CHECK: mov eax, eax
19 global_asm!("mov eax, eax");
20 // CHECK: mov ebx, 5
21 global_asm!("mov ebx, {}", const 5);
22 // CHECK: mov ecx, 5
23 global_asm!("movl ${}, %ecx", const 5, options(att_syntax));
24 // CHECK: call my_func
25 global_asm!("call {}", sym my_func);
26 // CHECK: lea rax, [rip + MY_STATIC]
27 global_asm!("lea rax, [rip + {}]", sym MY_STATIC);
28 // CHECK: call _RNvCsiubXh4Yz005_10global_asm6foobar
29 global_asm!("call {}", sym foobar);
30 // CHECK: _RNvCsiubXh4Yz005_10global_asm6foobar:
31 fn foobar() {
32     loop {}
33 }