Mercurial > hg > CbC > CbC_llvm
comparison clang/test/CodeGenCUDA/host-used-extern.cu @ 236:c4bab56944e8 llvm-original
LLVM 16
author | kono |
---|---|
date | Wed, 09 Nov 2022 17:45:10 +0900 |
parents | |
children |
comparison
equal
deleted
inserted
replaced
232:70dce7da266c | 236:c4bab56944e8 |
---|---|
1 // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fcuda-is-device -x hip %s \ | |
2 // RUN: -fgpu-rdc -std=c++11 -emit-llvm -o - -target-cpu gfx906 | FileCheck %s | |
3 | |
4 // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fcuda-is-device -x hip %s \ | |
5 // RUN: -fgpu-rdc -std=c++11 -emit-llvm -o - -target-cpu gfx906 \ | |
6 // RUN: | FileCheck -check-prefix=NEG %s | |
7 | |
8 // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fcuda-is-device -x hip %s \ | |
9 // RUN: -std=c++11 -emit-llvm -o - -target-cpu gfx906 \ | |
10 // RUN: | FileCheck -check-prefixes=NEG,NORDC %s | |
11 | |
12 #include "Inputs/cuda.h" | |
13 | |
14 // CHECK-LABEL: @__clang_gpu_used_external = internal {{.*}}global | |
15 // CHECK-DAG: @_Z7kernel1v | |
16 // CHECK-DAG: @_Z7kernel4v | |
17 // CHECK-DAG: @var1 | |
18 // CHECK-LABEL: @llvm.compiler.used = {{.*}} @__clang_gpu_used_external | |
19 | |
20 // NEG-NOT: @__clang_gpu_used_external = {{.*}} @_Z7kernel2v | |
21 // NEG-NOT: @__clang_gpu_used_external = {{.*}} @_Z7kernel3v | |
22 // NEG-NOT: @__clang_gpu_used_external = {{.*}} @var2 | |
23 // NEG-NOT: @__clang_gpu_used_external = {{.*}} @var3 | |
24 // NORDC-NOT: @__clang_gpu_used_external = {{.*}} @_Z7kernel1v | |
25 // NORDC-NOT: @__clang_gpu_used_external = {{.*}} @_Z7kernel4v | |
26 // NORDC-NOT: @__clang_gpu_used_external = {{.*}} @var1 | |
27 | |
28 __global__ void kernel1(); | |
29 | |
30 // kernel2 is not marked as used since it is a definition. | |
31 __global__ void kernel2() {} | |
32 | |
33 // kernel3 is not marked as used since it is not called by host function. | |
34 __global__ void kernel3(); | |
35 | |
36 // kernel4 is marked as used even though it is not called. | |
37 __global__ void kernel4(); | |
38 | |
39 extern __device__ int var1; | |
40 | |
41 __device__ int var2; | |
42 | |
43 extern __device__ int var3; | |
44 | |
45 void use(int *p); | |
46 | |
47 void test() { | |
48 kernel1<<<1, 1>>>(); | |
49 void *p = (void*)kernel4; | |
50 use(&var1); | |
51 } |