2012-05-25 01:43:12 +08:00
|
|
|
// RUN: %clang_cc1 -emit-llvm %s -o - -fcuda-is-device -triple nvptx-unknown-unknown | FileCheck %s
|
2012-05-21 05:08:35 +08:00
|
|
|
|
|
|
|
#include "../SemaCUDA/cuda.h"
|
|
|
|
|
2012-05-25 01:43:12 +08:00
|
|
|
// CHECK: @i = addrspace(1) global
|
2012-05-21 05:08:35 +08:00
|
|
|
__device__ int i;
|
|
|
|
|
2012-05-25 01:43:12 +08:00
|
|
|
// CHECK: @j = addrspace(4) global
|
2012-05-21 05:08:35 +08:00
|
|
|
__constant__ int j;
|
|
|
|
|
2012-05-25 01:43:12 +08:00
|
|
|
// CHECK: @k = addrspace(3) global
|
2012-05-21 05:08:35 +08:00
|
|
|
__shared__ int k;
|
|
|
|
|
|
|
|
__device__ void foo() {
|
2013-11-15 10:19:52 +08:00
|
|
|
// CHECK: load i32* addrspacecast (i32 addrspace(1)* @i to i32*)
|
2012-05-21 05:08:35 +08:00
|
|
|
i++;
|
|
|
|
|
2013-11-15 10:19:52 +08:00
|
|
|
// CHECK: load i32* addrspacecast (i32 addrspace(4)* @j to i32*)
|
2012-05-21 05:08:35 +08:00
|
|
|
j++;
|
|
|
|
|
2013-11-15 10:19:52 +08:00
|
|
|
// CHECK: load i32* addrspacecast (i32 addrspace(3)* @k to i32*)
|
2012-05-21 05:08:35 +08:00
|
|
|
k++;
|
2012-08-29 04:37:10 +08:00
|
|
|
|
|
|
|
static int li;
|
|
|
|
// CHECK: load i32 addrspace(1)* @_ZZ3foovE2li
|
|
|
|
li++;
|
2012-08-29 04:37:50 +08:00
|
|
|
|
|
|
|
__constant__ int lj;
|
|
|
|
// CHECK: load i32 addrspace(4)* @_ZZ3foovE2lj
|
|
|
|
lj++;
|
|
|
|
|
|
|
|
__shared__ int lk;
|
|
|
|
// CHECK: load i32 addrspace(3)* @_ZZ3foovE2lk
|
|
|
|
lk++;
|
2012-05-21 05:08:35 +08:00
|
|
|
}
|
|
|
|
|