Mon P Wang | c6a38a4 | 2009-07-22 03:08:17 +0000 | [diff] [blame^] | 1 | // RUN: clang-cc -emit-llvm < %s -o %t && |
| 2 | // RUN: grep addrspace\(2\) %t | count 4 |
| 3 | // 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 | |
| 12 | typedef struct Pair { |
| 13 | __addr2 int* a; |
| 14 | __addr3 int* b; |
| 15 | } Pair; |
| 16 | |
| 17 | typedef struct S { |
| 18 | Pair arr[ 3 ]; |
| 19 | } S; |
| 20 | |
| 21 | void test_addrspace(__addr1 S* p1, __addr1 S* p2) { |
| 22 | *p1->arr[0].a = *p2->arr[1].b; |
| 23 | } |