Skip to content

Commit 449e36c

Browse files
committed
[AMDGPU] Add a bit more gfx90a test coverage
Update the GlobalISel version of llvm.amdgcn.workitem.id.ll to mostly match the SelctionDAG version. Differential Revision: https://reviews.llvm.org/D97377
1 parent 35ab6d6 commit 449e36c

File tree

1 file changed

+20
-9
lines changed

1 file changed

+20
-9
lines changed

llvm/test/CodeGen/AMDGPU/GlobalISel/llvm.amdgcn.workitem.id.ll

Lines changed: 20 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
; RUN: llc -global-isel -mtriple=amdgcn-- -mcpu=tonga -mattr=+flat-for-global -verify-machineinstrs < %s | FileCheck --check-prefixes=ALL,MESA %s
55
; RUN: llc -global-isel -mtriple=amdgcn-unknown-mesa3d -mattr=+flat-for-global -mcpu=hawaii -verify-machineinstrs < %s | FileCheck -check-prefixes=ALL,CO-V2 %s
66
; RUN: llc -global-isel -mtriple=amdgcn-unknown-mesa3d -mcpu=tonga -verify-machineinstrs < %s | FileCheck -check-prefixes=ALL,CO-V2 %s
7+
; RUN: llc -global-isel -march=amdgcn -mtriple=amdgcn-unknown-amdhsa -mcpu=gfx90a -verify-machineinstrs < %s | FileCheck -check-prefixes=ALL,PACKED-TID %s
78

89
declare i32 @llvm.amdgcn.workitem.id.x() #0
910
declare i32 @llvm.amdgcn.workitem.id.y() #0
@@ -17,7 +18,9 @@ declare i32 @llvm.amdgcn.workitem.id.z() #0
1718
; CO-V2: enable_vgpr_workitem_id = 0
1819

1920
; ALL-NOT: v0
20-
; ALL: {{buffer|flat}}_store_dword {{.*}}v0
21+
; ALL: {{buffer|flat|global}}_store_dword {{.*}}v0
22+
23+
; PACKED-TID: .amdhsa_system_vgpr_workitem_id 0
2124
define amdgpu_kernel void @test_workitem_id_x(i32 addrspace(1)* %out) #1 {
2225
%id = call i32 @llvm.amdgcn.workitem.id.x()
2326
store i32 %id, i32 addrspace(1)* %out
@@ -30,9 +33,13 @@ define amdgpu_kernel void @test_workitem_id_x(i32 addrspace(1)* %out) #1 {
3033

3134
; ALL-LABEL: {{^}}test_workitem_id_y:
3235
; CO-V2: enable_vgpr_workitem_id = 1
36+
; CO-V2-NOT: v1
37+
; CO-V2: {{buffer|flat}}_store_dword {{.*}}v1
3338

34-
; ALL-NOT: v1
35-
; ALL: {{buffer|flat}}_store_dword {{.*}}v1
39+
; PACKED-TID: v_lshrrev_b32_e32 [[ID:v[0-9]+]], 10, v0
40+
; PACKED-TID: v_and_b32_e32 [[ID]], 0x3ff, [[ID]]
41+
; PACKED-TID: {{buffer|flat|global}}_store_dword {{.*}}[[ID]]
42+
; PACKED-TID: .amdhsa_system_vgpr_workitem_id 1
3643
define amdgpu_kernel void @test_workitem_id_y(i32 addrspace(1)* %out) #1 {
3744
%id = call i32 @llvm.amdgcn.workitem.id.y()
3845
store i32 %id, i32 addrspace(1)* %out
@@ -45,9 +52,13 @@ define amdgpu_kernel void @test_workitem_id_y(i32 addrspace(1)* %out) #1 {
4552

4653
; ALL-LABEL: {{^}}test_workitem_id_z:
4754
; CO-V2: enable_vgpr_workitem_id = 2
55+
; CO-V2-NOT: v2
56+
; CO-V2: {{buffer|flat}}_store_dword {{.*}}v2
4857

49-
; ALL-NOT: v2
50-
; ALL: {{buffer|flat}}_store_dword {{.*}}v2
58+
; PACKED-TID: v_lshrrev_b32_e32 [[ID:v[0-9]+]], 20, v0
59+
; PACKED-TID: v_and_b32_e32 [[ID]], 0x3ff, [[ID]]
60+
; PACKED-TID: {{buffer|flat|global}}_store_dword {{.*}}[[ID]]
61+
; PACKED-TID: .amdhsa_system_vgpr_workitem_id 2
5162
define amdgpu_kernel void @test_workitem_id_z(i32 addrspace(1)* %out) #1 {
5263
%id = call i32 @llvm.amdgcn.workitem.id.z()
5364
store i32 %id, i32 addrspace(1)* %out
@@ -56,9 +67,9 @@ define amdgpu_kernel void @test_workitem_id_z(i32 addrspace(1)* %out) #1 {
5667

5768
; ALL-LABEL: {{^}}test_workitem_id_x_usex2:
5869
; ALL-NOT: v0
59-
; ALL: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, v0
70+
; ALL: {{flat|global}}_store_dword v{{.*}}, v0
6071
; ALL-NOT: v0
61-
; ALL: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, v0
72+
; ALL: {{flat|global}}_store_dword v{{.*}}, v0
6273
define amdgpu_kernel void @test_workitem_id_x_usex2(i32 addrspace(1)* %out) #1 {
6374
%id0 = call i32 @llvm.amdgcn.workitem.id.x()
6475
store volatile i32 %id0, i32 addrspace(1)* %out
@@ -70,9 +81,9 @@ define amdgpu_kernel void @test_workitem_id_x_usex2(i32 addrspace(1)* %out) #1 {
7081

7182
; ALL-LABEL: {{^}}test_workitem_id_x_use_outside_entry:
7283
; ALL-NOT: v0
73-
; ALL: flat_store_dword
84+
; ALL: {{flat|global}}_store_dword
7485
; ALL-NOT: v0
75-
; ALL: flat_store_dword v{{\[[0-9]+:[0-9]+\]}}, v0
86+
; ALL: {{flat|global}}_store_dword v{{.*}}, v0
7687
define amdgpu_kernel void @test_workitem_id_x_use_outside_entry(i32 addrspace(1)* %out, i32 %arg) #1 {
7788
bb0:
7889
store volatile i32 0, i32 addrspace(1)* %out

0 commit comments

Comments
 (0)