amdgpu-visibility.cu 1.2 KB

123456789101112131415161718192021
  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
  4. #include "Inputs/cuda.h"
  5. // CHECK-DEFAULT: @c = addrspace(4) externally_initialized global
  6. // CHECK-DEFAULT: @g = addrspace(1) externally_initialized global
  7. // CHECK-PROTECTED: @c = protected addrspace(4) externally_initialized global
  8. // CHECK-PROTECTED: @g = protected addrspace(1) externally_initialized global
  9. // CHECK-HIDDEN: @c = protected addrspace(4) externally_initialized global
  10. // CHECK-HIDDEN: @g = protected addrspace(1) externally_initialized global
  11. __constant__ int c;
  12. __device__ int g;
  13. // CHECK-DEFAULT: define amdgpu_kernel void @_Z3foov()
  14. // CHECK-PROTECTED: define protected amdgpu_kernel void @_Z3foov()
  15. // CHECK-HIDDEN: define protected amdgpu_kernel void @_Z3foov()
  16. __global__ void foo() {
  17. g = c;
  18. }