summaryrefslogtreecommitdiffstats
path: root/test/CodeGen/address-space.c
blob: 3b6a8e654167ff6a8f6a446ce2bca4b29318ad32 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// RUN: clang-cc -emit-llvm < %s | grep '@foo.*global.*addrspace(1)' &&
// RUN: clang-cc -emit-llvm < %s | grep '@ban.*global.*addrspace(1)' &&
// RUN: clang-cc -emit-llvm < %s | grep 'load.*addrspace(1)' | count 2 &&
// RUN: clang-cc -emit-llvm < %s | grep 'load.*addrspace(2).. @A' &&
// RUN: clang-cc -emit-llvm < %s | grep 'load.*addrspace(2).. @B'

int foo __attribute__((address_space(1)));
int ban[10] __attribute__((address_space(1)));

int bar() { return foo; }

int baz(int i) { return ban[i]; }

// Both A and B point into addrspace(2).
__attribute__((address_space(2))) int *A, *B;

void test3() {
  *A = *B;
}

OpenPOWER on IntegriCloud