about summary refs log tree commit diff
path: root/tests/codegen-llvm/naked-fn/instruction-set.rs
blob: 67560c5aba75879f9d066d1d0568f81dfaf2f8bf (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
46
47
48
49
50
51
52
53
//@ add-core-stubs
//@ revisions: arm-mode thumb-mode
//@ [arm-mode] compile-flags: --target armv5te-none-eabi
//@ [thumb-mode] compile-flags: --target thumbv5te-none-eabi
//@ [arm-mode] needs-llvm-components: arm
//@ [thumb-mode] needs-llvm-components: arm

#![crate_type = "lib"]
#![feature(no_core, lang_items, rustc_attrs)]
#![no_core]

extern crate minicore;
use minicore::*;

// arm-mode: .arm
// thumb-mode: .thumb
// CHECK-LABEL: test_unspecified:
// CHECK: bx lr
// CHECK: .popsection
// arm-mode: .arm
// thumb-mode: .thumb
#[no_mangle]
#[unsafe(naked)]
extern "C" fn test_unspecified() {
    naked_asm!("bx lr");
}

// CHECK: .thumb
// CHECK: .thumb_func
// CHECK-LABEL: test_thumb:
// CHECK: bx lr
// CHECK: .popsection
// arm-mode: .arm
// thumb-mode: .thumb
#[no_mangle]
#[unsafe(naked)]
#[instruction_set(arm::t32)]
extern "C" fn test_thumb() {
    naked_asm!("bx lr");
}

// CHECK: .arm
// CHECK-LABEL: test_arm:
// CHECK: bx lr
// CHECK: .popsection
// arm-mode: .arm
// thumb-mode: .thumb
#[no_mangle]
#[unsafe(naked)]
#[instruction_set(arm::a32)]
extern "C" fn test_arm() {
    naked_asm!("bx lr");
}