blob: 9f44eb047f821d218e79913764d77090c52ed249 [file] [log] [blame]
Michael Liao38205062019-04-26 19:31:48 +00001// 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
4
5#include "Inputs/cuda.h"
6
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
13__constant__ int c;
14__device__ int g;
15
16// CHECK-DEFAULT: define amdgpu_kernel void @_Z3foov()
17// CHECK-PROTECTED: define protected amdgpu_kernel void @_Z3foov()
18// CHECK-HIDDEN: define protected amdgpu_kernel void @_Z3foov()
19__global__ void foo() {
20 g = c;
21}