aboutsummaryrefslogtreecommitdiff
path: root/llvm/test/CodeGen/AMDGPU/llvm.amdgcn.struct.buffer.load.format.v3f16.ll
blob: 74d5274f22e053a0e794c70e4656e4b5f298cd1f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
; RUN: llc -mcpu=gfx1010 -mtriple=amdgcn-- -verify-machineinstrs < %s | FileCheck -check-prefix=GFX10 %s
; RUN: llc -mcpu=gfx900 -mtriple=amdgcn-- -verify-machineinstrs < %s | FileCheck -check-prefix=GFX9 %s
; RUN: llc -mcpu=gfx810 -mtriple=amdgcn-- -verify-machineinstrs < %s | FileCheck -check-prefix=GFX8 %s
; RUN: llc -mcpu=gfx1100 -mattr=+real-true16 -mtriple=amdgcn-- -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX11,GFX11-TRUE16 %s
; RUN: llc -mcpu=gfx1100 -mattr=-real-true16 -mtriple=amdgcn-- -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX11,GFX11-FAKE16 %s
; RUN: llc -mcpu=gfx1200 -mattr=+real-true16 -mtriple=amdgcn-- -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX12,GFX12-TRUE16 %s
; RUN: llc -mcpu=gfx1200 -mattr=-real-true16 -mtriple=amdgcn-- -verify-machineinstrs < %s | FileCheck -check-prefixes=GFX12,GFX12-FAKE16 %s

@esgs_ring = external addrspace(3) global [0 x i32], align 65536

define amdgpu_gs void @main(<4 x i32> %arg, i32 %arg1) {
; GFX10-LABEL: main:
; GFX10:       ; %bb.0: ; %bb
; GFX10-NEXT:    s_mov_b32 s1, exec_lo
; GFX10-NEXT:  .LBB0_1: ; =>This Inner Loop Header: Depth=1
; GFX10-NEXT:    v_readfirstlane_b32 s4, v0
; GFX10-NEXT:    v_readfirstlane_b32 s5, v1
; GFX10-NEXT:    v_readfirstlane_b32 s6, v2
; GFX10-NEXT:    v_readfirstlane_b32 s7, v3
; GFX10-NEXT:    v_cmp_eq_u64_e32 vcc_lo, s[4:5], v[0:1]
; GFX10-NEXT:    v_cmp_eq_u64_e64 s0, s[6:7], v[2:3]
; GFX10-NEXT:    s_and_b32 s0, vcc_lo, s0
; GFX10-NEXT:    s_and_saveexec_b32 s0, s0
; GFX10-NEXT:    buffer_load_format_d16_xyz v[5:6], v4, s[4:7], 0 idxen
; GFX10-NEXT:    ; implicit-def: $vgpr0_vgpr1_vgpr2_vgpr3
; GFX10-NEXT:    ; implicit-def: $vgpr4
; GFX10-NEXT:    s_waitcnt_depctr 0xffe3
; GFX10-NEXT:    s_xor_b32 exec_lo, exec_lo, s0
; GFX10-NEXT:    s_cbranch_execnz .LBB0_1
; GFX10-NEXT:  ; %bb.2:
; GFX10-NEXT:    s_mov_b32 exec_lo, s1
; GFX10-NEXT:    s_waitcnt vmcnt(0)
; GFX10-NEXT:    v_lshrrev_b32_e32 v0, 16, v5
; GFX10-NEXT:    v_and_b32_e32 v1, 0xffff, v6
; GFX10-NEXT:    v_mov_b32_e32 v2, 0
; GFX10-NEXT:    s_waitcnt_vscnt null, 0x0
; GFX10-NEXT:    ds_write2_b32 v2, v0, v1 offset0:7 offset1:8
;
; GFX9-LABEL: main:
; GFX9:       ; %bb.0: ; %bb
; GFX9-NEXT:    s_mov_b64 s[2:3], exec
; GFX9-NEXT:  .LBB0_1: ; =>This Inner Loop Header: Depth=1
; GFX9-NEXT:    v_readfirstlane_b32 s4, v0
; GFX9-NEXT:    v_readfirstlane_b32 s5, v1
; GFX9-NEXT:    v_readfirstlane_b32 s6, v2
; GFX9-NEXT:    v_readfirstlane_b32 s7, v3
; GFX9-NEXT:    v_cmp_eq_u64_e32 vcc, s[4:5], v[0:1]
; GFX9-NEXT:    v_cmp_eq_u64_e64 s[0:1], s[6:7], v[2:3]
; GFX9-NEXT:    s_and_b64 s[0:1], vcc, s[0:1]
; GFX9-NEXT:    s_and_saveexec_b64 s[0:1], s[0:1]
; GFX9-NEXT:    s_nop 0
; GFX9-NEXT:    buffer_load_format_d16_xyz v[5:6], v4, s[4:7], 0 idxen
; GFX9-NEXT:    ; implicit-def: $vgpr0_vgpr1_vgpr2_vgpr3
; GFX9-NEXT:    ; implicit-def: $vgpr4
; GFX9-NEXT:    s_xor_b64 exec, exec, s[0:1]
; GFX9-NEXT:    s_cbranch_execnz .LBB0_1
; GFX9-NEXT:  ; %bb.2:
; GFX9-NEXT:    s_mov_b64 exec, s[2:3]
; GFX9-NEXT:    s_waitcnt vmcnt(0)
; GFX9-NEXT:    v_lshrrev_b32_e32 v0, 16, v5
; GFX9-NEXT:    v_and_b32_e32 v1, 0xffff, v6
; GFX9-NEXT:    v_mov_b32_e32 v2, 0
; GFX9-NEXT:    ds_write2_b32 v2, v0, v1 offset0:7 offset1:8
;
; GFX8-LABEL: main:
; GFX8:       ; %bb.0: ; %bb
; GFX8-NEXT:    s_mov_b64 s[2:3], exec
; GFX8-NEXT:  .LBB0_1: ; =>This Inner Loop Header: Depth=1
; GFX8-NEXT:    v_readfirstlane_b32 s4, v0
; GFX8-NEXT:    v_readfirstlane_b32 s5, v1
; GFX8-NEXT:    v_readfirstlane_b32 s6, v2
; GFX8-NEXT:    v_readfirstlane_b32 s7, v3
; GFX8-NEXT:    v_cmp_eq_u64_e32 vcc, s[4:5], v[0:1]
; GFX8-NEXT:    v_cmp_eq_u64_e64 s[0:1], s[6:7], v[2:3]
; GFX8-NEXT:    s_and_b64 s[0:1], vcc, s[0:1]
; GFX8-NEXT:    s_and_saveexec_b64 s[0:1], s[0:1]
; GFX8-NEXT:    s_nop 0
; GFX8-NEXT:    buffer_load_format_d16_xyz v[5:6], v4, s[4:7], 0 idxen
; GFX8-NEXT:    ; implicit-def: $vgpr0_vgpr1_vgpr2_vgpr3
; GFX8-NEXT:    ; implicit-def: $vgpr4
; GFX8-NEXT:    s_xor_b64 exec, exec, s[0:1]
; GFX8-NEXT:    s_cbranch_execnz .LBB0_1
; GFX8-NEXT:  ; %bb.2:
; GFX8-NEXT:    s_mov_b64 exec, s[2:3]
; GFX8-NEXT:    s_waitcnt vmcnt(0)
; GFX8-NEXT:    v_lshrrev_b32_e32 v0, 16, v5
; GFX8-NEXT:    v_and_b32_e32 v1, 0xffff, v6
; GFX8-NEXT:    v_mov_b32_e32 v2, 0
; GFX8-NEXT:    s_mov_b32 m0, -1
; GFX8-NEXT:    ds_write2_b32 v2, v0, v1 offset0:7 offset1:8
;
; GFX11-TRUE16-LABEL: main:
; GFX11-TRUE16:       ; %bb.0: ; %bb
; GFX11-TRUE16-NEXT:    s_mov_b32 s1, exec_lo
; GFX11-TRUE16-NEXT:  .LBB0_1: ; =>This Inner Loop Header: Depth=1
; GFX11-TRUE16-NEXT:    v_readfirstlane_b32 s4, v0
; GFX11-TRUE16-NEXT:    v_readfirstlane_b32 s5, v1
; GFX11-TRUE16-NEXT:    v_readfirstlane_b32 s6, v2
; GFX11-TRUE16-NEXT:    v_readfirstlane_b32 s7, v3
; GFX11-TRUE16-NEXT:    s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
; GFX11-TRUE16-NEXT:    v_cmp_eq_u64_e32 vcc_lo, s[4:5], v[0:1]
; GFX11-TRUE16-NEXT:    v_cmp_eq_u64_e64 s0, s[6:7], v[2:3]
; GFX11-TRUE16-NEXT:    s_and_b32 s0, vcc_lo, s0
; GFX11-TRUE16-NEXT:    s_delay_alu instid0(SALU_CYCLE_1)
; GFX11-TRUE16-NEXT:    s_and_saveexec_b32 s0, s0
; GFX11-TRUE16-NEXT:    buffer_load_d16_format_xyz v[5:6], v4, s[4:7], 0 idxen
; GFX11-TRUE16-NEXT:    ; implicit-def: $vgpr0_vgpr1_vgpr2_vgpr3
; GFX11-TRUE16-NEXT:    ; implicit-def: $vgpr4
; GFX11-TRUE16-NEXT:    s_xor_b32 exec_lo, exec_lo, s0
; GFX11-TRUE16-NEXT:    s_cbranch_execnz .LBB0_1
; GFX11-TRUE16-NEXT:  ; %bb.2:
; GFX11-TRUE16-NEXT:    s_mov_b32 exec_lo, s1
; GFX11-TRUE16-NEXT:    v_mov_b16_e32 v0.h, 0
; GFX11-TRUE16-NEXT:    s_waitcnt vmcnt(0)
; GFX11-TRUE16-NEXT:    v_mov_b16_e32 v0.l, v5.h
; GFX11-TRUE16-NEXT:    v_dual_mov_b32 v2, 0 :: v_dual_and_b32 v1, 0xffff, v6
; GFX11-TRUE16-NEXT:    ds_store_2addr_b32 v2, v0, v1 offset0:7 offset1:8
;
; GFX11-FAKE16-LABEL: main:
; GFX11-FAKE16:       ; %bb.0: ; %bb
; GFX11-FAKE16-NEXT:    s_mov_b32 s1, exec_lo
; GFX11-FAKE16-NEXT:  .LBB0_1: ; =>This Inner Loop Header: Depth=1
; GFX11-FAKE16-NEXT:    v_readfirstlane_b32 s4, v0
; GFX11-FAKE16-NEXT:    v_readfirstlane_b32 s5, v1
; GFX11-FAKE16-NEXT:    v_readfirstlane_b32 s6, v2
; GFX11-FAKE16-NEXT:    v_readfirstlane_b32 s7, v3
; GFX11-FAKE16-NEXT:    s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
; GFX11-FAKE16-NEXT:    v_cmp_eq_u64_e32 vcc_lo, s[4:5], v[0:1]
; GFX11-FAKE16-NEXT:    v_cmp_eq_u64_e64 s0, s[6:7], v[2:3]
; GFX11-FAKE16-NEXT:    s_and_b32 s0, vcc_lo, s0
; GFX11-FAKE16-NEXT:    s_delay_alu instid0(SALU_CYCLE_1)
; GFX11-FAKE16-NEXT:    s_and_saveexec_b32 s0, s0
; GFX11-FAKE16-NEXT:    buffer_load_d16_format_xyz v[5:6], v4, s[4:7], 0 idxen
; GFX11-FAKE16-NEXT:    ; implicit-def: $vgpr0_vgpr1_vgpr2_vgpr3
; GFX11-FAKE16-NEXT:    ; implicit-def: $vgpr4
; GFX11-FAKE16-NEXT:    s_xor_b32 exec_lo, exec_lo, s0
; GFX11-FAKE16-NEXT:    s_cbranch_execnz .LBB0_1
; GFX11-FAKE16-NEXT:  ; %bb.2:
; GFX11-FAKE16-NEXT:    s_mov_b32 exec_lo, s1
; GFX11-FAKE16-NEXT:    s_waitcnt vmcnt(0)
; GFX11-FAKE16-NEXT:    v_lshrrev_b32_e32 v0, 16, v5
; GFX11-FAKE16-NEXT:    v_dual_mov_b32 v2, 0 :: v_dual_and_b32 v1, 0xffff, v6
; GFX11-FAKE16-NEXT:    ds_store_2addr_b32 v2, v0, v1 offset0:7 offset1:8
;
; GFX12-TRUE16-LABEL: main:
; GFX12-TRUE16:       ; %bb.0: ; %bb
; GFX12-TRUE16-NEXT:    s_mov_b32 s1, exec_lo
; GFX12-TRUE16-NEXT:  .LBB0_1: ; =>This Inner Loop Header: Depth=1
; GFX12-TRUE16-NEXT:    v_readfirstlane_b32 s4, v0
; GFX12-TRUE16-NEXT:    v_readfirstlane_b32 s5, v1
; GFX12-TRUE16-NEXT:    v_readfirstlane_b32 s6, v2
; GFX12-TRUE16-NEXT:    v_readfirstlane_b32 s7, v3
; GFX12-TRUE16-NEXT:    s_wait_alu 0xf1ff
; GFX12-TRUE16-NEXT:    s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
; GFX12-TRUE16-NEXT:    v_cmp_eq_u64_e32 vcc_lo, s[4:5], v[0:1]
; GFX12-TRUE16-NEXT:    v_cmp_eq_u64_e64 s0, s[6:7], v[2:3]
; GFX12-TRUE16-NEXT:    s_and_b32 s0, vcc_lo, s0
; GFX12-TRUE16-NEXT:    s_delay_alu instid0(SALU_CYCLE_1)
; GFX12-TRUE16-NEXT:    s_and_saveexec_b32 s0, s0
; GFX12-TRUE16-NEXT:    s_wait_loadcnt 0x0
; GFX12-TRUE16-NEXT:    buffer_load_d16_format_xyz v[5:6], v4, s[4:7], null idxen
; GFX12-TRUE16-NEXT:    ; implicit-def: $vgpr0_vgpr1_vgpr2_vgpr3
; GFX12-TRUE16-NEXT:    ; implicit-def: $vgpr4
; GFX12-TRUE16-NEXT:    s_xor_b32 exec_lo, exec_lo, s0
; GFX12-TRUE16-NEXT:    s_cbranch_execnz .LBB0_1
; GFX12-TRUE16-NEXT:  ; %bb.2:
; GFX12-TRUE16-NEXT:    s_mov_b32 exec_lo, s1
; GFX12-TRUE16-NEXT:    v_mov_b16_e32 v0.h, 0
; GFX12-TRUE16-NEXT:    s_wait_loadcnt 0x0
; GFX12-TRUE16-NEXT:    v_mov_b16_e32 v0.l, v5.h
; GFX12-TRUE16-NEXT:    v_dual_mov_b32 v2, 0 :: v_dual_and_b32 v1, 0xffff, v6
; GFX12-TRUE16-NEXT:    ds_store_2addr_b32 v2, v0, v1 offset0:7 offset1:8
;
; GFX12-FAKE16-LABEL: main:
; GFX12-FAKE16:       ; %bb.0: ; %bb
; GFX12-FAKE16-NEXT:    s_mov_b32 s1, exec_lo
; GFX12-FAKE16-NEXT:  .LBB0_1: ; =>This Inner Loop Header: Depth=1
; GFX12-FAKE16-NEXT:    v_readfirstlane_b32 s4, v0
; GFX12-FAKE16-NEXT:    v_readfirstlane_b32 s5, v1
; GFX12-FAKE16-NEXT:    v_readfirstlane_b32 s6, v2
; GFX12-FAKE16-NEXT:    v_readfirstlane_b32 s7, v3
; GFX12-FAKE16-NEXT:    s_wait_alu 0xf1ff
; GFX12-FAKE16-NEXT:    s_delay_alu instid0(VALU_DEP_3) | instskip(NEXT) | instid1(VALU_DEP_2)
; GFX12-FAKE16-NEXT:    v_cmp_eq_u64_e32 vcc_lo, s[4:5], v[0:1]
; GFX12-FAKE16-NEXT:    v_cmp_eq_u64_e64 s0, s[6:7], v[2:3]
; GFX12-FAKE16-NEXT:    s_and_b32 s0, vcc_lo, s0
; GFX12-FAKE16-NEXT:    s_delay_alu instid0(SALU_CYCLE_1)
; GFX12-FAKE16-NEXT:    s_and_saveexec_b32 s0, s0
; GFX12-FAKE16-NEXT:    s_wait_loadcnt 0x0
; GFX12-FAKE16-NEXT:    buffer_load_d16_format_xyz v[5:6], v4, s[4:7], null idxen
; GFX12-FAKE16-NEXT:    ; implicit-def: $vgpr0_vgpr1_vgpr2_vgpr3
; GFX12-FAKE16-NEXT:    ; implicit-def: $vgpr4
; GFX12-FAKE16-NEXT:    s_xor_b32 exec_lo, exec_lo, s0
; GFX12-FAKE16-NEXT:    s_cbranch_execnz .LBB0_1
; GFX12-FAKE16-NEXT:  ; %bb.2:
; GFX12-FAKE16-NEXT:    s_mov_b32 exec_lo, s1
; GFX12-FAKE16-NEXT:    s_wait_loadcnt 0x0
; GFX12-FAKE16-NEXT:    v_lshrrev_b32_e32 v0, 16, v5
; GFX12-FAKE16-NEXT:    v_dual_mov_b32 v2, 0 :: v_dual_and_b32 v1, 0xffff, v6
; GFX12-FAKE16-NEXT:    ds_store_2addr_b32 v2, v0, v1 offset0:7 offset1:8
bb:
  %i = call i32 @llvm.amdgcn.mbcnt.hi(i32 -1, i32 poison)
  %i2 = call nsz arcp <3 x half> @llvm.amdgcn.struct.buffer.load.format.v3f16(<4 x i32> %arg, i32 %arg1, i32 0, i32 0, i32 0)
  %i3 = bitcast <3 x half> %i2 to <3 x i16>
  %i4 = extractelement <3 x i16> %i3, i32 1
  %i5 = bitcast <3 x half> %i2 to <3 x i16>
  %i6 = extractelement <3 x i16> %i5, i32 2
  %i7 = zext i16 %i4 to i32
  %i8 = zext i16 %i6 to i32
  %i9 = add nuw nsw i32 0, 7
  %i10 = getelementptr [0 x i32], ptr addrspace(3) @esgs_ring, i32 0, i32 %i9
  store i32 %i7, ptr addrspace(3) %i10, align 4
  %i11 = add nuw nsw i32 0, 8
  %i12 = getelementptr [0 x i32], ptr addrspace(3) @esgs_ring, i32 0, i32 %i11
  store i32 %i8, ptr addrspace(3) %i12, align 4
  unreachable
}
; Function Attrs: nounwind readnone willreturn
declare i32 @llvm.amdgcn.mbcnt.hi(i32, i32) #0
; Function Attrs: nounwind readonly willreturn
declare <3 x half> @llvm.amdgcn.struct.buffer.load.format.v3f16(<4 x i32>, i32, i32, i32, i32 immarg) #1
attributes #0 = { nounwind readnone willreturn }
attributes #1 = { nounwind readonly willreturn }
;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line:
; GFX11: {{.*}}
; GFX12: {{.*}}