Skip to content

Commit 2136370

Browse files
committed
add codegen test for the #[instruction_set] attribute
1 parent 62768a7 commit 2136370

File tree

1 file changed

+43
-0
lines changed

1 file changed

+43
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
//@ compile-flags: --target armv5te-none-eabi
2+
//@ needs-llvm-components: arm
3+
4+
#![crate_type = "lib"]
5+
#![feature(no_core, lang_items, rustc_attrs, naked_functions)]
6+
#![no_core]
7+
8+
#[rustc_builtin_macro]
9+
macro_rules! asm {
10+
() => {};
11+
}
12+
13+
#[lang = "sized"]
14+
trait Sized {}
15+
#[lang = "copy"]
16+
trait Copy {}
17+
18+
// CHECK-LABEL: test_unspecified:
19+
// CHECK: .arm
20+
#[no_mangle]
21+
#[naked]
22+
unsafe extern "C" fn test_unspecified() {
23+
asm!("bx lr", options(noreturn));
24+
}
25+
26+
// CHECK-LABEL: test_thumb:
27+
// CHECK: .thumb
28+
// CHECK: .thumb_func
29+
#[no_mangle]
30+
#[naked]
31+
#[instruction_set(arm::t32)]
32+
unsafe extern "C" fn test_thumb() {
33+
asm!("bx lr", options(noreturn));
34+
}
35+
36+
// CHECK-LABEL: test_arm:
37+
// CHECK: .arm
38+
#[no_mangle]
39+
#[naked]
40+
#[instruction_set(arm::t32)]
41+
unsafe extern "C" fn test_arm() {
42+
asm!("bx lr", options(noreturn));
43+
}

0 commit comments

Comments
 (0)