xref: /aosp_15_r20/external/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.workitem.id.ll (revision 9880d6810fe72a1726cb53787c6711e909410d58)
1*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=amdgcn -mtriple=amdgcn-unknown-amdhsa -mcpu=kaveri -verify-machineinstrs < %s | FileCheck -check-prefix=ALL -check-prefix=HSA -check-prefix=CI-HSA  %s
2*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=amdgcn -mtriple=amdgcn-unknown-amdhsa -mcpu=carrizo -verify-machineinstrs < %s | FileCheck -check-prefix=ALL -check-prefix=HSA -check-prefix=VI-HSA  %s
3*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=amdgcn -mcpu=tahiti -verify-machineinstrs < %s | FileCheck -check-prefix=ALL -check-prefix=MESA -check-prefix=SI-MESA %s
4*9880d681SAndroid Build Coastguard Worker; RUN: llc -march=amdgcn -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefix=ALL -check-prefix=MESA -check-prefix=VI-MESA %s
5*9880d681SAndroid Build Coastguard Worker
6*9880d681SAndroid Build Coastguard Workerdeclare i32 @llvm.amdgcn.workitem.id.x() #0
7*9880d681SAndroid Build Coastguard Workerdeclare i32 @llvm.amdgcn.workitem.id.y() #0
8*9880d681SAndroid Build Coastguard Workerdeclare i32 @llvm.amdgcn.workitem.id.z() #0
9*9880d681SAndroid Build Coastguard Worker
10*9880d681SAndroid Build Coastguard Worker; MESA: .section .AMDGPU.config
11*9880d681SAndroid Build Coastguard Worker; MESA: .long 47180
12*9880d681SAndroid Build Coastguard Worker; MESA-NEXT: .long 132{{$}}
13*9880d681SAndroid Build Coastguard Worker
14*9880d681SAndroid Build Coastguard Worker; ALL-LABEL {{^}}test_workitem_id_x:
15*9880d681SAndroid Build Coastguard Worker; HSA: compute_pgm_rsrc2_tidig_comp_cnt = 0
16*9880d681SAndroid Build Coastguard Worker
17*9880d681SAndroid Build Coastguard Worker; ALL-NOT: v0
18*9880d681SAndroid Build Coastguard Worker; ALL: {{buffer|flat}}_store_dword {{.*}}v0
19*9880d681SAndroid Build Coastguard Workerdefine void @test_workitem_id_x(i32 addrspace(1)* %out) #1 {
20*9880d681SAndroid Build Coastguard Worker  %id = call i32 @llvm.amdgcn.workitem.id.x()
21*9880d681SAndroid Build Coastguard Worker  store i32 %id, i32 addrspace(1)* %out
22*9880d681SAndroid Build Coastguard Worker  ret void
23*9880d681SAndroid Build Coastguard Worker}
24*9880d681SAndroid Build Coastguard Worker
25*9880d681SAndroid Build Coastguard Worker; MESA: .section .AMDGPU.config
26*9880d681SAndroid Build Coastguard Worker; MESA: .long 47180
27*9880d681SAndroid Build Coastguard Worker; MESA-NEXT: .long 2180{{$}}
28*9880d681SAndroid Build Coastguard Worker
29*9880d681SAndroid Build Coastguard Worker; ALL-LABEL {{^}}test_workitem_id_y:
30*9880d681SAndroid Build Coastguard Worker; HSA: compute_pgm_rsrc2_tidig_comp_cnt = 1
31*9880d681SAndroid Build Coastguard Worker
32*9880d681SAndroid Build Coastguard Worker; ALL-NOT: v1
33*9880d681SAndroid Build Coastguard Worker; ALL: {{buffer|flat}}_store_dword {{.*}}v1
34*9880d681SAndroid Build Coastguard Workerdefine void @test_workitem_id_y(i32 addrspace(1)* %out) #1 {
35*9880d681SAndroid Build Coastguard Worker  %id = call i32 @llvm.amdgcn.workitem.id.y()
36*9880d681SAndroid Build Coastguard Worker  store i32 %id, i32 addrspace(1)* %out
37*9880d681SAndroid Build Coastguard Worker  ret void
38*9880d681SAndroid Build Coastguard Worker}
39*9880d681SAndroid Build Coastguard Worker
40*9880d681SAndroid Build Coastguard Worker; MESA: .section .AMDGPU.config
41*9880d681SAndroid Build Coastguard Worker; MESA: .long 47180
42*9880d681SAndroid Build Coastguard Worker; MESA-NEXT: .long 4228{{$}}
43*9880d681SAndroid Build Coastguard Worker
44*9880d681SAndroid Build Coastguard Worker; ALL-LABEL {{^}}test_workitem_id_z:
45*9880d681SAndroid Build Coastguard Worker; HSA: compute_pgm_rsrc2_tidig_comp_cnt = 2
46*9880d681SAndroid Build Coastguard Worker
47*9880d681SAndroid Build Coastguard Worker; ALL-NOT: v2
48*9880d681SAndroid Build Coastguard Worker; ALL: {{buffer|flat}}_store_dword {{.*}}v2
49*9880d681SAndroid Build Coastguard Workerdefine void @test_workitem_id_z(i32 addrspace(1)* %out) #1 {
50*9880d681SAndroid Build Coastguard Worker  %id = call i32 @llvm.amdgcn.workitem.id.z()
51*9880d681SAndroid Build Coastguard Worker  store i32 %id, i32 addrspace(1)* %out
52*9880d681SAndroid Build Coastguard Worker  ret void
53*9880d681SAndroid Build Coastguard Worker}
54*9880d681SAndroid Build Coastguard Worker
55*9880d681SAndroid Build Coastguard Workerattributes #0 = { nounwind readnone }
56*9880d681SAndroid Build Coastguard Workerattributes #1 = { nounwind }
57