rust/src/test/codegen/naked-functions.rs

43 lines
976 B
Rust
Raw Normal View History

// compile-flags: -C no-prepopulate-passes
2016-03-21 15:13:50 -05:00
#![crate_type = "lib"]
#![feature(naked_functions)]
2016-03-21 15:13:50 -05:00
// CHECK: Function Attrs: naked
// CHECK-NEXT: define{{.*}}void @naked_empty()
2016-03-21 15:13:50 -05:00
#[no_mangle]
#[naked]
2017-10-30 12:18:00 -05:00
pub fn naked_empty() {
// CHECK-NEXT: {{.+}}:
// CHECK-NEXT: ret void
2016-03-21 15:13:50 -05:00
}
// CHECK: Function Attrs: naked
2016-03-21 15:13:50 -05:00
#[no_mangle]
#[naked]
// CHECK-NEXT: define{{.*}}void @naked_with_args(i{{[0-9]+( %a)?}})
2017-10-30 12:18:00 -05:00
pub fn naked_with_args(a: isize) {
// CHECK-NEXT: {{.+}}:
// CHECK: ret void
2016-03-21 15:13:50 -05:00
}
// CHECK: Function Attrs: naked
// CHECK-NEXT: define{{.*}}i{{[0-9]+}} @naked_with_return()
2016-03-21 15:13:50 -05:00
#[no_mangle]
#[naked]
2017-10-30 12:18:00 -05:00
pub fn naked_with_return() -> isize {
// CHECK-NEXT: {{.+}}:
// CHECK-NEXT: ret i{{[0-9]+}} 0
2016-03-21 15:13:50 -05:00
0
}
// CHECK: Function Attrs: naked
// CHECK-NEXT: define{{.*}}i{{[0-9]+}} @naked_with_args_and_return(i{{[0-9]+( %a)?}})
2016-03-21 15:13:50 -05:00
#[no_mangle]
#[naked]
2017-10-30 12:18:00 -05:00
pub fn naked_with_args_and_return(a: isize) -> isize {
// CHECK-NEXT: {{.+}}:
// CHECK: ret i{{[0-9]+}} 0
0
2016-03-21 15:13:50 -05:00
}