1// RUN: %clang_cc1 %s -emit-llvm -o - -O0 -triple spir-unknown-unknown | FileCheck %s 2 3// CHECK: %struct.X = type { i32 } 4 5// CHECK: @ci ={{.*}} addrspace(2) constant i32 0 6// CHECK: @gi ={{.*}} addrspace(1) global i32 0 7__constant int ci = 0; 8__global int gi = 0; 9 10struct X { 11 int x; 12 13 // Local variables are handled in local_addrspace_init.clcpp 14 X() /*__generic*/ : x(0) {} 15 X() __private : x(0) {} 16 X() __global : x(0) {} 17 constexpr X() __constant : x(0) {} 18 constexpr X(int x) __constant : x(x) {} 19}; 20 21// CHECK: @cx1 ={{.*}} addrspace(2) constant %struct.X zeroinitializer 22// CHECK: @cx2 ={{.*}} addrspace(2) constant %struct.X { i32 1 } 23// CHECK: @gx ={{.*}} addrspace(1) global %struct.X zeroinitializer 24__constant X cx1; 25__constant X cx2(1); 26__global X gx; 27 28// CHECK: @_ZZ1kE3cx1 = internal addrspace(2) constant %struct.X zeroinitializer 29// CHECK: @_ZZ1kE3cx2 = internal addrspace(2) constant %struct.X { i32 1 } 30 31kernel void k() { 32 // Check that the constructor for px calls the __private constructor. 33 // CHECK: %px = alloca %struct.X 34 // CHECK-NEXT: call spir_func void @_ZN1XC1Ev(%struct.X* {{.*}}%px) 35 __private X px; 36 37 __constant X cx1; 38 __constant X cx2(1); 39 // CHECK-NEXT: ret void 40} 41