annotate test/CodeGen/AMDGPU/mad24-get-global-id.ll @ 128:c347d3398279 default tip

fix
author mir3636
date Wed, 06 Dec 2017 14:37:17 +0900
parents 803732b1fca8
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
120
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
1 ; RUN: llc -mtriple=amdgcn--amdhsa -verify-machineinstrs < %s | FileCheck -check-prefix=GCN %s
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
2
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
3 ; If the workgroup id range is restricted, we should be able to use
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
4 ; mad24 for the usual indexing pattern.
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
5
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
6 declare i32 @llvm.amdgcn.workgroup.id.x() #0
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
7 declare i32 @llvm.amdgcn.workitem.id.x() #0
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
8 declare i8 addrspace(2)* @llvm.amdgcn.dispatch.ptr() #0
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
9
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
10 ; GCN-LABEL: {{^}}get_global_id_0:
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
11 ; GCN: s_and_b32 [[WGSIZEX:s[0-9]+]], {{s[0-9]+}}, 0xffff
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
12 ; GCN: v_mov_b32_e32 [[VWGSIZEX:v[0-9]+]], [[WGSIZEX]]
121
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
13 ; GCN: v_mad_u32_u24 v{{[0-9]+}}, s8, [[VWGSIZEX]], v0
803732b1fca8 LLVM 5.0
kono
parents: 120
diff changeset
14 define amdgpu_kernel void @get_global_id_0(i32 addrspace(1)* %out) #1 {
120
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
15 %dispatch.ptr = call i8 addrspace(2)* @llvm.amdgcn.dispatch.ptr()
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
16 %cast.dispatch.ptr = bitcast i8 addrspace(2)* %dispatch.ptr to i32 addrspace(2)*
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
17 %gep = getelementptr inbounds i32, i32 addrspace(2)* %cast.dispatch.ptr, i64 1
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
18 %workgroup.size.xy = load i32, i32 addrspace(2)* %gep, align 4, !invariant.load !0
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
19 %workgroup.size.x = and i32 %workgroup.size.xy, 65535
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
20
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
21 %workitem.id.x = call i32 @llvm.amdgcn.workitem.id.x(), !range !1
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
22 %workgroup.id.x = call i32 @llvm.amdgcn.workgroup.id.x(), !range !2
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
23
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
24 %mul = mul i32 %workgroup.id.x, %workgroup.size.x
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
25 %add = add i32 %mul, %workitem.id.x
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
26
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
27 store i32 %add, i32 addrspace(1)* %out, align 4
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
28 ret void
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
29 }
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
30
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
31 attributes #0 = { nounwind readnone }
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
32 attributes #1 = { nounwind }
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
33
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
34 !0 = !{}
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
35 !1 = !{i32 0, i32 1024}
1172e4bd9c6f update 4.0.0
mir3636
parents:
diff changeset
36 !2 = !{i32 0, i32 16777216}