summary refs log tree commit diff
path: root/src/test/run-make/nvptx-binary-crate/main.rs
blob: 826bc3a47bbd633df852443dcb2d5adf7cc7c6ad (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
#![no_std]
#![no_main]
#![deny(warnings)]
#![feature(abi_ptx, core_intrinsics)]

// Check the overriden CUDA arch.
// CHECK: .target sm_60
// CHECK: .address_size 64

// Verify that no extra function declarations are present.
// CHECK-NOT: .func

// CHECK-LABEL: .visible .entry top_kernel(
#[no_mangle]
pub unsafe extern "ptx-kernel" fn top_kernel(a: *const u32, b: *mut u32) {
    // CHECK: add.s32 %{{r[0-9]+}}, %{{r[0-9]+}}, 5;
    *b = *a + 5;
}

// Verify that no extra function definitions are there.
// CHECK-NOT: .func
// CHECK-NOT: .entry

#[panic_handler]
unsafe fn breakpoint_panic_handler(_: &::core::panic::PanicInfo) -> ! {
    core::intrinsics::breakpoint();
    core::hint::unreachable_unchecked();
}