1 // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fcuda-is-device \
2 // RUN: -emit-llvm -o - -x hip %s | FileCheck -check-prefix=DEV %s
4 // RUN: %clang_cc1 -triple x86_64-gnu-linux -std=c++11 \
5 // RUN: -emit-llvm -o - -x hip %s | FileCheck -check-prefix=HOST %s
9 // RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -fcuda-is-device \
10 // RUN: -emit-llvm -o - -x hip %s | FileCheck -check-prefix=DEV-NEG %s
12 #include "Inputs/cuda.h"
17 __device__ static int d_member;
18 __constant__ static int c_member;
19 __managed__ static int m_member;
20 const static int const_member = 0;
27 __device__ int A<T>::d_member;
30 __constant__ int A<T>::c_member;
33 __managed__ int A<T>::m_member;
36 const int A<T>::const_member;
38 template class A<int>;
40 //DEV-DAG: @_ZN1AIiE8d_memberE = internal addrspace(1) global i32 0, comdat, align 4
41 //DEV-DAG: @_ZN1AIiE8c_memberE = internal addrspace(4) constant i32 0, comdat, align 4
42 //DEV-DAG: @_ZN1AIiE8m_memberE = internal addrspace(1) externally_initialized global ptr addrspace(1) null
43 //DEV-DAG: @_ZN1AIiE12const_memberE = internal addrspace(4) constant i32 0, comdat, align 4
44 //DEV-NEG-NOT: @_ZN1AIiE8h_memberE
46 //HOST-DAG: @_ZN1AIiE8h_memberE = weak_odr global i32 0, comdat, align 4
47 //HOST-DAG: @_ZN1AIiE8d_memberE = internal global i32 undef, comdat, align 4
48 //HOST-DAG: @_ZN1AIiE8c_memberE = internal global i32 undef, comdat, align 4
49 //HOST-DAG: @_ZN1AIiE8m_memberE = internal externally_initialized global ptr null
50 //HOST-DAG: @_ZN1AIiE12const_memberE = weak_odr constant i32 0, comdat, align 4