]> git.lizzy.rs Git - rust.git/blob - tests/assembly/nvptx-linking-cdylib.rs
Rollup merge of #106958 - jyn514:labels, r=m-ou-se
[rust.git] / tests / assembly / nvptx-linking-cdylib.rs
1 // assembly-output: ptx-linker
2 // compile-flags: --crate-type cdylib
3 // only-nvptx64
4 // ignore-nvptx64
5
6 #![feature(abi_ptx)]
7 #![no_std]
8
9 // aux-build: breakpoint-panic-handler.rs
10 extern crate breakpoint_panic_handler;
11
12 // aux-build: non-inline-dependency.rs
13 extern crate non_inline_dependency as dep;
14
15 // Make sure declarations are there.
16 // CHECK: .func (.param .b32 func_retval0) wrapping_external_fn
17 // CHECK: .func (.param .b32 func_retval0) panicking_external_fn
18
19 // CHECK-LABEL: .visible .entry top_kernel(
20 #[no_mangle]
21 pub unsafe extern "ptx-kernel" fn top_kernel(a: *const u32, b: *mut u32) {
22     // CHECK:      call.uni (retval0),
23     // CHECK-NEXT: wrapping_external_fn
24     // CHECK:      ld.param.b32 %[[LHS:r[0-9]+]], [retval0+0];
25     let lhs = dep::wrapping_external_fn(*a);
26
27     // CHECK:      call.uni (retval0),
28     // CHECK-NEXT: panicking_external_fn
29     // CHECK:      ld.param.b32 %[[RHS:r[0-9]+]], [retval0+0];
30     let rhs = dep::panicking_external_fn(*a);
31
32     // CHECK: add.s32 %[[RES:r[0-9]+]], %[[RHS]], %[[LHS]];
33     // CHECK: st.global.u32 [%{{rd[0-9]+}}], %[[RES]];
34     *b = lhs + rhs;
35 }
36
37 // Verify that external function bodies are available.
38 // CHECK: .func (.param .b32 func_retval0) wrapping_external_fn
39 // CHECK: .func (.param .b32 func_retval0) panicking_external_fn