]> git.proxmox.com Git - rustc.git/blob - src/test/assembly/nvptx-safe-naming.rs
New upstream version 1.37.0+dfsg1
[rustc.git] / src / test / assembly / nvptx-safe-naming.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 // Verify function name doesn't contain unacceaptable characters.
13 // CHECK: .func (.param .b32 func_retval0) [[IMPL_FN:[a-zA-Z0-9$_]+square[a-zA-Z0-9$_]+]](
14
15 // CHECK-LABEL: .visible .entry top_kernel(
16 #[no_mangle]
17 pub unsafe extern "ptx-kernel" fn top_kernel(a: *const u32, b: *mut u32) {
18 // CHECK: call.uni (retval0),
19 // CHECK-NEXT: [[IMPL_FN]]
20 *b = deep::private::MyStruct::new(*a).square();
21 }
22
23 pub mod deep {
24 pub mod private {
25 pub struct MyStruct<T>(T);
26
27 impl MyStruct<u32> {
28 pub fn new(a: u32) -> Self {
29 MyStruct(a)
30 }
31
32 #[inline(never)]
33 pub fn square(&self) -> u32 {
34 self.0.wrapping_mul(self.0)
35 }
36 }
37 }
38 }