blob: 2c74353c3ad86778277b0abcd2440fc52ba168c7 [file] [log] [blame]
Mon P Wangc6a38a42009-07-22 03:08:17 +00001// RUN: clang-cc -emit-llvm < %s -o %t &&
Daniel Dunbar025f80d2009-07-25 11:27:37 +00002// RUN: grep addrspace\(2\) %t | count 4 &&
Mon P Wangc6a38a42009-07-22 03:08:17 +00003// RUN: grep addrspace\(3\) %t | count 4
4
5// Check the load and store are using the correct address space to access
6// the variables.
7
8#define __addr1 __attribute__((address_space(1)))
9#define __addr2 __attribute__((address_space(2)))
10#define __addr3 __attribute__((address_space(3)))
11
12typedef struct Pair {
13 __addr2 int* a;
14 __addr3 int* b;
15} Pair;
16
17typedef struct S {
18 Pair arr[ 3 ];
19} S;
20
21void test_addrspace(__addr1 S* p1, __addr1 S* p2) {
22 *p1->arr[0].a = *p2->arr[1].b;
23}