1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=gfx900 -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=GFX9 %s
3 ; RUN: llc -mtriple=amdgcn-amd-amdhsa -mcpu=fiji -verify-machineinstrs < %s | FileCheck -enable-var-scope -check-prefix=GFX8 %s
5 define void @undef_lo_v2i16(i16 %arg0) {
6 ; GFX9-LABEL: undef_lo_v2i16:
8 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
9 ; GFX9-NEXT: v_lshlrev_b32_e32 v0, 16, v0
10 ; GFX9-NEXT: ;;#ASMSTART
12 ; GFX9-NEXT: ;;#ASMEND
13 ; GFX9-NEXT: s_setpc_b64 s[30:31]
15 ; GFX8-LABEL: undef_lo_v2i16:
17 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
18 ; GFX8-NEXT: v_lshlrev_b32_e32 v0, 16, v0
19 ; GFX8-NEXT: ;;#ASMSTART
21 ; GFX8-NEXT: ;;#ASMEND
22 ; GFX8-NEXT: s_setpc_b64 s[30:31]
23 %undef.lo = insertelement <2 x i16> undef, i16 %arg0, i32 1
24 call void asm sideeffect "; use $0", "v"(<2 x i16> %undef.lo);
28 define void @undef_lo_v2f16(half %arg0) {
29 ; GFX9-LABEL: undef_lo_v2f16:
31 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
32 ; GFX9-NEXT: v_lshlrev_b32_e32 v0, 16, v0
33 ; GFX9-NEXT: ;;#ASMSTART
35 ; GFX9-NEXT: ;;#ASMEND
36 ; GFX9-NEXT: s_setpc_b64 s[30:31]
38 ; GFX8-LABEL: undef_lo_v2f16:
40 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
41 ; GFX8-NEXT: v_lshlrev_b32_e32 v0, 16, v0
42 ; GFX8-NEXT: ;;#ASMSTART
44 ; GFX8-NEXT: ;;#ASMEND
45 ; GFX8-NEXT: s_setpc_b64 s[30:31]
46 %undef.lo = insertelement <2 x half> undef, half %arg0, i32 1
47 call void asm sideeffect "; use $0", "v"(<2 x half> %undef.lo);
51 define void @undef_lo_op_v2f16(half %arg0) {
52 ; GFX9-LABEL: undef_lo_op_v2f16:
54 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
55 ; GFX9-NEXT: v_lshlrev_b32_e32 v0, 16, v0
56 ; GFX9-NEXT: v_pk_add_f16 v0, v0, 1.0 op_sel_hi:[1,0]
57 ; GFX9-NEXT: ;;#ASMSTART
59 ; GFX9-NEXT: ;;#ASMEND
60 ; GFX9-NEXT: s_setpc_b64 s[30:31]
62 ; GFX8-LABEL: undef_lo_op_v2f16:
64 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
65 ; GFX8-NEXT: v_mov_b32_e32 v1, 0x3c00
66 ; GFX8-NEXT: v_add_f16_sdwa v0, v0, v1 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
67 ; GFX8-NEXT: v_or_b32_e32 v0, 0x7e00, v0
68 ; GFX8-NEXT: ;;#ASMSTART
70 ; GFX8-NEXT: ;;#ASMEND
71 ; GFX8-NEXT: s_setpc_b64 s[30:31]
72 %undef.lo = insertelement <2 x half> undef, half %arg0, i32 1
73 %op = fadd <2 x half> %undef.lo, <half 1.0, half 1.0>
74 call void asm sideeffect "; use $0", "v"(<2 x half> %op);
78 define void @undef_lo_op_v2i16(i16 %arg0) {
79 ; GFX9-LABEL: undef_lo_op_v2i16:
81 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
82 ; GFX9-NEXT: v_lshlrev_b32_e32 v0, 16, v0
83 ; GFX9-NEXT: s_movk_i32 s4, 0x63
84 ; GFX9-NEXT: v_pk_add_u16 v0, v0, s4 op_sel_hi:[1,0]
85 ; GFX9-NEXT: ;;#ASMSTART
87 ; GFX9-NEXT: ;;#ASMEND
88 ; GFX9-NEXT: s_setpc_b64 s[30:31]
90 ; GFX8-LABEL: undef_lo_op_v2i16:
92 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
93 ; GFX8-NEXT: v_mov_b32_e32 v1, 0x63
94 ; GFX8-NEXT: v_add_u16_sdwa v0, v0, v1 dst_sel:WORD_1 dst_unused:UNUSED_PAD src0_sel:DWORD src1_sel:DWORD
95 ; GFX8-NEXT: ;;#ASMSTART
97 ; GFX8-NEXT: ;;#ASMEND
98 ; GFX8-NEXT: s_setpc_b64 s[30:31]
99 %undef.lo = insertelement <2 x i16> undef, i16 %arg0, i32 1
100 %op = add <2 x i16> %undef.lo, <i16 99, i16 99>
101 call void asm sideeffect "; use $0", "v"(<2 x i16> %op);
105 define void @undef_lo3_v4i16(i16 %arg0) {
106 ; GFX9-LABEL: undef_lo3_v4i16:
108 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
109 ; GFX9-NEXT: v_lshlrev_b32_e32 v0, 16, v0
110 ; GFX9-NEXT: ;;#ASMSTART
111 ; GFX9-NEXT: ; use v[0:1]
112 ; GFX9-NEXT: ;;#ASMEND
113 ; GFX9-NEXT: s_setpc_b64 s[30:31]
115 ; GFX8-LABEL: undef_lo3_v4i16:
117 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
118 ; GFX8-NEXT: v_lshlrev_b32_e32 v0, 16, v0
119 ; GFX8-NEXT: ;;#ASMSTART
120 ; GFX8-NEXT: ; use v[0:1]
121 ; GFX8-NEXT: ;;#ASMEND
122 ; GFX8-NEXT: s_setpc_b64 s[30:31]
123 %undef.lo = insertelement <4 x i16> undef, i16 %arg0, i32 1
124 call void asm sideeffect "; use $0", "v"(<4 x i16> %undef.lo);
128 define void @undef_lo3_v4f16(half %arg0) {
129 ; GFX9-LABEL: undef_lo3_v4f16:
131 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
132 ; GFX9-NEXT: v_lshlrev_b32_e32 v0, 16, v0
133 ; GFX9-NEXT: ;;#ASMSTART
134 ; GFX9-NEXT: ; use v[0:1]
135 ; GFX9-NEXT: ;;#ASMEND
136 ; GFX9-NEXT: s_setpc_b64 s[30:31]
138 ; GFX8-LABEL: undef_lo3_v4f16:
140 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
141 ; GFX8-NEXT: v_lshlrev_b32_e32 v0, 16, v0
142 ; GFX8-NEXT: ;;#ASMSTART
143 ; GFX8-NEXT: ; use v[0:1]
144 ; GFX8-NEXT: ;;#ASMEND
145 ; GFX8-NEXT: s_setpc_b64 s[30:31]
146 %undef.lo = insertelement <4 x half> undef, half %arg0, i32 1
147 call void asm sideeffect "; use $0", "v"(<4 x half> %undef.lo);
151 define void @undef_lo2_v4i16(<2 x i16> %arg0) {
152 ; GFX9-LABEL: undef_lo2_v4i16:
154 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
155 ; GFX9-NEXT: s_mov_b32 s4, 0x7060302
156 ; GFX9-NEXT: v_perm_b32 v0, v0, v0, s4
157 ; GFX9-NEXT: ;;#ASMSTART
158 ; GFX9-NEXT: ; use v[0:1]
159 ; GFX9-NEXT: ;;#ASMEND
160 ; GFX9-NEXT: s_setpc_b64 s[30:31]
162 ; GFX8-LABEL: undef_lo2_v4i16:
164 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
165 ; GFX8-NEXT: v_lshrrev_b32_e32 v1, 16, v0
166 ; GFX8-NEXT: v_alignbit_b32 v0, v1, v0, 16
167 ; GFX8-NEXT: ;;#ASMSTART
168 ; GFX8-NEXT: ; use v[0:1]
169 ; GFX8-NEXT: ;;#ASMEND
170 ; GFX8-NEXT: s_setpc_b64 s[30:31]
171 %undef.lo = shufflevector <2 x i16> %arg0, <2 x i16> undef, <4 x i32> <i32 1, i32 1, i32 2, i32 3>
172 call void asm sideeffect "; use $0", "v"(<4 x i16> %undef.lo);
176 define void @undef_lo2_v4f16(<2 x half> %arg0) {
177 ; GFX9-LABEL: undef_lo2_v4f16:
179 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
180 ; GFX9-NEXT: s_mov_b32 s4, 0x7060302
181 ; GFX9-NEXT: v_perm_b32 v0, v0, v0, s4
182 ; GFX9-NEXT: ;;#ASMSTART
183 ; GFX9-NEXT: ; use v[0:1]
184 ; GFX9-NEXT: ;;#ASMEND
185 ; GFX9-NEXT: s_setpc_b64 s[30:31]
187 ; GFX8-LABEL: undef_lo2_v4f16:
189 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
190 ; GFX8-NEXT: v_lshrrev_b32_e32 v1, 16, v0
191 ; GFX8-NEXT: v_alignbit_b32 v0, v1, v0, 16
192 ; GFX8-NEXT: ;;#ASMSTART
193 ; GFX8-NEXT: ; use v[0:1]
194 ; GFX8-NEXT: ;;#ASMEND
195 ; GFX8-NEXT: s_setpc_b64 s[30:31]
196 %undef.lo = shufflevector <2 x half> %arg0, <2 x half> undef, <4 x i32> <i32 1, i32 1, i32 2, i32 3>
197 call void asm sideeffect "; use $0", "v"(<4 x half> %undef.lo);
201 define void @undef_hi_v2i16(i16 %arg0) {
202 ; GFX9-LABEL: undef_hi_v2i16:
204 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
205 ; GFX9-NEXT: ;;#ASMSTART
206 ; GFX9-NEXT: ; use v0
207 ; GFX9-NEXT: ;;#ASMEND
208 ; GFX9-NEXT: s_setpc_b64 s[30:31]
210 ; GFX8-LABEL: undef_hi_v2i16:
212 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
213 ; GFX8-NEXT: ;;#ASMSTART
214 ; GFX8-NEXT: ; use v0
215 ; GFX8-NEXT: ;;#ASMEND
216 ; GFX8-NEXT: s_setpc_b64 s[30:31]
217 %undef.hi = insertelement <2 x i16> undef, i16 %arg0, i32 0
218 call void asm sideeffect "; use $0", "v"(<2 x i16> %undef.hi);
222 define void @undef_hi_v2f16(half %arg0) {
223 ; GFX9-LABEL: undef_hi_v2f16:
225 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
226 ; GFX9-NEXT: ;;#ASMSTART
227 ; GFX9-NEXT: ; use v0
228 ; GFX9-NEXT: ;;#ASMEND
229 ; GFX9-NEXT: s_setpc_b64 s[30:31]
231 ; GFX8-LABEL: undef_hi_v2f16:
233 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
234 ; GFX8-NEXT: ;;#ASMSTART
235 ; GFX8-NEXT: ; use v0
236 ; GFX8-NEXT: ;;#ASMEND
237 ; GFX8-NEXT: s_setpc_b64 s[30:31]
238 %undef.hi = insertelement <2 x half> undef, half %arg0, i32 0
239 call void asm sideeffect "; use $0", "v"(<2 x half> %undef.hi);
243 define void @undef_hi_op_v2f16(half %arg0) {
244 ; GFX9-LABEL: undef_hi_op_v2f16:
246 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
247 ; GFX9-NEXT: v_pk_add_f16 v0, v0, 1.0 op_sel_hi:[1,0]
248 ; GFX9-NEXT: ;;#ASMSTART
249 ; GFX9-NEXT: ; use v0
250 ; GFX9-NEXT: ;;#ASMEND
251 ; GFX9-NEXT: s_setpc_b64 s[30:31]
253 ; GFX8-LABEL: undef_hi_op_v2f16:
255 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
256 ; GFX8-NEXT: v_add_f16_e32 v0, 1.0, v0
257 ; GFX8-NEXT: v_or_b32_e32 v0, 0x7e000000, v0
258 ; GFX8-NEXT: ;;#ASMSTART
259 ; GFX8-NEXT: ; use v0
260 ; GFX8-NEXT: ;;#ASMEND
261 ; GFX8-NEXT: s_setpc_b64 s[30:31]
262 %undef.hi = insertelement <2 x half> undef, half %arg0, i32 0
263 %op = fadd <2 x half> %undef.hi, <half 1.0, half 1.0>
264 call void asm sideeffect "; use $0", "v"(<2 x half> %op);
268 define void @undef_hi_op_v2i16(i16 %arg0) {
269 ; GFX9-LABEL: undef_hi_op_v2i16:
271 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
272 ; GFX9-NEXT: s_movk_i32 s4, 0x63
273 ; GFX9-NEXT: v_pk_add_u16 v0, v0, s4 op_sel_hi:[1,0]
274 ; GFX9-NEXT: ;;#ASMSTART
275 ; GFX9-NEXT: ; use v0
276 ; GFX9-NEXT: ;;#ASMEND
277 ; GFX9-NEXT: s_setpc_b64 s[30:31]
279 ; GFX8-LABEL: undef_hi_op_v2i16:
281 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
282 ; GFX8-NEXT: v_add_u16_e32 v0, 0x63, v0
283 ; GFX8-NEXT: ;;#ASMSTART
284 ; GFX8-NEXT: ; use v0
285 ; GFX8-NEXT: ;;#ASMEND
286 ; GFX8-NEXT: s_setpc_b64 s[30:31]
287 %undef.hi = insertelement <2 x i16> undef, i16 %arg0, i32 0
288 %op = add <2 x i16> %undef.hi, <i16 99, i16 99>
289 call void asm sideeffect "; use $0", "v"(<2 x i16> %op);
293 define void @undef_hi3_v4i16(i16 %arg0) {
294 ; GFX9-LABEL: undef_hi3_v4i16:
296 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
297 ; GFX9-NEXT: ;;#ASMSTART
298 ; GFX9-NEXT: ; use v[0:1]
299 ; GFX9-NEXT: ;;#ASMEND
300 ; GFX9-NEXT: s_setpc_b64 s[30:31]
302 ; GFX8-LABEL: undef_hi3_v4i16:
304 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
305 ; GFX8-NEXT: ;;#ASMSTART
306 ; GFX8-NEXT: ; use v[0:1]
307 ; GFX8-NEXT: ;;#ASMEND
308 ; GFX8-NEXT: s_setpc_b64 s[30:31]
309 %undef.hi = insertelement <4 x i16> undef, i16 %arg0, i32 0
310 call void asm sideeffect "; use $0", "v"(<4 x i16> %undef.hi);
314 define void @undef_hi3_v4f16(half %arg0) {
315 ; GFX9-LABEL: undef_hi3_v4f16:
317 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
318 ; GFX9-NEXT: ;;#ASMSTART
319 ; GFX9-NEXT: ; use v[0:1]
320 ; GFX9-NEXT: ;;#ASMEND
321 ; GFX9-NEXT: s_setpc_b64 s[30:31]
323 ; GFX8-LABEL: undef_hi3_v4f16:
325 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
326 ; GFX8-NEXT: ;;#ASMSTART
327 ; GFX8-NEXT: ; use v[0:1]
328 ; GFX8-NEXT: ;;#ASMEND
329 ; GFX8-NEXT: s_setpc_b64 s[30:31]
330 %undef.hi = insertelement <4 x half> undef, half %arg0, i32 0
331 call void asm sideeffect "; use $0", "v"(<4 x half> %undef.hi);
335 define void @undef_hi2_v4i16(<2 x i16> %arg0) {
336 ; GFX9-LABEL: undef_hi2_v4i16:
338 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
339 ; GFX9-NEXT: ;;#ASMSTART
340 ; GFX9-NEXT: ; use v[0:1]
341 ; GFX9-NEXT: ;;#ASMEND
342 ; GFX9-NEXT: s_setpc_b64 s[30:31]
344 ; GFX8-LABEL: undef_hi2_v4i16:
346 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
347 ; GFX8-NEXT: ;;#ASMSTART
348 ; GFX8-NEXT: ; use v[0:1]
349 ; GFX8-NEXT: ;;#ASMEND
350 ; GFX8-NEXT: s_setpc_b64 s[30:31]
351 %undef.hi = shufflevector <2 x i16> %arg0, <2 x i16> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
352 call void asm sideeffect "; use $0", "v"(<4 x i16> %undef.hi);
356 define void @undef_hi2_v4f16(<2 x half> %arg0) {
357 ; GFX9-LABEL: undef_hi2_v4f16:
359 ; GFX9-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
360 ; GFX9-NEXT: ;;#ASMSTART
361 ; GFX9-NEXT: ; use v[0:1]
362 ; GFX9-NEXT: ;;#ASMEND
363 ; GFX9-NEXT: s_setpc_b64 s[30:31]
365 ; GFX8-LABEL: undef_hi2_v4f16:
367 ; GFX8-NEXT: s_waitcnt vmcnt(0) expcnt(0) lgkmcnt(0)
368 ; GFX8-NEXT: ;;#ASMSTART
369 ; GFX8-NEXT: ; use v[0:1]
370 ; GFX8-NEXT: ;;#ASMEND
371 ; GFX8-NEXT: s_setpc_b64 s[30:31]
372 %undef.hi = shufflevector <2 x half> %arg0, <2 x half> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
373 call void asm sideeffect "; use $0", "v"(<4 x half> %undef.hi);