1 ; RUN: llc -march=amdgcn -mtriple=amdgcn-unknown-amdhsa -mattr=-code-object-v3 -mcpu=kaveri -verify-machineinstrs < %s | FileCheck -check-prefix=ALL -check-prefix=CO-V2 -check-prefix=CI-HSA %s
2 ; RUN: llc -march=amdgcn -mtriple=amdgcn-unknown-amdhsa -mattr=-code-object-v3 -mcpu=carrizo -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefix=ALL -check-prefix=CO-V2 -check-prefix=VI-HSA %s
3 ; RUN: llc -march=amdgcn -mcpu=tahiti -verify-machineinstrs < %s | FileCheck -check-prefix=ALL -check-prefix=MESA -check-prefix=SI-MESA %s
4 ; RUN: llc -march=amdgcn -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefix=ALL -check-prefix=MESA -check-prefix=VI-MESA %s
5 ; RUN: llc -mtriple=amdgcn-unknown-mesa3d -mattr=-code-object-v3 -mcpu=tahiti -verify-machineinstrs < %s | FileCheck -check-prefixes=ALL,CO-V2,SI-MESA %s
6 ; RUN: llc -mtriple=amdgcn-unknown-mesa3d -mattr=-code-object-v3 -mcpu=tonga -mattr=-flat-for-global -verify-machineinstrs < %s | FileCheck -check-prefixes=ALL,CO-V2,VI-MESA %s
8 declare i32 @llvm.amdgcn.workitem.id.x() #0
9 declare i32 @llvm.amdgcn.workitem.id.y() #0
10 declare i32 @llvm.amdgcn.workitem.id.z() #0
12 ; MESA: .section .AMDGPU.config
14 ; MESA-NEXT: .long 132{{$}}
16 ; ALL-LABEL {{^}}test_workitem_id_x:
17 ; CO-V2: enable_vgpr_workitem_id = 0
20 ; ALL: {{buffer|flat}}_store_dword {{.*}}v0
21 define amdgpu_kernel void @test_workitem_id_x(i32 addrspace(1)* %out) #1 {
22 %id = call i32 @llvm.amdgcn.workitem.id.x()
23 store i32 %id, i32 addrspace(1)* %out
27 ; MESA: .section .AMDGPU.config
29 ; MESA-NEXT: .long 2180{{$}}
31 ; ALL-LABEL {{^}}test_workitem_id_y:
32 ; CO-V2: enable_vgpr_workitem_id = 1
35 ; ALL: {{buffer|flat}}_store_dword {{.*}}v1
36 define amdgpu_kernel void @test_workitem_id_y(i32 addrspace(1)* %out) #1 {
37 %id = call i32 @llvm.amdgcn.workitem.id.y()
38 store i32 %id, i32 addrspace(1)* %out
42 ; MESA: .section .AMDGPU.config
44 ; MESA-NEXT: .long 4228{{$}}
46 ; ALL-LABEL {{^}}test_workitem_id_z:
47 ; CO-V2: enable_vgpr_workitem_id = 2
50 ; ALL: {{buffer|flat}}_store_dword {{.*}}v2
51 define amdgpu_kernel void @test_workitem_id_z(i32 addrspace(1)* %out) #1 {
52 %id = call i32 @llvm.amdgcn.workitem.id.z()
53 store i32 %id, i32 addrspace(1)* %out
57 attributes #0 = { nounwind readnone }
58 attributes #1 = { nounwind }