1
1
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2
- ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -mattr=+architected-sgprs --verify-machineinstrs < %s | FileCheck -check-prefix=GCN-SDAG %s
3
- ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -mattr=+architected-sgprs -global-isel --verify-machineinstrs < %s | FileCheck -check-prefix=GCN-GISEL %s
2
+ ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -mattr=+architected-sgprs -global-isel=0 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX9,GFX9-SDAG %s
3
+ ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -mattr=+architected-sgprs -global-isel=1 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX9,GFX9-GISEL %s
4
+ ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1200 -global-isel=0 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX12,GFX12-SDAG %s
5
+ ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx1200 -global-isel=1 -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX12,GFX12-GISEL %s
4
6
5
7
define amdgpu_kernel void @workgroup_id_x (ptr addrspace (1 ) %ptrx ) {
6
- ; GCN -SDAG-LABEL: workgroup_id_x:
7
- ; GCN -SDAG: ; %bb.0:
8
- ; GCN -SDAG-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
9
- ; GCN -SDAG-NEXT: v_mov_b32_e32 v0, 0
10
- ; GCN -SDAG-NEXT: v_mov_b32_e32 v1, ttmp9
11
- ; GCN -SDAG-NEXT: s_waitcnt lgkmcnt(0)
12
- ; GCN -SDAG-NEXT: global_store_dword v0, v1, s[0:1]
13
- ; GCN -SDAG-NEXT: s_endpgm
8
+ ; GFX9 -SDAG-LABEL: workgroup_id_x:
9
+ ; GFX9 -SDAG: ; %bb.0:
10
+ ; GFX9 -SDAG-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
11
+ ; GFX9 -SDAG-NEXT: v_mov_b32_e32 v0, 0
12
+ ; GFX9 -SDAG-NEXT: v_mov_b32_e32 v1, ttmp9
13
+ ; GFX9 -SDAG-NEXT: s_waitcnt lgkmcnt(0)
14
+ ; GFX9 -SDAG-NEXT: global_store_dword v0, v1, s[0:1]
15
+ ; GFX9 -SDAG-NEXT: s_endpgm
14
16
;
15
- ; GCN-GISEL-LABEL: workgroup_id_x:
16
- ; GCN-GISEL: ; %bb.0:
17
- ; GCN-GISEL-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
18
- ; GCN-GISEL-NEXT: v_mov_b32_e32 v0, ttmp9
19
- ; GCN-GISEL-NEXT: v_mov_b32_e32 v1, 0
20
- ; GCN-GISEL-NEXT: s_waitcnt lgkmcnt(0)
21
- ; GCN-GISEL-NEXT: global_store_dword v1, v0, s[0:1]
22
- ; GCN-GISEL-NEXT: s_endpgm
17
+ ; GFX9-GISEL-LABEL: workgroup_id_x:
18
+ ; GFX9-GISEL: ; %bb.0:
19
+ ; GFX9-GISEL-NEXT: s_load_dwordx2 s[0:1], s[4:5], 0x0
20
+ ; GFX9-GISEL-NEXT: v_mov_b32_e32 v0, ttmp9
21
+ ; GFX9-GISEL-NEXT: v_mov_b32_e32 v1, 0
22
+ ; GFX9-GISEL-NEXT: s_waitcnt lgkmcnt(0)
23
+ ; GFX9-GISEL-NEXT: global_store_dword v1, v0, s[0:1]
24
+ ; GFX9-GISEL-NEXT: s_endpgm
25
+ ;
26
+ ; GFX12-SDAG-LABEL: workgroup_id_x:
27
+ ; GFX12-SDAG: ; %bb.0:
28
+ ; GFX12-SDAG-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
29
+ ; GFX12-SDAG-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, ttmp9
30
+ ; GFX12-SDAG-NEXT: s_wait_kmcnt 0x0
31
+ ; GFX12-SDAG-NEXT: global_store_b32 v0, v1, s[0:1]
32
+ ; GFX12-SDAG-NEXT: s_nop 0
33
+ ; GFX12-SDAG-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
34
+ ; GFX12-SDAG-NEXT: s_endpgm
35
+ ;
36
+ ; GFX12-GISEL-LABEL: workgroup_id_x:
37
+ ; GFX12-GISEL: ; %bb.0:
38
+ ; GFX12-GISEL-NEXT: s_load_b64 s[0:1], s[0:1], 0x0
39
+ ; GFX12-GISEL-NEXT: v_dual_mov_b32 v0, ttmp9 :: v_dual_mov_b32 v1, 0
40
+ ; GFX12-GISEL-NEXT: s_wait_kmcnt 0x0
41
+ ; GFX12-GISEL-NEXT: global_store_b32 v1, v0, s[0:1]
42
+ ; GFX12-GISEL-NEXT: s_nop 0
43
+ ; GFX12-GISEL-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
44
+ ; GFX12-GISEL-NEXT: s_endpgm
23
45
%idx = call i32 @llvm.amdgcn.workgroup.id.x ()
24
46
store i32 %idx , ptr addrspace (1 ) %ptrx
25
47
26
48
ret void
27
49
}
28
50
29
51
define amdgpu_kernel void @workgroup_id_xy (ptr addrspace (1 ) %ptrx , ptr addrspace (1 ) %ptry ) {
30
- ; GCN-SDAG -LABEL: workgroup_id_xy:
31
- ; GCN-SDAG : ; %bb.0:
32
- ; GCN-SDAG -NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
33
- ; GCN-SDAG -NEXT: v_mov_b32_e32 v0, 0
34
- ; GCN-SDAG -NEXT: v_mov_b32_e32 v1, ttmp9
35
- ; GCN-SDAG -NEXT: s_waitcnt lgkmcnt(0)
36
- ; GCN-SDAG -NEXT: global_store_dword v0, v1, s[0:1]
37
- ; GCN-SDAG -NEXT: v_mov_b32_e32 v1, ttmp7
38
- ; GCN-SDAG -NEXT: global_store_dword v0, v1, s[2:3]
39
- ; GCN-SDAG -NEXT: s_endpgm
52
+ ; GFX9 -LABEL: workgroup_id_xy:
53
+ ; GFX9 : ; %bb.0:
54
+ ; GFX9 -NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
55
+ ; GFX9 -NEXT: v_mov_b32_e32 v0, 0
56
+ ; GFX9 -NEXT: v_mov_b32_e32 v1, ttmp9
57
+ ; GFX9 -NEXT: s_waitcnt lgkmcnt(0)
58
+ ; GFX9 -NEXT: global_store_dword v0, v1, s[0:1]
59
+ ; GFX9 -NEXT: v_mov_b32_e32 v1, ttmp7
60
+ ; GFX9 -NEXT: global_store_dword v0, v1, s[2:3]
61
+ ; GFX9 -NEXT: s_endpgm
40
62
;
41
- ; GCN-GISEL-LABEL: workgroup_id_xy:
42
- ; GCN-GISEL: ; %bb.0:
43
- ; GCN-GISEL-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
44
- ; GCN-GISEL-NEXT: v_mov_b32_e32 v0, 0
45
- ; GCN-GISEL-NEXT: v_mov_b32_e32 v1, ttmp9
46
- ; GCN-GISEL-NEXT: s_waitcnt lgkmcnt(0)
47
- ; GCN-GISEL-NEXT: global_store_dword v0, v1, s[0:1]
48
- ; GCN-GISEL-NEXT: v_mov_b32_e32 v1, ttmp7
49
- ; GCN-GISEL-NEXT: global_store_dword v0, v1, s[2:3]
50
- ; GCN-GISEL-NEXT: s_endpgm
63
+ ; GFX12-LABEL: workgroup_id_xy:
64
+ ; GFX12: ; %bb.0:
65
+ ; GFX12-NEXT: s_load_b128 s[0:3], s[0:1], 0x0
66
+ ; GFX12-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, ttmp9
67
+ ; GFX12-NEXT: v_mov_b32_e32 v2, ttmp7
68
+ ; GFX12-NEXT: s_wait_kmcnt 0x0
69
+ ; GFX12-NEXT: s_clause 0x1
70
+ ; GFX12-NEXT: global_store_b32 v0, v1, s[0:1]
71
+ ; GFX12-NEXT: global_store_b32 v0, v2, s[2:3]
72
+ ; GFX12-NEXT: s_nop 0
73
+ ; GFX12-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
74
+ ; GFX12-NEXT: s_endpgm
51
75
%idx = call i32 @llvm.amdgcn.workgroup.id.x ()
52
76
store i32 %idx , ptr addrspace (1 ) %ptrx
53
77
%idy = call i32 @llvm.amdgcn.workgroup.id.y ()
@@ -57,37 +81,56 @@ define amdgpu_kernel void @workgroup_id_xy(ptr addrspace(1) %ptrx, ptr addrspace
57
81
}
58
82
59
83
define amdgpu_kernel void @workgroup_id_xyz (ptr addrspace (1 ) %ptrx , ptr addrspace (1 ) %ptry , ptr addrspace (1 ) %ptrz ) {
60
- ; GCN-SDAG-LABEL: workgroup_id_xyz:
61
- ; GCN-SDAG: ; %bb.0:
62
- ; GCN-SDAG-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
63
- ; GCN-SDAG-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x10
64
- ; GCN-SDAG-NEXT: v_mov_b32_e32 v0, 0
65
- ; GCN-SDAG-NEXT: v_mov_b32_e32 v1, ttmp9
66
- ; GCN-SDAG-NEXT: s_waitcnt lgkmcnt(0)
67
- ; GCN-SDAG-NEXT: global_store_dword v0, v1, s[0:1]
68
- ; GCN-SDAG-NEXT: s_and_b32 s0, ttmp7, 0xffff
69
- ; GCN-SDAG-NEXT: v_mov_b32_e32 v1, s0
70
- ; GCN-SDAG-NEXT: s_lshr_b32 s0, ttmp7, 16
71
- ; GCN-SDAG-NEXT: global_store_dword v0, v1, s[2:3]
72
- ; GCN-SDAG-NEXT: v_mov_b32_e32 v1, s0
73
- ; GCN-SDAG-NEXT: global_store_dword v0, v1, s[6:7]
74
- ; GCN-SDAG-NEXT: s_endpgm
84
+ ; GFX9-SDAG-LABEL: workgroup_id_xyz:
85
+ ; GFX9-SDAG: ; %bb.0:
86
+ ; GFX9-SDAG-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
87
+ ; GFX9-SDAG-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x10
88
+ ; GFX9-SDAG-NEXT: v_mov_b32_e32 v0, 0
89
+ ; GFX9-SDAG-NEXT: v_mov_b32_e32 v1, ttmp9
90
+ ; GFX9-SDAG-NEXT: s_waitcnt lgkmcnt(0)
91
+ ; GFX9-SDAG-NEXT: global_store_dword v0, v1, s[0:1]
92
+ ; GFX9-SDAG-NEXT: s_and_b32 s0, ttmp7, 0xffff
93
+ ; GFX9-SDAG-NEXT: v_mov_b32_e32 v1, s0
94
+ ; GFX9-SDAG-NEXT: s_lshr_b32 s0, ttmp7, 16
95
+ ; GFX9-SDAG-NEXT: global_store_dword v0, v1, s[2:3]
96
+ ; GFX9-SDAG-NEXT: v_mov_b32_e32 v1, s0
97
+ ; GFX9-SDAG-NEXT: global_store_dword v0, v1, s[6:7]
98
+ ; GFX9-SDAG-NEXT: s_endpgm
99
+ ;
100
+ ; GFX9-GISEL-LABEL: workgroup_id_xyz:
101
+ ; GFX9-GISEL: ; %bb.0:
102
+ ; GFX9-GISEL-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
103
+ ; GFX9-GISEL-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x10
104
+ ; GFX9-GISEL-NEXT: v_mov_b32_e32 v0, ttmp9
105
+ ; GFX9-GISEL-NEXT: v_mov_b32_e32 v1, 0
106
+ ; GFX9-GISEL-NEXT: s_waitcnt lgkmcnt(0)
107
+ ; GFX9-GISEL-NEXT: global_store_dword v1, v0, s[0:1]
108
+ ; GFX9-GISEL-NEXT: s_and_b32 s0, ttmp7, 0xffff
109
+ ; GFX9-GISEL-NEXT: v_mov_b32_e32 v0, s0
110
+ ; GFX9-GISEL-NEXT: s_lshr_b32 s0, ttmp7, 16
111
+ ; GFX9-GISEL-NEXT: global_store_dword v1, v0, s[2:3]
112
+ ; GFX9-GISEL-NEXT: v_mov_b32_e32 v0, s0
113
+ ; GFX9-GISEL-NEXT: global_store_dword v1, v0, s[6:7]
114
+ ; GFX9-GISEL-NEXT: s_endpgm
75
115
;
76
- ; GCN-GISEL-LABEL: workgroup_id_xyz:
77
- ; GCN-GISEL: ; %bb.0:
78
- ; GCN-GISEL-NEXT: s_load_dwordx4 s[0:3], s[4:5], 0x0
79
- ; GCN-GISEL-NEXT: s_load_dwordx2 s[6:7], s[4:5], 0x10
80
- ; GCN-GISEL-NEXT: v_mov_b32_e32 v0, ttmp9
81
- ; GCN-GISEL-NEXT: v_mov_b32_e32 v1, 0
82
- ; GCN-GISEL-NEXT: s_waitcnt lgkmcnt(0)
83
- ; GCN-GISEL-NEXT: global_store_dword v1, v0, s[0:1]
84
- ; GCN-GISEL-NEXT: s_and_b32 s0, ttmp7, 0xffff
85
- ; GCN-GISEL-NEXT: v_mov_b32_e32 v0, s0
86
- ; GCN-GISEL-NEXT: s_lshr_b32 s0, ttmp7, 16
87
- ; GCN-GISEL-NEXT: global_store_dword v1, v0, s[2:3]
88
- ; GCN-GISEL-NEXT: v_mov_b32_e32 v0, s0
89
- ; GCN-GISEL-NEXT: global_store_dword v1, v0, s[6:7]
90
- ; GCN-GISEL-NEXT: s_endpgm
116
+ ; GFX12-LABEL: workgroup_id_xyz:
117
+ ; GFX12: ; %bb.0:
118
+ ; GFX12-NEXT: s_clause 0x1
119
+ ; GFX12-NEXT: s_load_b128 s[4:7], s[0:1], 0x0
120
+ ; GFX12-NEXT: s_load_b64 s[0:1], s[0:1], 0x10
121
+ ; GFX12-NEXT: s_and_b32 s2, ttmp7, 0xffff
122
+ ; GFX12-NEXT: v_dual_mov_b32 v0, 0 :: v_dual_mov_b32 v1, ttmp9
123
+ ; GFX12-NEXT: s_lshr_b32 s3, ttmp7, 16
124
+ ; GFX12-NEXT: s_delay_alu instid0(SALU_CYCLE_1)
125
+ ; GFX12-NEXT: v_dual_mov_b32 v2, s2 :: v_dual_mov_b32 v3, s3
126
+ ; GFX12-NEXT: s_wait_kmcnt 0x0
127
+ ; GFX12-NEXT: s_clause 0x2
128
+ ; GFX12-NEXT: global_store_b32 v0, v1, s[4:5]
129
+ ; GFX12-NEXT: global_store_b32 v0, v2, s[6:7]
130
+ ; GFX12-NEXT: global_store_b32 v0, v3, s[0:1]
131
+ ; GFX12-NEXT: s_nop 0
132
+ ; GFX12-NEXT: s_sendmsg sendmsg(MSG_DEALLOC_VGPRS)
133
+ ; GFX12-NEXT: s_endpgm
91
134
%idx = call i32 @llvm.amdgcn.workgroup.id.x ()
92
135
store i32 %idx , ptr addrspace (1 ) %ptrx
93
136
%idy = call i32 @llvm.amdgcn.workgroup.id.y ()
0 commit comments