xref: /llvm-project/llvm/test/CodeGen/NVPTX/symbol-naming.ll (revision b279f6b098d3849f7f1c1f539b108307d5f8ae2d)
1; RUN: llc < %s -mtriple=nvptx -mattr=+ptx60 -mcpu=sm_30 | FileCheck %s
2; RUN: llc < %s -mtriple=nvptx64 -mattr=+ptx60 -mcpu=sm_30 | FileCheck %s
3; RUN: %if ptxas && !ptxas-12.0 %{ llc < %s -mtriple=nvptx -mattr=+ptx60 -mcpu=sm_30 | %ptxas-verify %}
4; RUN: %if ptxas %{ llc < %s -mtriple=nvptx64 -mattr=+ptx60 -mcpu=sm_30 | %ptxas-verify %}
5
6; Verify that the NVPTX target removes invalid symbol names prior to emitting
7; PTX.
8
9; CHECK-NOT: .str
10; CHECK-NOT: <str>
11; CHECK-NOT: another-str
12; CHECK-NOT: .function.
13
14; CHECK-DAG: _$_str
15; CHECK-DAG: _$_str_$_
16; CHECK-DAG: _$_str1
17; CHECK-DAG: another_$_str
18
19; CHECK-DAG: _$_function_$_
20; CHECK-DAG: _$_function_$_2
21
22target datalayout = "e-i64:64-v16:16-v32:32-n16:32:64"
23target triple = "nvptx64-unknown-unknown"
24
25
26@.str = private unnamed_addr constant [13 x i8] c"%d %f %c %d\0A\00", align 1
27@"<str>" = private unnamed_addr constant [13 x i8] c"%d %f %c %d\0A\00", align 1
28@_$_str = private unnamed_addr constant [13 x i8] c"%d %f %c %d\0A\00", align 1
29@another-str = private unnamed_addr constant [13 x i8] c"%d %f %c %d\0A\00", align 1
30
31
32; Function Attrs: nounwind
33define internal void @.function.() {
34entry:
35  %call = call i32 (ptr, ...) @printf(ptr @.str)
36  %call2 = call i32 (ptr, ...) @printf(ptr @"<str>")
37  ret void
38}
39
40; Function Attrs: nounwind
41define internal void @_$_function_$_() {
42entry:
43  %call = call i32 (ptr, ...) @printf(ptr @_$_str)
44  %call2 = call i32 (ptr, ...) @printf(ptr @another-str)
45  ret void
46}
47
48; Function Attrs: nounwind
49define void @global_function() {
50entry:
51  call void @.function.()
52  call void @_$_function_$_()
53  ret void
54}
55
56declare i32 @printf(ptr, ...)
57