summaryrefslogtreecommitdiffstats
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.cu24
1 files changed, 24 insertions, 0 deletions
diff --git a/test/CodeGenCUDA/address-spaces.cu b/test/CodeGenCUDA/address-spaces.cu
new file mode 100644
index 0000000..61d4d6b
--- /dev/null
+++ b/test/CodeGenCUDA/address-spaces.cu
@@ -0,0 +1,24 @@
+// RUN: %clang_cc1 -emit-llvm %s -o - -fcuda-is-device -triple nvptx-unknown-unknown | FileCheck %s
+
+#include "../SemaCUDA/cuda.h"
+
+// CHECK: @i = addrspace(1) global
+__device__ int i;
+
+// CHECK: @j = addrspace(4) global
+__constant__ int j;
+
+// CHECK: @k = addrspace(3) global
+__shared__ int k;
+
+__device__ void foo() {
+ // CHECK: load i32* bitcast (i32 addrspace(1)* @i to i32*)
+ i++;
+
+ // CHECK: load i32* bitcast (i32 addrspace(4)* @j to i32*)
+ j++;
+
+ // CHECK: load i32* bitcast (i32 addrspace(3)* @k to i32*)
+ k++;
+}
+
OpenPOWER on IntegriCloud