xref: /aosp_15_r20/external/llvm/test/CodeGen/AMDGPU/split-vector-memoperand-offsets.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=amdgcn -mcpu=hawaii -verify-machineinstrs -mattr=-promote-alloca < %s | FileCheck -check-prefix=GCN %s
2*9880d681SAndroid Build Coastguard Worker; XFAIL: *
3*9880d681SAndroid Build Coastguard Worker
4*9880d681SAndroid Build Coastguard Worker@sPrivateStorage = external addrspace(3) global [256 x [8 x <4 x i64>]]
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Worker; GCN-LABEL: {{^}}ds_reorder_vector_split:
7*9880d681SAndroid Build Coastguard Worker
8*9880d681SAndroid Build Coastguard Worker; Write zeroinitializer
9*9880d681SAndroid Build Coastguard Worker; GCN-DAG: ds_write_b64 [[PTR:v[0-9]+]], [[VAL:v\[[0-9]+:[0-9]+\]]] offset:24
10*9880d681SAndroid Build Coastguard Worker; GCN-DAG: ds_write_b64 [[PTR]], [[VAL]] offset:16
11*9880d681SAndroid Build Coastguard Worker; GCN-DAG: ds_write_b64 [[PTR]], [[VAL]] offset:8
12*9880d681SAndroid Build Coastguard Worker; GCN-DAG: ds_write_b64 [[PTR]], [[VAL]]{{$}}
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Worker; GCN: s_waitcnt vmcnt
15*9880d681SAndroid Build Coastguard Worker
16*9880d681SAndroid Build Coastguard Worker; GCN-DAG: ds_write_b64 v{{[0-9]+}}, {{v\[[0-9]+:[0-9]+\]}} offset:24
17*9880d681SAndroid Build Coastguard Worker; GCN-DAG: ds_write_b64 v{{[0-9]+}}, {{v\[[0-9]+:[0-9]+\]}} offset:16
18*9880d681SAndroid Build Coastguard Worker; GCN-DAG: ds_write_b64 v{{[0-9]+}}, {{v\[[0-9]+:[0-9]+\]}} offset:8
19*9880d681SAndroid Build Coastguard Worker
20*9880d681SAndroid Build Coastguard Worker; GCN: s_waitcnt lgkmcnt
21*9880d681SAndroid Build Coastguard Worker
22*9880d681SAndroid Build Coastguard Worker; GCN-DAG ds_read_b64 {{v\[[0-9]+:[0-9]+\]}}, v{{[0-9]+}} offset:8
23*9880d681SAndroid Build Coastguard Worker; GCN-DAG: ds_read_b64 {{v\[[0-9]+:[0-9]+\]}}, v{{[0-9]+}} offset:16
24*9880d681SAndroid Build Coastguard Worker; GCN-DAG: ds_read_b64 {{v\[[0-9]+:[0-9]+\]}}, v{{[0-9]+}} offset:24
25*9880d681SAndroid Build Coastguard Worker
26*9880d681SAndroid Build Coastguard Worker; Appears to be dead store of vector component.
27*9880d681SAndroid Build Coastguard Worker; GCN: ds_write_b64 v{{[0-9]+}}, {{v\[[0-9]+:[0-9]+\]$}}
28*9880d681SAndroid Build Coastguard Worker
29*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dwordx2
30*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dwordx2
31*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dwordx2
32*9880d681SAndroid Build Coastguard Worker; GCN: buffer_store_dwordx2
33*9880d681SAndroid Build Coastguard Worker; GCN: s_endpgm
34*9880d681SAndroid Build Coastguard Workerdefine void @ds_reorder_vector_split(<4 x i64> addrspace(1)* nocapture readonly %srcValues, i32 addrspace(1)* nocapture readonly %offsets, <4 x i64> addrspace(1)* nocapture %destBuffer, i32 %alignmentOffset) #0 {
35*9880d681SAndroid Build Coastguard Workerentry:
36*9880d681SAndroid Build Coastguard Worker  %tmp = tail call i32 @llvm.r600.read.local.size.y()
37*9880d681SAndroid Build Coastguard Worker  %tmp1 = tail call i32 @llvm.r600.read.local.size.z()
38*9880d681SAndroid Build Coastguard Worker  %tmp2 = tail call i32 @llvm.amdgcn.workitem.id.x()
39*9880d681SAndroid Build Coastguard Worker  %tmp3 = tail call i32 @llvm.amdgcn.workitem.id.y()
40*9880d681SAndroid Build Coastguard Worker  %tmp4 = tail call i32 @llvm.amdgcn.workitem.id.z()
41*9880d681SAndroid Build Coastguard Worker  %tmp6 = mul i32 %tmp2, %tmp
42*9880d681SAndroid Build Coastguard Worker  %tmp10 = add i32 %tmp3, %tmp6
43*9880d681SAndroid Build Coastguard Worker  %tmp11 = mul i32 %tmp10, %tmp1
44*9880d681SAndroid Build Coastguard Worker  %tmp9 = add i32 %tmp11, %tmp4
45*9880d681SAndroid Build Coastguard Worker  %x.i.i = tail call i32 @llvm.amdgcn.workgroup.id.x() #1
46*9880d681SAndroid Build Coastguard Worker  %x.i.12.i = tail call i32 @llvm.r600.read.local.size.x() #1
47*9880d681SAndroid Build Coastguard Worker  %mul.26.i = mul i32 %x.i.12.i, %x.i.i
48*9880d681SAndroid Build Coastguard Worker  %add.i = add i32 %tmp2, %mul.26.i
49*9880d681SAndroid Build Coastguard Worker  %arrayidx = getelementptr [256 x [8 x <4 x i64>]], [256 x [8 x <4 x i64>]] addrspace(3)* @sPrivateStorage, i32 0, i32 %tmp9, i32 %add.i
50*9880d681SAndroid Build Coastguard Worker  store <4 x i64> zeroinitializer, <4 x i64> addrspace(3)* %arrayidx
51*9880d681SAndroid Build Coastguard Worker  %tmp12 = sext i32 %add.i to i64
52*9880d681SAndroid Build Coastguard Worker  %arrayidx1 = getelementptr inbounds <4 x i64>, <4 x i64> addrspace(1)* %srcValues, i64 %tmp12
53*9880d681SAndroid Build Coastguard Worker  %tmp13 = load <4 x i64>, <4 x i64> addrspace(1)* %arrayidx1
54*9880d681SAndroid Build Coastguard Worker  %arrayidx2 = getelementptr inbounds i32, i32 addrspace(1)* %offsets, i64 %tmp12
55*9880d681SAndroid Build Coastguard Worker  %tmp14 = load i32, i32 addrspace(1)* %arrayidx2
56*9880d681SAndroid Build Coastguard Worker  %add.ptr = getelementptr [256 x [8 x <4 x i64>]], [256 x [8 x <4 x i64>]] addrspace(3)* @sPrivateStorage, i32 0, i32 %tmp9, i32 0, i32 %alignmentOffset
57*9880d681SAndroid Build Coastguard Worker  %mul.i = shl i32 %tmp14, 2
58*9880d681SAndroid Build Coastguard Worker  %arrayidx.i = getelementptr inbounds i64, i64 addrspace(3)* %add.ptr, i32 %mul.i
59*9880d681SAndroid Build Coastguard Worker  %tmp15 = bitcast i64 addrspace(3)* %arrayidx.i to <4 x i64> addrspace(3)*
60*9880d681SAndroid Build Coastguard Worker  store <4 x i64> %tmp13, <4 x i64> addrspace(3)* %tmp15
61*9880d681SAndroid Build Coastguard Worker  %add.ptr6 = getelementptr [256 x [8 x <4 x i64>]], [256 x [8 x <4 x i64>]] addrspace(3)* @sPrivateStorage, i32 0, i32 %tmp9, i32 %tmp14, i32 %alignmentOffset
62*9880d681SAndroid Build Coastguard Worker  %tmp16 = sext i32 %tmp14 to i64
63*9880d681SAndroid Build Coastguard Worker  %tmp17 = sext i32 %alignmentOffset to i64
64*9880d681SAndroid Build Coastguard Worker  %add.ptr9 = getelementptr inbounds <4 x i64>, <4 x i64> addrspace(1)* %destBuffer, i64 %tmp16, i64 %tmp17
65*9880d681SAndroid Build Coastguard Worker  %tmp18 = bitcast <4 x i64> %tmp13 to i256
66*9880d681SAndroid Build Coastguard Worker  %trunc = trunc i256 %tmp18 to i64
67*9880d681SAndroid Build Coastguard Worker  store i64 %trunc, i64 addrspace(1)* %add.ptr9
68*9880d681SAndroid Build Coastguard Worker  %arrayidx10.1 = getelementptr inbounds i64, i64 addrspace(3)* %add.ptr6, i32 1
69*9880d681SAndroid Build Coastguard Worker  %tmp19 = load i64, i64 addrspace(3)* %arrayidx10.1
70*9880d681SAndroid Build Coastguard Worker  %arrayidx11.1 = getelementptr inbounds i64, i64 addrspace(1)* %add.ptr9, i64 1
71*9880d681SAndroid Build Coastguard Worker  store i64 %tmp19, i64 addrspace(1)* %arrayidx11.1
72*9880d681SAndroid Build Coastguard Worker  %arrayidx10.2 = getelementptr inbounds i64, i64 addrspace(3)* %add.ptr6, i32 2
73*9880d681SAndroid Build Coastguard Worker  %tmp20 = load i64, i64 addrspace(3)* %arrayidx10.2
74*9880d681SAndroid Build Coastguard Worker  %arrayidx11.2 = getelementptr inbounds i64, i64 addrspace(1)* %add.ptr9, i64 2
75*9880d681SAndroid Build Coastguard Worker  store i64 %tmp20, i64 addrspace(1)* %arrayidx11.2
76*9880d681SAndroid Build Coastguard Worker  %arrayidx10.3 = getelementptr inbounds i64, i64 addrspace(3)* %add.ptr6, i32 3
77*9880d681SAndroid Build Coastguard Worker  %tmp21 = load i64, i64 addrspace(3)* %arrayidx10.3
78*9880d681SAndroid Build Coastguard Worker  %arrayidx11.3 = getelementptr inbounds i64, i64 addrspace(1)* %add.ptr9, i64 3
79*9880d681SAndroid Build Coastguard Worker  store i64 %tmp21, i64 addrspace(1)* %arrayidx11.3
80*9880d681SAndroid Build Coastguard Worker  ret void
81*9880d681SAndroid Build Coastguard Worker}
82*9880d681SAndroid Build Coastguard Worker
83*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone
84*9880d681SAndroid Build Coastguard Workerdeclare i32 @llvm.amdgcn.workgroup.id.x() #1
85*9880d681SAndroid Build Coastguard Worker
86*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone
87*9880d681SAndroid Build Coastguard Workerdeclare i32 @llvm.r600.read.local.size.x() #1
88*9880d681SAndroid Build Coastguard Worker
89*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone
90*9880d681SAndroid Build Coastguard Workerdeclare i32 @llvm.amdgcn.workitem.id.x() #1
91*9880d681SAndroid Build Coastguard Worker
92*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone
93*9880d681SAndroid Build Coastguard Workerdeclare i32 @llvm.r600.read.local.size.y() #1
94*9880d681SAndroid Build Coastguard Worker
95*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone
96*9880d681SAndroid Build Coastguard Workerdeclare i32 @llvm.r600.read.local.size.z() #1
97*9880d681SAndroid Build Coastguard Worker
98*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone
99*9880d681SAndroid Build Coastguard Workerdeclare i32 @llvm.amdgcn.workitem.id.y() #1
100*9880d681SAndroid Build Coastguard Worker
101*9880d681SAndroid Build Coastguard Worker; Function Attrs: nounwind readnone
102*9880d681SAndroid Build Coastguard Workerdeclare i32 @llvm.amdgcn.workitem.id.z() #1
103*9880d681SAndroid Build Coastguard Worker
104*9880d681SAndroid Build Coastguard Workerattributes #0 = { norecurse nounwind }
105*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind readnone }
106