comparison clang/test/CodeGenCUDA/device-fun-linkage.cu @ 236:c4bab56944e8 llvm-original

LLVM 16
author kono
date Wed, 09 Nov 2022 17:45:10 +0900
parents 79ff65ed7e25
children
comparison
equal deleted inserted replaced
232:70dce7da266c 236:c4bab56944e8
1 // RUN: %clang_cc1 -triple nvptx -fcuda-is-device \ 1 // RUN: %clang_cc1 -triple nvptx -fcuda-is-device -emit-llvm -o - %s \
2 // RUN: -emit-llvm -o - %s \
3 // RUN: | FileCheck -check-prefix=NORDC %s 2 // RUN: | FileCheck -check-prefix=NORDC %s
4 // RUN: %clang_cc1 -triple nvptx -fcuda-is-device \ 3 // RUN: %clang_cc1 -triple nvptx -fcuda-is-device -emit-llvm -o - %s \
5 // RUN: -fgpu-rdc -emit-llvm -o - %s \ 4 // RUN: | FileCheck -check-prefix=NORDC-NEG %s
5 // RUN: %clang_cc1 -triple nvptx -fcuda-is-device -fgpu-rdc -emit-llvm -o - %s \
6 // RUN: | FileCheck -check-prefix=RDC %s 6 // RUN: | FileCheck -check-prefix=RDC %s
7 // RUN: %clang_cc1 -triple nvptx -fcuda-is-device -fgpu-rdc -emit-llvm -o - %s \
8 // RUN: | FileCheck -check-prefix=RDC-NEG %s
7 9
8 #include "Inputs/cuda.h" 10 #include "Inputs/cuda.h"
9
10 // NORDC: define internal void @_Z4funcIiEvv()
11 // NORDC: define{{.*}} void @_Z6kernelIiEvv()
12 // RDC: define weak_odr void @_Z4funcIiEvv()
13 // RDC: define weak_odr void @_Z6kernelIiEvv()
14 11
15 template <typename T> __device__ void func() {} 12 template <typename T> __device__ void func() {}
16 template <typename T> __global__ void kernel() {} 13 template <typename T> __global__ void kernel() {}
17 14
18 template __device__ void func<int>(); 15 template __device__ void func<int>();
16 // NORDC: define internal void @_Z4funcIiEvv()
17 // RDC: define weak_odr void @_Z4funcIiEvv()
18
19 template __global__ void kernel<int>(); 19 template __global__ void kernel<int>();
20 // NORDC: define void @_Z6kernelIiEvv()
21 // RDC: define weak_odr void @_Z6kernelIiEvv()
22
23 // Ensure that unused static device function is eliminated
24 static __device__ void static_func() {}
25 // NORDC-NEG-NOT: define{{.*}} void @_ZL13static_funcv()
26 // RDC-NEG-NOT: define{{.*}} void @_ZL13static_funcv[[FILEID:.*]]()
27
28 // Ensure that kernel function has external or weak_odr
29 // linkage regardless static specifier
30 static __global__ void static_kernel() {}
31 // NORDC: define void @_ZL13static_kernelv()
32 // RDC: define weak_odr void @_ZL13static_kernelv[[FILEID:.*]]()