Skip to content

Commit 7a5c5e0

Browse files
committed
test the new global asm output of naked functions
1 parent 372ddc3 commit 7a5c5e0

File tree

1 file changed

+24
-11
lines changed

1 file changed

+24
-11
lines changed

tests/codegen/naked-fn/naked-functions.rs

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -4,26 +4,39 @@
44

55
#![crate_type = "lib"]
66
#![feature(naked_functions)]
7-
use std::arch::asm;
7+
use std::arch::{asm, global_asm};
8+
// CHECK: module asm ".intel_syntax"
9+
// CHECK: .pushsection .text.naked_empty,\22ax\22, @progbits
10+
// CHECK: .balign 4"
11+
// CHECK: .globl naked_empty"
12+
// CHECK: .hidden naked_empty"
13+
// CHECK: .type naked_empty, @function"
14+
// CHECK-LABEL: naked_empty:
15+
// CHECK: ret
16+
// CHECK: .popsection
17+
// CHECK: .att_syntax
818

9-
// CHECK: Function Attrs: naked
10-
// CHECK-NEXT: define{{.*}}void @naked_empty()
1119
#[no_mangle]
1220
#[naked]
1321
pub unsafe extern "C" fn naked_empty() {
14-
// CHECK-NEXT: {{.+}}:
15-
// CHECK-NEXT: call void asm
16-
// CHECK-NEXT: unreachable
1722
asm!("ret", options(noreturn));
1823
}
1924

20-
// CHECK: Function Attrs: naked
21-
// CHECK-NEXT: define{{.*}}i{{[0-9]+}} @naked_with_args_and_return(i64 %0, i64 %1)
25+
// CHECK: .intel_syntax
26+
// CHECK: .pushsection .text.naked_with_args_and_return,\22ax\22, @progbits
27+
// CHECK: .balign 4
28+
// CHECK: .globl naked_with_args_and_return
29+
// CHECK: .hidden naked_with_args_and_return
30+
// CHECK: .type naked_with_args_and_return, @function
31+
// CHECK-LABEL: naked_with_args_and_return:
32+
// CHECK: lea rax, [rdi + rsi]
33+
// CHECK: ret
34+
// CHECK: .size naked_with_args_and_return, . - naked_with_args_and_return
35+
// CHECK: .popsection
36+
// CHECK: .att_syntax
37+
2238
#[no_mangle]
2339
#[naked]
2440
pub unsafe extern "C" fn naked_with_args_and_return(a: isize, b: isize) -> isize {
25-
// CHECK-NEXT: {{.+}}:
26-
// CHECK-NEXT: call void asm
27-
// CHECK-NEXT: unreachable
2841
asm!("lea rax, [rdi + rsi]", "ret", options(noreturn));
2942
}

0 commit comments

Comments
 (0)