summaryrefslogtreecommitdiffstats
path: root/tests/codegen/global_asm.rs
blob: 9912b1e75bf5ad05b761d35b0aed9b679fe4d9d9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
// ignore-aarch64
// ignore-arm
// ignore-avr
// ignore-bpf
// ignore-bpf
// ignore-hexagon
// ignore-mips
// ignore-mips64
// ignore-msp430
// ignore-powerpc64
// ignore-powerpc
// ignore-sparc
// ignore-sparc64
// ignore-s390x
// ignore-thumb
// ignore-nvptx64
// ignore-spirv
// ignore-wasm32
// ignore-wasm64
// ignore-emscripten
// compile-flags: -C no-prepopulate-passes

#![crate_type = "lib"]

use std::arch::global_asm;

// CHECK-LABEL: foo
// CHECK: module asm
// this regex will capture the correct unconditional branch inst.
// CHECK: module asm "{{[[:space:]]+}}jmp baz"
global_asm!(
    r#"
    .global foo
foo:
    jmp baz
"#
);

extern "C" {
    fn foo();
}

// CHECK-LABEL: @baz
#[no_mangle]
pub unsafe extern "C" fn baz() {}