1 // RUN: %clang_cc1 -triple x86_64-apple-darwin -emit-llvm < %s | FileCheck %s
3 // CHECK: @foo = common addrspace(1) global
4 int foo __attribute__((address_space(1)));
6 // CHECK: @ban = common addrspace(1) global
7 int ban[10] __attribute__((address_space(1)));
9 // CHECK-LABEL: define i32 @test1()
10 // CHECK: load i32, i32 addrspace(1)* @foo
11 int test1() { return foo; }
13 // CHECK-LABEL: define i32 @test2(i32 %i)
14 // CHECK: load i32, i32 addrspace(1)*
15 // CHECK-NEXT: ret i32
16 int test2(int i) { return ban[i]; }
18 // Both A and B point into addrspace(2).
19 __attribute__((address_space(2))) int *A, *B;
21 // CHECK-LABEL: define void @test3()
22 // CHECK: load i32 addrspace(2)*, i32 addrspace(2)** @B
23 // CHECK: load i32, i32 addrspace(2)*
24 // CHECK: load i32 addrspace(2)*, i32 addrspace(2)** @A
25 // CHECK: store i32 {{.*}}, i32 addrspace(2)*
35 // CHECK-LABEL: define void @test4(
36 // CHECK: call void @llvm.memcpy.p0i8.p2i8
37 // CHECK: call void @llvm.memcpy.p2i8.p0i8
38 void test4(MyStruct __attribute__((address_space(2))) *pPtr) {