Argyrios Kyrtzidis | c577a0e | 2008-06-12 12:40:02 +0000 | [diff] [blame] | 1 | // RUN: clang -emit-llvm < %s 2>&1 | grep '@foo.*global.*addrspace(1)' && |
| 2 | // RUN: clang -emit-llvm < %s 2>&1 | grep '@ban.*global.*addrspace(1)' && |
Chris Lattner | fca0ddd | 2008-06-26 06:27:57 +0000 | [diff] [blame^] | 3 | // RUN: clang -emit-llvm < %s 2>&1 | grep 'load.*addrspace(1)' | count 2 && |
| 4 | // RUN: clang -emit-llvm < %s 2>&1 | grep 'load.*addrspace(2).. @A' && |
| 5 | // RUN: clang -emit-llvm < %s 2>&1 | grep 'load.*addrspace(2).. @B' |
| 6 | |
Christopher Lamb | ebb97e9 | 2008-02-04 02:31:56 +0000 | [diff] [blame] | 7 | int foo __attribute__((address_space(1))); |
| 8 | int ban[10] __attribute__((address_space(1))); |
| 9 | |
| 10 | int bar() { return foo; } |
| 11 | |
Christopher Lamb | b41a7d2 | 2008-02-04 02:35:11 +0000 | [diff] [blame] | 12 | int baz(int i) { return ban[i]; } |
Chris Lattner | fca0ddd | 2008-06-26 06:27:57 +0000 | [diff] [blame^] | 13 | |
| 14 | // Both A and B point into addrspace(2). |
| 15 | __attribute__((address_space(2))) int *A, *B; |
| 16 | |
| 17 | void test3() { |
| 18 | *A = *B; |
| 19 | } |
| 20 | |