aboutsummaryrefslogtreecommitdiff
path: root/test/CodeGenCUDA/address-spaces.cu
diff options
context:
space:
mode:
Diffstat (limited to 'test/CodeGenCUDA/address-spaces.cu')
-rw-r--r--test/CodeGenCUDA/address-spaces.cu20
1 files changed, 17 insertions, 3 deletions
diff --git a/test/CodeGenCUDA/address-spaces.cu b/test/CodeGenCUDA/address-spaces.cu
index b0ef3558e2d0..31cba958e154 100644
--- a/test/CodeGenCUDA/address-spaces.cu
+++ b/test/CodeGenCUDA/address-spaces.cu
@@ -5,10 +5,10 @@
#include "Inputs/cuda.h"
-// CHECK: @i = addrspace(1) global
+// CHECK: @i = addrspace(1) externally_initialized global
__device__ int i;
-// CHECK: @j = addrspace(4) global
+// CHECK: @j = addrspace(4) externally_initialized global
__constant__ int j;
// CHECK: @k = addrspace(3) global
@@ -24,7 +24,9 @@ struct MyStruct {
// CHECK: @_ZZ5func2vE1a = internal addrspace(3) global [256 x float] zeroinitializer
// CHECK: @_ZZ5func3vE1a = internal addrspace(3) global float 0.000000e+00
// CHECK: @_ZZ5func4vE1a = internal addrspace(3) global float 0.000000e+00
-// CHECK: @b = addrspace(3) global float 0.000000e+00
+// CHECK: @b = addrspace(3) global float undef
+// CHECK: @c = addrspace(3) global %struct.c undef
+// CHECK @d = addrspace(3) global %struct.d undef
__device__ void foo() {
// CHECK: load i32, i32* addrspacecast (i32 addrspace(1)* @i to i32*)
@@ -117,3 +119,15 @@ __device__ int construct_shared_struct() {
return t.getData();
// CHECK: call i32 @_ZN14StructWithCtor7getDataEv(%struct.StructWithCtor* addrspacecast (%struct.StructWithCtor addrspace(3)* @_ZZ23construct_shared_structvE1t to %struct.StructWithCtor*))
}
+
+// Make sure we allow __shared__ structures with default or empty constructors.
+struct c {
+ int i;
+};
+__shared__ struct c c;
+
+struct d {
+ int i;
+ d() {}
+};
+__shared__ struct d d;