xref: /aosp_15_r20/external/llvm/test/CodeGen/AMDGPU/amdgpu.private-memory.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -show-mc-encoding -mattr=+promote-alloca -verify-machineinstrs -march=amdgcn < %s | FileCheck %s -check-prefix=SI-PROMOTE -check-prefix=SI -check-prefix=FUNC
2*9880d681SAndroid Build Coastguard Worker; RUN: llc -show-mc-encoding -mattr=+promote-alloca -verify-machineinstrs -mtriple=amdgcn--amdhsa -mcpu=kaveri -mattr=-unaligned-buffer-access < %s | FileCheck %s -check-prefix=SI-PROMOTE -check-prefix=SI -check-prefix=FUNC -check-prefix=HSA-PROMOTE
3*9880d681SAndroid Build Coastguard Worker; RUN: llc -show-mc-encoding -mattr=-promote-alloca -verify-machineinstrs -march=amdgcn < %s | FileCheck %s -check-prefix=SI-ALLOCA -check-prefix=SI -check-prefix=FUNC
4*9880d681SAndroid Build Coastguard Worker; RUN: llc -show-mc-encoding -mattr=-promote-alloca -verify-machineinstrs -mtriple=amdgcn-amdhsa -mcpu=kaveri -mattr=-unaligned-buffer-access < %s | FileCheck %s -check-prefix=SI-ALLOCA -check-prefix=SI -check-prefix=FUNC -check-prefix=HSA-ALLOCA
5*9880d681SAndroid Build Coastguard Worker; RUN: llc -show-mc-encoding -mattr=+promote-alloca -verify-machineinstrs -mtriple=amdgcn-amdhsa -march=amdgcn -mcpu=tonga -mattr=-unaligned-buffer-access < %s | FileCheck %s -check-prefix=SI-PROMOTE -check-prefix=SI -check-prefix=FUNC
6*9880d681SAndroid Build Coastguard Worker; RUN: llc -show-mc-encoding -mattr=-promote-alloca -verify-machineinstrs -mtriple=amdgcn-amdhsa -march=amdgcn -mcpu=tonga -mattr=-unaligned-buffer-access < %s | FileCheck %s -check-prefix=SI-ALLOCA -check-prefix=SI -check-prefix=FUNC
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker; RUN: opt -S -mtriple=amdgcn-unknown-amdhsa -mcpu=kaveri -amdgpu-promote-alloca < %s | FileCheck -check-prefix=HSAOPT -check-prefix=OPT %s
9*9880d681SAndroid Build Coastguard Worker; RUN: opt -S -mtriple=amdgcn-unknown-unknown -mcpu=kaveri -amdgpu-promote-alloca < %s | FileCheck -check-prefix=NOHSAOPT -check-prefix=OPT %s
10*9880d681SAndroid Build Coastguard Worker
11*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=r600 -mcpu=cypress < %s | FileCheck %s -check-prefix=R600 -check-prefix=FUNC
12*9880d681SAndroid Build Coastguard Worker
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Worker; HSAOPT: @mova_same_clause.stack = internal unnamed_addr addrspace(3) global [256 x [5 x i32]] undef, align 4
15*9880d681SAndroid Build Coastguard Worker; HSAOPT: @high_alignment.stack = internal unnamed_addr addrspace(3) global [256 x [8 x i32]] undef, align 16
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Worker
18*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}mova_same_clause:
19*9880d681SAndroid Build Coastguard Worker; OPT-LABEL: @mova_same_clause(
20*9880d681SAndroid Build Coastguard Worker
21*9880d681SAndroid Build Coastguard Worker; R600: LDS_WRITE
22*9880d681SAndroid Build Coastguard Worker; R600: LDS_WRITE
23*9880d681SAndroid Build Coastguard Worker; R600: LDS_READ
24*9880d681SAndroid Build Coastguard Worker; R600: LDS_READ
25*9880d681SAndroid Build Coastguard Worker
26*9880d681SAndroid Build Coastguard Worker; HSA-PROMOTE: .amd_kernel_code_t
27*9880d681SAndroid Build Coastguard Worker; HSA-PROMOTE: workgroup_group_segment_byte_size = 5120
28*9880d681SAndroid Build Coastguard Worker; HSA-PROMOTE: .end_amd_kernel_code_t
29*9880d681SAndroid Build Coastguard Worker
30*9880d681SAndroid Build Coastguard Worker; FIXME: These should be merged
31*9880d681SAndroid Build Coastguard Worker; HSA-PROMOTE: s_load_dword s{{[0-9]+}}, s[4:5], 0x1
32*9880d681SAndroid Build Coastguard Worker; HSA-PROMOTE: s_load_dword s{{[0-9]+}}, s[4:5], 0x2
33*9880d681SAndroid Build Coastguard Worker
34*9880d681SAndroid Build Coastguard Worker; SI-PROMOTE: ds_write_b32
35*9880d681SAndroid Build Coastguard Worker; SI-PROMOTE: ds_write_b32
36*9880d681SAndroid Build Coastguard Worker; SI-PROMOTE: ds_read_b32
37*9880d681SAndroid Build Coastguard Worker; SI-PROMOTE: ds_read_b32
38*9880d681SAndroid Build Coastguard Worker
39*9880d681SAndroid Build Coastguard Worker; HSA-ALLOCA: .amd_kernel_code_t
40*9880d681SAndroid Build Coastguard Worker; FIXME: Creating the emergency stack slots causes us to over-estimate scratch
41*9880d681SAndroid Build Coastguard Worker; by 4 bytes.
42*9880d681SAndroid Build Coastguard Worker; HSA-ALLOCA: workitem_private_segment_byte_size = 24
43*9880d681SAndroid Build Coastguard Worker; HSA-ALLOCA: .end_amd_kernel_code_t
44*9880d681SAndroid Build Coastguard Worker
45*9880d681SAndroid Build Coastguard Worker; HSA-ALLOCA: s_mov_b32 flat_scratch_lo, s7
46*9880d681SAndroid Build Coastguard Worker; HSA-ALLOCA: s_add_u32 s6, s6, s9
47*9880d681SAndroid Build Coastguard Worker; HSA-ALLOCA: s_lshr_b32 flat_scratch_hi, s6, 8
48*9880d681SAndroid Build Coastguard Worker
49*9880d681SAndroid Build Coastguard Worker; SI-ALLOCA: buffer_store_dword v{{[0-9]+}}, v{{[0-9]+}}, s[{{[0-9]+:[0-9]+}}], s{{[0-9]+}} offen ; encoding: [0x00,0x10,0x70,0xe0
50*9880d681SAndroid Build Coastguard Worker; SI-ALLOCA: buffer_store_dword v{{[0-9]+}}, v{{[0-9]+}}, s[{{[0-9]+:[0-9]+}}], s{{[0-9]+}} offen ; encoding: [0x00,0x10,0x70,0xe0
51*9880d681SAndroid Build Coastguard Worker
52*9880d681SAndroid Build Coastguard Worker
53*9880d681SAndroid Build Coastguard Worker; HSAOPT: [[DISPATCH_PTR:%[0-9]+]] = call noalias nonnull dereferenceable(64) i8 addrspace(2)* @llvm.amdgcn.dispatch.ptr()
54*9880d681SAndroid Build Coastguard Worker; HSAOPT: [[CAST_DISPATCH_PTR:%[0-9]+]] = bitcast i8 addrspace(2)* [[DISPATCH_PTR]] to i32 addrspace(2)*
55*9880d681SAndroid Build Coastguard Worker; HSAOPT: [[GEP0:%[0-9]+]] = getelementptr inbounds i32, i32 addrspace(2)* [[CAST_DISPATCH_PTR]], i64 1
56*9880d681SAndroid Build Coastguard Worker; HSAOPT: [[LDXY:%[0-9]+]] = load i32, i32 addrspace(2)* [[GEP0]], align 4, !invariant.load !0
57*9880d681SAndroid Build Coastguard Worker; HSAOPT: [[GEP1:%[0-9]+]] = getelementptr inbounds i32, i32 addrspace(2)* [[CAST_DISPATCH_PTR]], i64 2
58*9880d681SAndroid Build Coastguard Worker; HSAOPT: [[LDZU:%[0-9]+]] = load i32, i32 addrspace(2)* [[GEP1]], align 4, !range !1, !invariant.load !0
59*9880d681SAndroid Build Coastguard Worker; HSAOPT: [[EXTRACTY:%[0-9]+]] = lshr i32 [[LDXY]], 16
60*9880d681SAndroid Build Coastguard Worker
61*9880d681SAndroid Build Coastguard Worker; HSAOPT: [[WORKITEM_ID_X:%[0-9]+]] = call i32 @llvm.amdgcn.workitem.id.x(), !range !1
62*9880d681SAndroid Build Coastguard Worker; HSAOPT: [[WORKITEM_ID_Y:%[0-9]+]] = call i32 @llvm.amdgcn.workitem.id.y(), !range !1
63*9880d681SAndroid Build Coastguard Worker; HSAOPT: [[WORKITEM_ID_Z:%[0-9]+]] = call i32 @llvm.amdgcn.workitem.id.z(), !range !1
64*9880d681SAndroid Build Coastguard Worker
65*9880d681SAndroid Build Coastguard Worker; HSAOPT: [[Y_SIZE_X_Z_SIZE:%[0-9]+]] = mul nuw nsw i32 [[EXTRACTY]], [[LDZU]]
66*9880d681SAndroid Build Coastguard Worker; HSAOPT: [[YZ_X_XID:%[0-9]+]] = mul i32 [[Y_SIZE_X_Z_SIZE]], [[WORKITEM_ID_X]]
67*9880d681SAndroid Build Coastguard Worker; HSAOPT: [[Y_X_Z_SIZE:%[0-9]+]] = mul nuw nsw i32 [[WORKITEM_ID_Y]], [[LDZU]]
68*9880d681SAndroid Build Coastguard Worker; HSAOPT: [[ADD_YZ_X_X_YZ_SIZE:%[0-9]+]] = add i32 [[YZ_X_XID]], [[Y_X_Z_SIZE]]
69*9880d681SAndroid Build Coastguard Worker; HSAOPT: [[ADD_ZID:%[0-9]+]] = add i32 [[ADD_YZ_X_X_YZ_SIZE]], [[WORKITEM_ID_Z]]
70*9880d681SAndroid Build Coastguard Worker
71*9880d681SAndroid Build Coastguard Worker; HSAOPT: [[LOCAL_GEP:%[0-9]+]] = getelementptr inbounds [256 x [5 x i32]], [256 x [5 x i32]] addrspace(3)* @mova_same_clause.stack, i32 0, i32 [[ADD_ZID]]
72*9880d681SAndroid Build Coastguard Worker; HSAOPT: %arrayidx1 = getelementptr inbounds [5 x i32], [5 x i32] addrspace(3)* [[LOCAL_GEP]], i32 0, i32 {{%[0-9]+}}
73*9880d681SAndroid Build Coastguard Worker; HSAOPT: %arrayidx3 = getelementptr inbounds [5 x i32], [5 x i32] addrspace(3)* [[LOCAL_GEP]], i32 0, i32 {{%[0-9]+}}
74*9880d681SAndroid Build Coastguard Worker; HSAOPT: %arrayidx10 = getelementptr inbounds [5 x i32], [5 x i32] addrspace(3)* [[LOCAL_GEP]], i32 0, i32 0
75*9880d681SAndroid Build Coastguard Worker; HSAOPT: %arrayidx12 = getelementptr inbounds [5 x i32], [5 x i32] addrspace(3)* [[LOCAL_GEP]], i32 0, i32 1
76*9880d681SAndroid Build Coastguard Worker
77*9880d681SAndroid Build Coastguard Worker
78*9880d681SAndroid Build Coastguard Worker; NOHSAOPT: call i32 @llvm.r600.read.local.size.y(), !range !0
79*9880d681SAndroid Build Coastguard Worker; NOHSAOPT: call i32 @llvm.r600.read.local.size.z(), !range !0
80*9880d681SAndroid Build Coastguard Worker; NOHSAOPT: call i32 @llvm.amdgcn.workitem.id.x(), !range !0
81*9880d681SAndroid Build Coastguard Worker; NOHSAOPT: call i32 @llvm.amdgcn.workitem.id.y(), !range !0
82*9880d681SAndroid Build Coastguard Worker; NOHSAOPT: call i32 @llvm.amdgcn.workitem.id.z(), !range !0
83*9880d681SAndroid Build Coastguard Workerdefine void @mova_same_clause(i32 addrspace(1)* nocapture %out, i32 addrspace(1)* nocapture %in) #0 {
84*9880d681SAndroid Build Coastguard Workerentry:
85*9880d681SAndroid Build Coastguard Worker  %stack = alloca [5 x i32], align 4
86*9880d681SAndroid Build Coastguard Worker  %0 = load i32, i32 addrspace(1)* %in, align 4
87*9880d681SAndroid Build Coastguard Worker  %arrayidx1 = getelementptr inbounds [5 x i32], [5 x i32]* %stack, i32 0, i32 %0
88*9880d681SAndroid Build Coastguard Worker  store i32 4, i32* %arrayidx1, align 4
89*9880d681SAndroid Build Coastguard Worker  %arrayidx2 = getelementptr inbounds i32, i32 addrspace(1)* %in, i32 1
90*9880d681SAndroid Build Coastguard Worker  %1 = load i32, i32 addrspace(1)* %arrayidx2, align 4
91*9880d681SAndroid Build Coastguard Worker  %arrayidx3 = getelementptr inbounds [5 x i32], [5 x i32]* %stack, i32 0, i32 %1
92*9880d681SAndroid Build Coastguard Worker  store i32 5, i32* %arrayidx3, align 4
93*9880d681SAndroid Build Coastguard Worker  %arrayidx10 = getelementptr inbounds [5 x i32], [5 x i32]* %stack, i32 0, i32 0
94*9880d681SAndroid Build Coastguard Worker  %2 = load i32, i32* %arrayidx10, align 4
95*9880d681SAndroid Build Coastguard Worker  store i32 %2, i32 addrspace(1)* %out, align 4
96*9880d681SAndroid Build Coastguard Worker  %arrayidx12 = getelementptr inbounds [5 x i32], [5 x i32]* %stack, i32 0, i32 1
97*9880d681SAndroid Build Coastguard Worker  %3 = load i32, i32* %arrayidx12
98*9880d681SAndroid Build Coastguard Worker  %arrayidx13 = getelementptr inbounds i32, i32 addrspace(1)* %out, i32 1
99*9880d681SAndroid Build Coastguard Worker  store i32 %3, i32 addrspace(1)* %arrayidx13
100*9880d681SAndroid Build Coastguard Worker  ret void
101*9880d681SAndroid Build Coastguard Worker}
102*9880d681SAndroid Build Coastguard Worker
103*9880d681SAndroid Build Coastguard Worker; OPT-LABEL: @high_alignment(
104*9880d681SAndroid Build Coastguard Worker; OPT: getelementptr inbounds [256 x [8 x i32]], [256 x [8 x i32]] addrspace(3)* @high_alignment.stack, i32 0, i32 %{{[0-9]+}}
105*9880d681SAndroid Build Coastguard Workerdefine void @high_alignment(i32 addrspace(1)* nocapture %out, i32 addrspace(1)* nocapture %in) #0 {
106*9880d681SAndroid Build Coastguard Workerentry:
107*9880d681SAndroid Build Coastguard Worker  %stack = alloca [8 x i32], align 16
108*9880d681SAndroid Build Coastguard Worker  %0 = load i32, i32 addrspace(1)* %in, align 4
109*9880d681SAndroid Build Coastguard Worker  %arrayidx1 = getelementptr inbounds [8 x i32], [8 x i32]* %stack, i32 0, i32 %0
110*9880d681SAndroid Build Coastguard Worker  store i32 4, i32* %arrayidx1, align 4
111*9880d681SAndroid Build Coastguard Worker  %arrayidx2 = getelementptr inbounds i32, i32 addrspace(1)* %in, i32 1
112*9880d681SAndroid Build Coastguard Worker  %1 = load i32, i32 addrspace(1)* %arrayidx2, align 4
113*9880d681SAndroid Build Coastguard Worker  %arrayidx3 = getelementptr inbounds [8 x i32], [8 x i32]* %stack, i32 0, i32 %1
114*9880d681SAndroid Build Coastguard Worker  store i32 5, i32* %arrayidx3, align 4
115*9880d681SAndroid Build Coastguard Worker  %arrayidx10 = getelementptr inbounds [8 x i32], [8 x i32]* %stack, i32 0, i32 0
116*9880d681SAndroid Build Coastguard Worker  %2 = load i32, i32* %arrayidx10, align 4
117*9880d681SAndroid Build Coastguard Worker  store i32 %2, i32 addrspace(1)* %out, align 4
118*9880d681SAndroid Build Coastguard Worker  %arrayidx12 = getelementptr inbounds [8 x i32], [8 x i32]* %stack, i32 0, i32 1
119*9880d681SAndroid Build Coastguard Worker  %3 = load i32, i32* %arrayidx12
120*9880d681SAndroid Build Coastguard Worker  %arrayidx13 = getelementptr inbounds i32, i32 addrspace(1)* %out, i32 1
121*9880d681SAndroid Build Coastguard Worker  store i32 %3, i32 addrspace(1)* %arrayidx13
122*9880d681SAndroid Build Coastguard Worker  ret void
123*9880d681SAndroid Build Coastguard Worker}
124*9880d681SAndroid Build Coastguard Worker
125*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}no_replace_inbounds_gep:
126*9880d681SAndroid Build Coastguard Worker; OPT-LABEL: @no_replace_inbounds_gep(
127*9880d681SAndroid Build Coastguard Worker; OPT: alloca [5 x i32]
128*9880d681SAndroid Build Coastguard Worker
129*9880d681SAndroid Build Coastguard Worker; SI-NOT: ds_write
130*9880d681SAndroid Build Coastguard Workerdefine void @no_replace_inbounds_gep(i32 addrspace(1)* nocapture %out, i32 addrspace(1)* nocapture %in) #0 {
131*9880d681SAndroid Build Coastguard Workerentry:
132*9880d681SAndroid Build Coastguard Worker  %stack = alloca [5 x i32], align 4
133*9880d681SAndroid Build Coastguard Worker  %0 = load i32, i32 addrspace(1)* %in, align 4
134*9880d681SAndroid Build Coastguard Worker  %arrayidx1 = getelementptr [5 x i32], [5 x i32]* %stack, i32 0, i32 %0
135*9880d681SAndroid Build Coastguard Worker  store i32 4, i32* %arrayidx1, align 4
136*9880d681SAndroid Build Coastguard Worker  %arrayidx2 = getelementptr inbounds i32, i32 addrspace(1)* %in, i32 1
137*9880d681SAndroid Build Coastguard Worker  %1 = load i32, i32 addrspace(1)* %arrayidx2, align 4
138*9880d681SAndroid Build Coastguard Worker  %arrayidx3 = getelementptr inbounds [5 x i32], [5 x i32]* %stack, i32 0, i32 %1
139*9880d681SAndroid Build Coastguard Worker  store i32 5, i32* %arrayidx3, align 4
140*9880d681SAndroid Build Coastguard Worker  %arrayidx10 = getelementptr inbounds [5 x i32], [5 x i32]* %stack, i32 0, i32 0
141*9880d681SAndroid Build Coastguard Worker  %2 = load i32, i32* %arrayidx10, align 4
142*9880d681SAndroid Build Coastguard Worker  store i32 %2, i32 addrspace(1)* %out, align 4
143*9880d681SAndroid Build Coastguard Worker  %arrayidx12 = getelementptr inbounds [5 x i32], [5 x i32]* %stack, i32 0, i32 1
144*9880d681SAndroid Build Coastguard Worker  %3 = load i32, i32* %arrayidx12
145*9880d681SAndroid Build Coastguard Worker  %arrayidx13 = getelementptr inbounds i32, i32 addrspace(1)* %out, i32 1
146*9880d681SAndroid Build Coastguard Worker  store i32 %3, i32 addrspace(1)* %arrayidx13
147*9880d681SAndroid Build Coastguard Worker  ret void
148*9880d681SAndroid Build Coastguard Worker}
149*9880d681SAndroid Build Coastguard Worker
150*9880d681SAndroid Build Coastguard Worker; This test checks that the stack offset is calculated correctly for structs.
151*9880d681SAndroid Build Coastguard Worker; All register loads/stores should be optimized away, so there shouldn't be
152*9880d681SAndroid Build Coastguard Worker; any MOVA instructions.
153*9880d681SAndroid Build Coastguard Worker;
154*9880d681SAndroid Build Coastguard Worker; XXX: This generated code has unnecessary MOVs, we should be able to optimize
155*9880d681SAndroid Build Coastguard Worker; this.
156*9880d681SAndroid Build Coastguard Worker
157*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}multiple_structs:
158*9880d681SAndroid Build Coastguard Worker; OPT-LABEL: @multiple_structs(
159*9880d681SAndroid Build Coastguard Worker
160*9880d681SAndroid Build Coastguard Worker; R600-NOT: MOVA_INT
161*9880d681SAndroid Build Coastguard Worker; SI-NOT: v_movrel
162*9880d681SAndroid Build Coastguard Worker; SI-NOT: v_movrel
163*9880d681SAndroid Build Coastguard Worker%struct.point = type { i32, i32 }
164*9880d681SAndroid Build Coastguard Worker
165*9880d681SAndroid Build Coastguard Workerdefine void @multiple_structs(i32 addrspace(1)* %out) #0 {
166*9880d681SAndroid Build Coastguard Workerentry:
167*9880d681SAndroid Build Coastguard Worker  %a = alloca %struct.point
168*9880d681SAndroid Build Coastguard Worker  %b = alloca %struct.point
169*9880d681SAndroid Build Coastguard Worker  %a.x.ptr = getelementptr %struct.point, %struct.point* %a, i32 0, i32 0
170*9880d681SAndroid Build Coastguard Worker  %a.y.ptr = getelementptr %struct.point, %struct.point* %a, i32 0, i32 1
171*9880d681SAndroid Build Coastguard Worker  %b.x.ptr = getelementptr %struct.point, %struct.point* %b, i32 0, i32 0
172*9880d681SAndroid Build Coastguard Worker  %b.y.ptr = getelementptr %struct.point, %struct.point* %b, i32 0, i32 1
173*9880d681SAndroid Build Coastguard Worker  store i32 0, i32* %a.x.ptr
174*9880d681SAndroid Build Coastguard Worker  store i32 1, i32* %a.y.ptr
175*9880d681SAndroid Build Coastguard Worker  store i32 2, i32* %b.x.ptr
176*9880d681SAndroid Build Coastguard Worker  store i32 3, i32* %b.y.ptr
177*9880d681SAndroid Build Coastguard Worker  %a.indirect.ptr = getelementptr %struct.point, %struct.point* %a, i32 0, i32 0
178*9880d681SAndroid Build Coastguard Worker  %b.indirect.ptr = getelementptr %struct.point, %struct.point* %b, i32 0, i32 0
179*9880d681SAndroid Build Coastguard Worker  %a.indirect = load i32, i32* %a.indirect.ptr
180*9880d681SAndroid Build Coastguard Worker  %b.indirect = load i32, i32* %b.indirect.ptr
181*9880d681SAndroid Build Coastguard Worker  %0 = add i32 %a.indirect, %b.indirect
182*9880d681SAndroid Build Coastguard Worker  store i32 %0, i32 addrspace(1)* %out
183*9880d681SAndroid Build Coastguard Worker  ret void
184*9880d681SAndroid Build Coastguard Worker}
185*9880d681SAndroid Build Coastguard Worker
186*9880d681SAndroid Build Coastguard Worker; Test direct access of a private array inside a loop.  The private array
187*9880d681SAndroid Build Coastguard Worker; loads and stores should be lowered to copies, so there shouldn't be any
188*9880d681SAndroid Build Coastguard Worker; MOVA instructions.
189*9880d681SAndroid Build Coastguard Worker
190*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}direct_loop:
191*9880d681SAndroid Build Coastguard Worker; R600-NOT: MOVA_INT
192*9880d681SAndroid Build Coastguard Worker; SI-NOT: v_movrel
193*9880d681SAndroid Build Coastguard Worker
194*9880d681SAndroid Build Coastguard Workerdefine void @direct_loop(i32 addrspace(1)* %out, i32 addrspace(1)* %in) #0 {
195*9880d681SAndroid Build Coastguard Workerentry:
196*9880d681SAndroid Build Coastguard Worker  %prv_array_const = alloca [2 x i32]
197*9880d681SAndroid Build Coastguard Worker  %prv_array = alloca [2 x i32]
198*9880d681SAndroid Build Coastguard Worker  %a = load i32, i32 addrspace(1)* %in
199*9880d681SAndroid Build Coastguard Worker  %b_src_ptr = getelementptr inbounds i32, i32 addrspace(1)* %in, i32 1
200*9880d681SAndroid Build Coastguard Worker  %b = load i32, i32 addrspace(1)* %b_src_ptr
201*9880d681SAndroid Build Coastguard Worker  %a_dst_ptr = getelementptr inbounds [2 x i32], [2 x i32]* %prv_array_const, i32 0, i32 0
202*9880d681SAndroid Build Coastguard Worker  store i32 %a, i32* %a_dst_ptr
203*9880d681SAndroid Build Coastguard Worker  %b_dst_ptr = getelementptr inbounds [2 x i32], [2 x i32]* %prv_array_const, i32 0, i32 1
204*9880d681SAndroid Build Coastguard Worker  store i32 %b, i32* %b_dst_ptr
205*9880d681SAndroid Build Coastguard Worker  br label %for.body
206*9880d681SAndroid Build Coastguard Worker
207*9880d681SAndroid Build Coastguard Workerfor.body:
208*9880d681SAndroid Build Coastguard Worker  %inc = phi i32 [0, %entry], [%count, %for.body]
209*9880d681SAndroid Build Coastguard Worker  %x_ptr = getelementptr inbounds [2 x i32], [2 x i32]* %prv_array_const, i32 0, i32 0
210*9880d681SAndroid Build Coastguard Worker  %x = load i32, i32* %x_ptr
211*9880d681SAndroid Build Coastguard Worker  %y_ptr = getelementptr inbounds [2 x i32], [2 x i32]* %prv_array, i32 0, i32 0
212*9880d681SAndroid Build Coastguard Worker  %y = load i32, i32* %y_ptr
213*9880d681SAndroid Build Coastguard Worker  %xy = add i32 %x, %y
214*9880d681SAndroid Build Coastguard Worker  store i32 %xy, i32* %y_ptr
215*9880d681SAndroid Build Coastguard Worker  %count = add i32 %inc, 1
216*9880d681SAndroid Build Coastguard Worker  %done = icmp eq i32 %count, 4095
217*9880d681SAndroid Build Coastguard Worker  br i1 %done, label %for.end, label %for.body
218*9880d681SAndroid Build Coastguard Worker
219*9880d681SAndroid Build Coastguard Workerfor.end:
220*9880d681SAndroid Build Coastguard Worker  %value_ptr = getelementptr inbounds [2 x i32], [2 x i32]* %prv_array, i32 0, i32 0
221*9880d681SAndroid Build Coastguard Worker  %value = load i32, i32* %value_ptr
222*9880d681SAndroid Build Coastguard Worker  store i32 %value, i32 addrspace(1)* %out
223*9880d681SAndroid Build Coastguard Worker  ret void
224*9880d681SAndroid Build Coastguard Worker}
225*9880d681SAndroid Build Coastguard Worker
226*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}short_array:
227*9880d681SAndroid Build Coastguard Worker
228*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
229*9880d681SAndroid Build Coastguard Worker
230*9880d681SAndroid Build Coastguard Worker; SI-PROMOTE-DAG: buffer_store_short v{{[0-9]+}}, v{{[0-9]+}}, s[{{[0-9]+:[0-9]+}}], s{{[0-9]+}} offen ; encoding: [0x00,0x10,0x68,0xe0
231*9880d681SAndroid Build Coastguard Worker; SI-PROMOTE-DAG: buffer_store_short v{{[0-9]+}}, v{{[0-9]+}}, s[{{[0-9]+:[0-9]+}}], s{{[0-9]+}} offen offset:2 ; encoding: [0x02,0x10,0x68,0xe0
232*9880d681SAndroid Build Coastguard Worker; SI-PROMOTE: buffer_load_sshort v{{[0-9]+}}, v{{[0-9]+}}, s[{{[0-9]+:[0-9]+}}], s{{[0-9]+}}
233*9880d681SAndroid Build Coastguard Workerdefine void @short_array(i32 addrspace(1)* %out, i32 %index) #0 {
234*9880d681SAndroid Build Coastguard Workerentry:
235*9880d681SAndroid Build Coastguard Worker  %0 = alloca [2 x i16]
236*9880d681SAndroid Build Coastguard Worker  %1 = getelementptr inbounds [2 x i16], [2 x i16]* %0, i32 0, i32 0
237*9880d681SAndroid Build Coastguard Worker  %2 = getelementptr inbounds [2 x i16], [2 x i16]* %0, i32 0, i32 1
238*9880d681SAndroid Build Coastguard Worker  store i16 0, i16* %1
239*9880d681SAndroid Build Coastguard Worker  store i16 1, i16* %2
240*9880d681SAndroid Build Coastguard Worker  %3 = getelementptr inbounds [2 x i16], [2 x i16]* %0, i32 0, i32 %index
241*9880d681SAndroid Build Coastguard Worker  %4 = load i16, i16* %3
242*9880d681SAndroid Build Coastguard Worker  %5 = sext i16 %4 to i32
243*9880d681SAndroid Build Coastguard Worker  store i32 %5, i32 addrspace(1)* %out
244*9880d681SAndroid Build Coastguard Worker  ret void
245*9880d681SAndroid Build Coastguard Worker}
246*9880d681SAndroid Build Coastguard Worker
247*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}char_array:
248*9880d681SAndroid Build Coastguard Worker
249*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
250*9880d681SAndroid Build Coastguard Worker
251*9880d681SAndroid Build Coastguard Worker; SI-DAG: buffer_store_byte v{{[0-9]+}}, v{{[0-9]+}}, s[{{[0-9]+:[0-9]+}}], s{{[0-9]+}} offen ; encoding: [0x00,0x10,0x60,0xe0
252*9880d681SAndroid Build Coastguard Worker; SI-DAG: buffer_store_byte v{{[0-9]+}}, v{{[0-9]+}}, s[{{[0-9]+:[0-9]+}}], s{{[0-9]+}} offen offset:1 ; encoding: [0x01,0x10,0x60,0xe0
253*9880d681SAndroid Build Coastguard Workerdefine void @char_array(i32 addrspace(1)* %out, i32 %index) #0 {
254*9880d681SAndroid Build Coastguard Workerentry:
255*9880d681SAndroid Build Coastguard Worker  %0 = alloca [2 x i8]
256*9880d681SAndroid Build Coastguard Worker  %1 = getelementptr inbounds [2 x i8], [2 x i8]* %0, i32 0, i32 0
257*9880d681SAndroid Build Coastguard Worker  %2 = getelementptr inbounds [2 x i8], [2 x i8]* %0, i32 0, i32 1
258*9880d681SAndroid Build Coastguard Worker  store i8 0, i8* %1
259*9880d681SAndroid Build Coastguard Worker  store i8 1, i8* %2
260*9880d681SAndroid Build Coastguard Worker  %3 = getelementptr inbounds [2 x i8], [2 x i8]* %0, i32 0, i32 %index
261*9880d681SAndroid Build Coastguard Worker  %4 = load i8, i8* %3
262*9880d681SAndroid Build Coastguard Worker  %5 = sext i8 %4 to i32
263*9880d681SAndroid Build Coastguard Worker  store i32 %5, i32 addrspace(1)* %out
264*9880d681SAndroid Build Coastguard Worker  ret void
265*9880d681SAndroid Build Coastguard Worker
266*9880d681SAndroid Build Coastguard Worker}
267*9880d681SAndroid Build Coastguard Worker
268*9880d681SAndroid Build Coastguard Worker; Test that two stack objects are not stored in the same register
269*9880d681SAndroid Build Coastguard Worker; The second stack object should be in T3.X
270*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: {{^}}no_overlap:
271*9880d681SAndroid Build Coastguard Worker; R600_CHECK: MOV
272*9880d681SAndroid Build Coastguard Worker; R600_CHECK: [[CHAN:[XYZW]]]+
273*9880d681SAndroid Build Coastguard Worker; R600-NOT: [[CHAN]]+
274*9880d681SAndroid Build Coastguard Worker; SI: v_mov_b32_e32 v3
275*9880d681SAndroid Build Coastguard Workerdefine void @no_overlap(i32 addrspace(1)* %out, i32 %in) #0 {
276*9880d681SAndroid Build Coastguard Workerentry:
277*9880d681SAndroid Build Coastguard Worker  %0 = alloca [3 x i8], align 1
278*9880d681SAndroid Build Coastguard Worker  %1 = alloca [2 x i8], align 1
279*9880d681SAndroid Build Coastguard Worker  %2 = getelementptr [3 x i8], [3 x i8]* %0, i32 0, i32 0
280*9880d681SAndroid Build Coastguard Worker  %3 = getelementptr [3 x i8], [3 x i8]* %0, i32 0, i32 1
281*9880d681SAndroid Build Coastguard Worker  %4 = getelementptr [3 x i8], [3 x i8]* %0, i32 0, i32 2
282*9880d681SAndroid Build Coastguard Worker  %5 = getelementptr [2 x i8], [2 x i8]* %1, i32 0, i32 0
283*9880d681SAndroid Build Coastguard Worker  %6 = getelementptr [2 x i8], [2 x i8]* %1, i32 0, i32 1
284*9880d681SAndroid Build Coastguard Worker  store i8 0, i8* %2
285*9880d681SAndroid Build Coastguard Worker  store i8 1, i8* %3
286*9880d681SAndroid Build Coastguard Worker  store i8 2, i8* %4
287*9880d681SAndroid Build Coastguard Worker  store i8 1, i8* %5
288*9880d681SAndroid Build Coastguard Worker  store i8 0, i8* %6
289*9880d681SAndroid Build Coastguard Worker  %7 = getelementptr [3 x i8], [3 x i8]* %0, i32 0, i32 %in
290*9880d681SAndroid Build Coastguard Worker  %8 = getelementptr [2 x i8], [2 x i8]* %1, i32 0, i32 %in
291*9880d681SAndroid Build Coastguard Worker  %9 = load i8, i8* %7
292*9880d681SAndroid Build Coastguard Worker  %10 = load i8, i8* %8
293*9880d681SAndroid Build Coastguard Worker  %11 = add i8 %9, %10
294*9880d681SAndroid Build Coastguard Worker  %12 = sext i8 %11 to i32
295*9880d681SAndroid Build Coastguard Worker  store i32 %12, i32 addrspace(1)* %out
296*9880d681SAndroid Build Coastguard Worker  ret void
297*9880d681SAndroid Build Coastguard Worker}
298*9880d681SAndroid Build Coastguard Worker
299*9880d681SAndroid Build Coastguard Workerdefine void @char_array_array(i32 addrspace(1)* %out, i32 %index) #0 {
300*9880d681SAndroid Build Coastguard Workerentry:
301*9880d681SAndroid Build Coastguard Worker  %alloca = alloca [2 x [2 x i8]]
302*9880d681SAndroid Build Coastguard Worker  %gep0 = getelementptr [2 x [2 x i8]], [2 x [2 x i8]]* %alloca, i32 0, i32 0, i32 0
303*9880d681SAndroid Build Coastguard Worker  %gep1 = getelementptr [2 x [2 x i8]], [2 x [2 x i8]]* %alloca, i32 0, i32 0, i32 1
304*9880d681SAndroid Build Coastguard Worker  store i8 0, i8* %gep0
305*9880d681SAndroid Build Coastguard Worker  store i8 1, i8* %gep1
306*9880d681SAndroid Build Coastguard Worker  %gep2 = getelementptr [2 x [2 x i8]], [2 x [2 x i8]]* %alloca, i32 0, i32 0, i32 %index
307*9880d681SAndroid Build Coastguard Worker  %load = load i8, i8* %gep2
308*9880d681SAndroid Build Coastguard Worker  %sext = sext i8 %load to i32
309*9880d681SAndroid Build Coastguard Worker  store i32 %sext, i32 addrspace(1)* %out
310*9880d681SAndroid Build Coastguard Worker  ret void
311*9880d681SAndroid Build Coastguard Worker}
312*9880d681SAndroid Build Coastguard Worker
313*9880d681SAndroid Build Coastguard Workerdefine void @i32_array_array(i32 addrspace(1)* %out, i32 %index) #0 {
314*9880d681SAndroid Build Coastguard Workerentry:
315*9880d681SAndroid Build Coastguard Worker  %alloca = alloca [2 x [2 x i32]]
316*9880d681SAndroid Build Coastguard Worker  %gep0 = getelementptr [2 x [2 x i32]], [2 x [2 x i32]]* %alloca, i32 0, i32 0, i32 0
317*9880d681SAndroid Build Coastguard Worker  %gep1 = getelementptr [2 x [2 x i32]], [2 x [2 x i32]]* %alloca, i32 0, i32 0, i32 1
318*9880d681SAndroid Build Coastguard Worker  store i32 0, i32* %gep0
319*9880d681SAndroid Build Coastguard Worker  store i32 1, i32* %gep1
320*9880d681SAndroid Build Coastguard Worker  %gep2 = getelementptr [2 x [2 x i32]], [2 x [2 x i32]]* %alloca, i32 0, i32 0, i32 %index
321*9880d681SAndroid Build Coastguard Worker  %load = load i32, i32* %gep2
322*9880d681SAndroid Build Coastguard Worker  store i32 %load, i32 addrspace(1)* %out
323*9880d681SAndroid Build Coastguard Worker  ret void
324*9880d681SAndroid Build Coastguard Worker}
325*9880d681SAndroid Build Coastguard Worker
326*9880d681SAndroid Build Coastguard Workerdefine void @i64_array_array(i64 addrspace(1)* %out, i32 %index) #0 {
327*9880d681SAndroid Build Coastguard Workerentry:
328*9880d681SAndroid Build Coastguard Worker  %alloca = alloca [2 x [2 x i64]]
329*9880d681SAndroid Build Coastguard Worker  %gep0 = getelementptr [2 x [2 x i64]], [2 x [2 x i64]]* %alloca, i32 0, i32 0, i32 0
330*9880d681SAndroid Build Coastguard Worker  %gep1 = getelementptr [2 x [2 x i64]], [2 x [2 x i64]]* %alloca, i32 0, i32 0, i32 1
331*9880d681SAndroid Build Coastguard Worker  store i64 0, i64* %gep0
332*9880d681SAndroid Build Coastguard Worker  store i64 1, i64* %gep1
333*9880d681SAndroid Build Coastguard Worker  %gep2 = getelementptr [2 x [2 x i64]], [2 x [2 x i64]]* %alloca, i32 0, i32 0, i32 %index
334*9880d681SAndroid Build Coastguard Worker  %load = load i64, i64* %gep2
335*9880d681SAndroid Build Coastguard Worker  store i64 %load, i64 addrspace(1)* %out
336*9880d681SAndroid Build Coastguard Worker  ret void
337*9880d681SAndroid Build Coastguard Worker}
338*9880d681SAndroid Build Coastguard Worker
339*9880d681SAndroid Build Coastguard Worker%struct.pair32 = type { i32, i32 }
340*9880d681SAndroid Build Coastguard Worker
341*9880d681SAndroid Build Coastguard Workerdefine void @struct_array_array(i32 addrspace(1)* %out, i32 %index) #0 {
342*9880d681SAndroid Build Coastguard Workerentry:
343*9880d681SAndroid Build Coastguard Worker  %alloca = alloca [2 x [2 x %struct.pair32]]
344*9880d681SAndroid Build Coastguard Worker  %gep0 = getelementptr [2 x [2 x %struct.pair32]], [2 x [2 x %struct.pair32]]* %alloca, i32 0, i32 0, i32 0, i32 1
345*9880d681SAndroid Build Coastguard Worker  %gep1 = getelementptr [2 x [2 x %struct.pair32]], [2 x [2 x %struct.pair32]]* %alloca, i32 0, i32 0, i32 1, i32 1
346*9880d681SAndroid Build Coastguard Worker  store i32 0, i32* %gep0
347*9880d681SAndroid Build Coastguard Worker  store i32 1, i32* %gep1
348*9880d681SAndroid Build Coastguard Worker  %gep2 = getelementptr [2 x [2 x %struct.pair32]], [2 x [2 x %struct.pair32]]* %alloca, i32 0, i32 0, i32 %index, i32 0
349*9880d681SAndroid Build Coastguard Worker  %load = load i32, i32* %gep2
350*9880d681SAndroid Build Coastguard Worker  store i32 %load, i32 addrspace(1)* %out
351*9880d681SAndroid Build Coastguard Worker  ret void
352*9880d681SAndroid Build Coastguard Worker}
353*9880d681SAndroid Build Coastguard Worker
354*9880d681SAndroid Build Coastguard Workerdefine void @struct_pair32_array(i32 addrspace(1)* %out, i32 %index) #0 {
355*9880d681SAndroid Build Coastguard Workerentry:
356*9880d681SAndroid Build Coastguard Worker  %alloca = alloca [2 x %struct.pair32]
357*9880d681SAndroid Build Coastguard Worker  %gep0 = getelementptr [2 x %struct.pair32], [2 x %struct.pair32]* %alloca, i32 0, i32 0, i32 1
358*9880d681SAndroid Build Coastguard Worker  %gep1 = getelementptr [2 x %struct.pair32], [2 x %struct.pair32]* %alloca, i32 0, i32 1, i32 0
359*9880d681SAndroid Build Coastguard Worker  store i32 0, i32* %gep0
360*9880d681SAndroid Build Coastguard Worker  store i32 1, i32* %gep1
361*9880d681SAndroid Build Coastguard Worker  %gep2 = getelementptr [2 x %struct.pair32], [2 x %struct.pair32]* %alloca, i32 0, i32 %index, i32 0
362*9880d681SAndroid Build Coastguard Worker  %load = load i32, i32* %gep2
363*9880d681SAndroid Build Coastguard Worker  store i32 %load, i32 addrspace(1)* %out
364*9880d681SAndroid Build Coastguard Worker  ret void
365*9880d681SAndroid Build Coastguard Worker}
366*9880d681SAndroid Build Coastguard Worker
367*9880d681SAndroid Build Coastguard Workerdefine void @select_private(i32 addrspace(1)* %out, i32 %in) nounwind {
368*9880d681SAndroid Build Coastguard Workerentry:
369*9880d681SAndroid Build Coastguard Worker  %tmp = alloca [2 x i32]
370*9880d681SAndroid Build Coastguard Worker  %tmp1 = getelementptr [2 x i32], [2 x i32]* %tmp, i32 0, i32 0
371*9880d681SAndroid Build Coastguard Worker  %tmp2 = getelementptr [2 x i32], [2 x i32]* %tmp, i32 0, i32 1
372*9880d681SAndroid Build Coastguard Worker  store i32 0, i32* %tmp1
373*9880d681SAndroid Build Coastguard Worker  store i32 1, i32* %tmp2
374*9880d681SAndroid Build Coastguard Worker  %cmp = icmp eq i32 %in, 0
375*9880d681SAndroid Build Coastguard Worker  %sel = select i1 %cmp, i32* %tmp1, i32* %tmp2
376*9880d681SAndroid Build Coastguard Worker  %load = load i32, i32* %sel
377*9880d681SAndroid Build Coastguard Worker  store i32 %load, i32 addrspace(1)* %out
378*9880d681SAndroid Build Coastguard Worker  ret void
379*9880d681SAndroid Build Coastguard Worker}
380*9880d681SAndroid Build Coastguard Worker
381*9880d681SAndroid Build Coastguard Worker; AMDGPUPromoteAlloca does not know how to handle ptrtoint.  When it
382*9880d681SAndroid Build Coastguard Worker; finds one, it should stop trying to promote.
383*9880d681SAndroid Build Coastguard Worker
384*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: ptrtoint:
385*9880d681SAndroid Build Coastguard Worker; SI-NOT: ds_write
386*9880d681SAndroid Build Coastguard Worker; SI: buffer_store_dword v{{[0-9]+}}, v{{[0-9]+}}, s[{{[0-9]+:[0-9]+}}], s{{[0-9]+}} offen
387*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword v{{[0-9]+}}, v{{[0-9]+}}, s[{{[0-9]+:[0-9]+}}], s{{[0-9]+}} offen offset:5 ;
388*9880d681SAndroid Build Coastguard Workerdefine void @ptrtoint(i32 addrspace(1)* %out, i32 %a, i32 %b) #0 {
389*9880d681SAndroid Build Coastguard Worker  %alloca = alloca [16 x i32]
390*9880d681SAndroid Build Coastguard Worker  %tmp0 = getelementptr [16 x i32], [16 x i32]* %alloca, i32 0, i32 %a
391*9880d681SAndroid Build Coastguard Worker  store i32 5, i32* %tmp0
392*9880d681SAndroid Build Coastguard Worker  %tmp1 = ptrtoint [16 x i32]* %alloca to i32
393*9880d681SAndroid Build Coastguard Worker  %tmp2 = add i32 %tmp1, 5
394*9880d681SAndroid Build Coastguard Worker  %tmp3 = inttoptr i32 %tmp2 to i32*
395*9880d681SAndroid Build Coastguard Worker  %tmp4 = getelementptr i32, i32* %tmp3, i32 %b
396*9880d681SAndroid Build Coastguard Worker  %tmp5 = load i32, i32* %tmp4
397*9880d681SAndroid Build Coastguard Worker  store i32 %tmp5, i32 addrspace(1)* %out
398*9880d681SAndroid Build Coastguard Worker  ret void
399*9880d681SAndroid Build Coastguard Worker}
400*9880d681SAndroid Build Coastguard Worker
401*9880d681SAndroid Build Coastguard Worker; OPT-LABEL: @pointer_typed_alloca(
402*9880d681SAndroid Build Coastguard Worker; OPT:  getelementptr inbounds [256 x i32 addrspace(1)*], [256 x i32 addrspace(1)*] addrspace(3)* @pointer_typed_alloca.A.addr, i32 0, i32 %{{[0-9]+}}
403*9880d681SAndroid Build Coastguard Worker; OPT: load i32 addrspace(1)*, i32 addrspace(1)* addrspace(3)* %{{[0-9]+}}, align 4
404*9880d681SAndroid Build Coastguard Workerdefine void @pointer_typed_alloca(i32 addrspace(1)* %A) {
405*9880d681SAndroid Build Coastguard Workerentry:
406*9880d681SAndroid Build Coastguard Worker  %A.addr = alloca i32 addrspace(1)*, align 4
407*9880d681SAndroid Build Coastguard Worker  store i32 addrspace(1)* %A, i32 addrspace(1)** %A.addr, align 4
408*9880d681SAndroid Build Coastguard Worker  %ld0 = load i32 addrspace(1)*, i32 addrspace(1)** %A.addr, align 4
409*9880d681SAndroid Build Coastguard Worker  %arrayidx = getelementptr inbounds i32, i32 addrspace(1)* %ld0, i32 0
410*9880d681SAndroid Build Coastguard Worker  store i32 1, i32 addrspace(1)* %arrayidx, align 4
411*9880d681SAndroid Build Coastguard Worker  %ld1 = load i32 addrspace(1)*, i32 addrspace(1)** %A.addr, align 4
412*9880d681SAndroid Build Coastguard Worker  %arrayidx1 = getelementptr inbounds i32, i32 addrspace(1)* %ld1, i32 1
413*9880d681SAndroid Build Coastguard Worker  store i32 2, i32 addrspace(1)* %arrayidx1, align 4
414*9880d681SAndroid Build Coastguard Worker  %ld2 = load i32 addrspace(1)*, i32 addrspace(1)** %A.addr, align 4
415*9880d681SAndroid Build Coastguard Worker  %arrayidx2 = getelementptr inbounds i32, i32 addrspace(1)* %ld2, i32 2
416*9880d681SAndroid Build Coastguard Worker  store i32 3, i32 addrspace(1)* %arrayidx2, align 4
417*9880d681SAndroid Build Coastguard Worker  ret void
418*9880d681SAndroid Build Coastguard Worker}
419*9880d681SAndroid Build Coastguard Worker
420*9880d681SAndroid Build Coastguard Worker; HSAOPT: !0 = !{}
421*9880d681SAndroid Build Coastguard Worker; HSAOPT: !1 = !{i32 0, i32 2048}
422*9880d681SAndroid Build Coastguard Worker
423*9880d681SAndroid Build Coastguard Worker; NOHSAOPT: !0 = !{i32 0, i32 2048}
424*9880d681SAndroid Build Coastguard Worker
425*9880d681SAndroid Build Coastguard Worker
426*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: v16i32_stack:
427*9880d681SAndroid Build Coastguard Worker
428*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
429*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
430*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
431*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
432*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
433*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
434*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
435*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
436*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
437*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
438*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
439*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
440*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
441*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
442*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
443*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
444*9880d681SAndroid Build Coastguard Worker
445*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
446*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
447*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
448*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
449*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
450*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
451*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
452*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
453*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
454*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
455*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
456*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
457*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
458*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
459*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
460*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
461*9880d681SAndroid Build Coastguard Worker
462*9880d681SAndroid Build Coastguard Workerdefine void @v16i32_stack(<16 x i32> addrspace(1)* %out, i32 %a) {
463*9880d681SAndroid Build Coastguard Worker  %alloca = alloca [2 x <16 x i32>]
464*9880d681SAndroid Build Coastguard Worker  %tmp0 = getelementptr [2 x <16 x i32>], [2 x <16 x i32>]* %alloca, i32 0, i32 %a
465*9880d681SAndroid Build Coastguard Worker  %tmp5 = load <16 x i32>, <16 x i32>* %tmp0
466*9880d681SAndroid Build Coastguard Worker  store <16 x i32> %tmp5, <16 x i32> addrspace(1)* %out
467*9880d681SAndroid Build Coastguard Worker  ret void
468*9880d681SAndroid Build Coastguard Worker}
469*9880d681SAndroid Build Coastguard Worker
470*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: v16float_stack:
471*9880d681SAndroid Build Coastguard Worker
472*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
473*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
474*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
475*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
476*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
477*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
478*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
479*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
480*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
481*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
482*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
483*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
484*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
485*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
486*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
487*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
488*9880d681SAndroid Build Coastguard Worker
489*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
490*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
491*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
492*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
493*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
494*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
495*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
496*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
497*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
498*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
499*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
500*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
501*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
502*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
503*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
504*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
505*9880d681SAndroid Build Coastguard Worker
506*9880d681SAndroid Build Coastguard Workerdefine void @v16float_stack(<16 x float> addrspace(1)* %out, i32 %a) {
507*9880d681SAndroid Build Coastguard Worker  %alloca = alloca [2 x <16 x float>]
508*9880d681SAndroid Build Coastguard Worker  %tmp0 = getelementptr [2 x <16 x float>], [2 x <16 x float>]* %alloca, i32 0, i32 %a
509*9880d681SAndroid Build Coastguard Worker  %tmp5 = load <16 x float>, <16 x float>* %tmp0
510*9880d681SAndroid Build Coastguard Worker  store <16 x float> %tmp5, <16 x float> addrspace(1)* %out
511*9880d681SAndroid Build Coastguard Worker  ret void
512*9880d681SAndroid Build Coastguard Worker}
513*9880d681SAndroid Build Coastguard Worker
514*9880d681SAndroid Build Coastguard Worker; FUNC-LABEL: v2float_stack:
515*9880d681SAndroid Build Coastguard Worker
516*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
517*9880d681SAndroid Build Coastguard Worker; R600: MOVA_INT
518*9880d681SAndroid Build Coastguard Worker
519*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
520*9880d681SAndroid Build Coastguard Worker; SI: buffer_load_dword
521*9880d681SAndroid Build Coastguard Worker
522*9880d681SAndroid Build Coastguard Workerdefine void @v2float_stack(<2 x float> addrspace(1)* %out, i32 %a) {
523*9880d681SAndroid Build Coastguard Worker  %alloca = alloca [16 x <2 x float>]
524*9880d681SAndroid Build Coastguard Worker  %tmp0 = getelementptr [16 x <2 x float>], [16 x <2 x float>]* %alloca, i32 0, i32 %a
525*9880d681SAndroid Build Coastguard Worker  %tmp5 = load <2 x float>, <2 x float>* %tmp0
526*9880d681SAndroid Build Coastguard Worker  store <2 x float> %tmp5, <2 x float> addrspace(1)* %out
527*9880d681SAndroid Build Coastguard Worker  ret void
528*9880d681SAndroid Build Coastguard Worker}
529*9880d681SAndroid Build Coastguard Worker
530*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind "amdgpu-max-waves-per-eu"="2" }
531