1 // NOTE
: Assertions have been autogenerated by utils
/update_cc_test_checks.py UTC_ARGS
: --version
5
2 // RUN
: %clang_cc1 -O0 -cl-std
=CL1.2 -triple amdgcn-amd-amdhsa -emit-llvm %s -o - | FileCheck -check-prefixes
=CL12 %s
3 // RUN
: %clang_cc1 -O0 -cl-std
=CL2.0 -triple amdgcn-amd-amdhsa -emit-llvm %s -o - | FileCheck -check-prefixes
=CL20 %s
5 // CL12-LABEL
: define dso_local void
@func1
(
6 // CL12-SAME
: ptr addrspace
(5) noundef
[[X
:%.
*]]) #[[ATTR0
:[0-
9]+]] {
7 // CL12-NEXT
: [[ENTRY
:.
*:]]
8 // CL12-NEXT
: [[X_ADDR
:%.
*]] = alloca ptr addrspace
(5), align
4, addrspace
(5)
9 // CL12-NEXT
: store ptr addrspace
(5) [[X]], ptr addrspace(5) [[X_ADDR]], align 4
10 // CL12-NEXT: [[TMP0:%.*]] = load ptr addrspace(5), ptr addrspace(5) [[X_ADDR]], align 4
11 // CL12-NEXT: store i32 1, ptr addrspace(5) [[TMP0]], align 4
12 // CL12-NEXT: ret void
14 // CL20-LABEL: define dso_local void @func1(
15 // CL20-SAME: ptr noundef [[X:%.*]]) #[[ATTR0:[0-9]+]] {
16 // CL20-NEXT: [[ENTRY:.*:]]
17 // CL20-NEXT: [[X_ADDR:%.*]] = alloca ptr, align 8, addrspace(5)
18 // CL20-NEXT: [[X_ADDR_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[X_ADDR]] to ptr
19 // CL20-NEXT: store ptr [[X]], ptr
[[X_ADDR_ASCAST]], align 8
20 // CL20-NEXT: [[TMP0:%.*]] = load ptr, ptr [[X_ADDR_ASCAST]], align
8
21 // CL20-NEXT
: store i32
1, ptr
[[TMP0]], align 4
22 // CL20-NEXT: ret void
28 // CL12-LABEL: define dso_local void @func2(
29 // CL12-SAME: ) #[[ATTR0]] {
30 // CL12-NEXT: [[ENTRY:.*:]]
31 // CL12-NEXT: [[LV1:%.*]] = alloca i32, align 4, addrspace(5)
32 // CL12-NEXT: [[LV2:%.*]] = alloca i32, align 4, addrspace(5)
33 // CL12-NEXT: [[LA:%.*]] = alloca [100 x i32], align 4, addrspace(5)
34 // CL12-NEXT: [[LP1:%.*]] = alloca ptr addrspace(5), align 4, addrspace(5)
35 // CL12-NEXT: [[LP2:%.*]] = alloca ptr addrspace(5), align 4, addrspace(5)
36 // CL12-NEXT: [[LVC:%.*]] = alloca i32, align 4, addrspace(5)
37 // CL12-NEXT: store i32 1, ptr addrspace(5) [[LV1]], align 4
38 // CL12-NEXT: store i32 2, ptr addrspace(5) [[LV2]], align 4
39 // CL12-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [100 x i32], ptr addrspace(5) [[LA]], i64 0, i64 0
40 // CL12-NEXT: store i32 3, ptr addrspace(5) [[ARRAYIDX]], align 4
41 // CL12-NEXT: store ptr addrspace(5) [[LV1]], ptr addrspace(5) [[LP1]], align 4
42 // CL12-NEXT: [[ARRAYDECAY:%.*]] = getelementptr inbounds [100 x i32], ptr addrspace(5) [[LA]], i64 0, i64 0
43 // CL12-NEXT: store ptr addrspace(5) [[ARRAYDECAY]], ptr addrspace(5) [[LP2]], align 4
44 // CL12-NEXT: call void @func1(ptr addrspace(5) noundef [[LV1]]) #[[ATTR2:[0-9]+]]
45 // CL12-NEXT: store i32 4, ptr addrspace(5) [[LVC]], align 4
46 // CL12-NEXT: store i32 4, ptr addrspace(5) [[LV1]], align 4
47 // CL12-NEXT: ret void
49 // CL20-LABEL: define dso_local void @func2(
50 // CL20-SAME: ) #[[ATTR0]] {
51 // CL20-NEXT: [[ENTRY:.*:]]
52 // CL20-NEXT: [[LV1:%.*]] = alloca i32, align 4, addrspace(5)
53 // CL20-NEXT: [[LV2:%.*]] = alloca i32, align 4, addrspace(5)
54 // CL20-NEXT: [[LA:%.*]] = alloca [100 x i32], align 4, addrspace(5)
55 // CL20-NEXT: [[LP1:%.*]] = alloca ptr, align 8, addrspace(5)
56 // CL20-NEXT: [[LP2:%.*]] = alloca ptr, align 8, addrspace(5)
57 // CL20-NEXT: [[LVC:%.*]] = alloca i32, align 4, addrspace(5)
58 // CL20-NEXT: [[LV1_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[LV1]] to ptr
59 // CL20-NEXT: [[LV2_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[LV2]] to ptr
60 // CL20-NEXT: [[LA_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[LA]] to ptr
61 // CL20-NEXT: [[LP1_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[LP1]] to ptr
62 // CL20-NEXT: [[LP2_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[LP2]] to ptr
63 // CL20-NEXT: [[LVC_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[LVC]] to ptr
64 // CL20-NEXT: store i32 1, ptr [[LV1_ASCAST]], align 4
65 // CL20-NEXT: store i32 2, ptr [[LV2_ASCAST]], align 4
66 // CL20-NEXT: [[ARRAYIDX:%.*]] = getelementptr inbounds [100 x i32], ptr [[LA_ASCAST]], i64 0, i64 0
67 // CL20-NEXT: store i32 3, ptr [[ARRAYIDX]], align 4
68 // CL20-NEXT: store ptr [[LV1_ASCAST]], ptr [[LP1_ASCAST]], align 8
69 // CL20-NEXT: [[ARRAYDECAY:%.*]] = getelementptr inbounds [100 x i32], ptr [[LA_ASCAST]], i64 0, i64 0
70 // CL20-NEXT: store ptr [[ARRAYDECAY]], ptr [[LP2_ASCAST]], align 8
71 // CL20-NEXT: call void @func1(ptr noundef [[LV1_ASCAST]]) #[[ATTR2:[0-9]+]]
72 // CL20-NEXT: store i32 4, ptr [[LVC_ASCAST]], align 4
73 // CL20-NEXT: store i32 4, ptr [[LV1_ASCAST]], align 4
74 // CL20-NEXT: ret void
94 // CL12-LABEL: define dso_local void @func3(
95 // CL12-SAME: ) #[[ATTR0]] {
96 // CL12-NEXT: [[ENTRY:.*:]]
97 // CL12-NEXT: [[A:%.*]] = alloca [16 x [1 x float]], align 4, addrspace(5)
98 // CL12-NEXT: call void @llvm.memset.p5.i64(ptr addrspace(5) align 4 [[A]], i8 0, i64 64, i1 false)
99 // CL12-NEXT: ret void
101 // CL20-LABEL: define dso_local void @func3(
102 // CL20-SAME: ) #[[ATTR0]] {
103 // CL20-NEXT: [[ENTRY:.*:]]
104 // CL20-NEXT: [[A:%.*]] = alloca [16 x [1 x float]], align 4, addrspace(5)
105 // CL20-NEXT: [[A_ASCAST:%.*]] = addrspacecast ptr addrspace(5) [[A]] to ptr
106 // CL20-NEXT: call void @llvm.memset.p0.i64(ptr align 4 [[A_ASCAST]], i8 0, i64 64, i1 false)
107 // CL20-NEXT: ret void
110 float a[16][1] = {{0.}};