1 // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fcuda-is-device -fapply-global-visibility-to-externs -fvisibility default -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-DEFAULT %s
2 // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fcuda-is-device -fapply-global-visibility-to-externs -fvisibility protected -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-PROTECTED %s
3 // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fcuda-is-device -fapply-global-visibility-to-externs -fvisibility hidden -emit-llvm -o - %s | FileCheck --check-prefix=CHECK-HIDDEN %s
5 #include "Inputs/cuda.h"
7 // CHECK-DEFAULT: @c ={{.*}} addrspace(4) externally_initialized global
8 // CHECK-DEFAULT: @g ={{.*}} addrspace(1) externally_initialized global
9 // CHECK-PROTECTED: @c = protected addrspace(4) externally_initialized global
10 // CHECK-PROTECTED: @g = protected addrspace(1) externally_initialized global
11 // CHECK-HIDDEN: @c = protected addrspace(4) externally_initialized global
12 // CHECK-HIDDEN: @g = protected addrspace(1) externally_initialized global
16 // CHECK-DEFAULT: @e = external addrspace(1) global
17 // CHECK-PROTECTED: @e = external protected addrspace(1) global
18 // CHECK-HIDDEN: @e = external protected addrspace(1) global
19 extern __device__ int e;
21 // dummy one to hold reference to `e`.
26 // CHECK-DEFAULT: define{{.*}} amdgpu_kernel void @_Z3foov()
27 // CHECK-PROTECTED: define protected amdgpu_kernel void @_Z3foov()
28 // CHECK-HIDDEN: define protected amdgpu_kernel void @_Z3foov()
29 __global__ void foo() {