Clang Project

clang_source_code/test/CodeGenCXX/amdgcn_declspec_get.cpp
1// RUN: %clang_cc1 -triple amdgcn-amd-amdhsa -emit-llvm -O3 -fdeclspec \
2// RUN:     -disable-llvm-passes -o - %s | FileCheck %s
3
4int get_x();
5
6struct A {
7   __declspec(property(get = _get_x)) int x;
8   static int _get_x(void) {
9     return get_x();
10   };
11};
12
13extern const A a;
14
15// CHECK-LABEL: define void @_Z4testv()
16// CHECK:  %i = alloca i32, align 4, addrspace(5)
17// CHECK:  %[[ii:.*]] = addrspacecast i32 addrspace(5)* %i to i32*
18// CHECK:  %[[cast:.*]] = bitcast i32 addrspace(5)* %i to i8 addrspace(5)*
19// CHECK:  call void @llvm.lifetime.start.p5i8(i64 4, i8 addrspace(5)* %[[cast]])
20// CHECK:  %call = call i32 @_ZN1A6_get_xEv()
21// CHECK:  store i32 %call, i32* %[[ii]]
22// CHECK:  %[[cast2:.*]] = bitcast i32 addrspace(5)* %i to i8 addrspace(5)*
23// CHECK:  call void @llvm.lifetime.end.p5i8(i64 4, i8 addrspace(5)* %[[cast2]])
24void test()
25{
26  int i = a.x;
27}
28