Run DCE after a LoopFlatten test to reduce spurious output [nfc]
[llvm-project.git] / llvm / test / MC / AMDGPU / gfx11-promotions.s
blob6be33afb5671b974f0927572951858d0d6ef69e4
1 // RUN: llvm-mc -triple=amdgcn -show-encoding -mcpu=gfx1100 -mattr=+wavefrontsize32,-wavefrontsize64 %s | FileCheck --check-prefix=GFX11 %s
3 // Check opcode promotions and forced suffices.
4 // 1. When a suffix is optional, check that it may be omitted.
5 // 2. When a suffix is optional, check that it may be specified w/o any effect.
6 // 3. When a suffix is required, check that specifying it enforces opcode promotion.
7 // 4. When a suffix is required, check that omitting the suffix results in a different encoding.
9 //===----------------------------------------------------------------------===//
10 // VOP1.
11 //===----------------------------------------------------------------------===//
13 v_mov_b32 v0, v1
14 // GFX11: encoding: [0x01,0x03,0x00,0x7e]
16 v_mov_b32_e32 v0, v1
17 // GFX11: encoding: [0x01,0x03,0x00,0x7e]
19 //===----------------------------------------------------------------------===//
20 // VOP2.
21 //===----------------------------------------------------------------------===//
23 v_add_f16 v5, v1, v2
24 // GFX11: encoding: [0x01,0x05,0x0a,0x64]
26 v_add_f16_e32 v5, v1, v2
27 // GFX11: encoding: [0x01,0x05,0x0a,0x64]
29 //===----------------------------------------------------------------------===//
30 // VOPC.
31 //===----------------------------------------------------------------------===//
33 v_cmp_lt_f32 vcc_lo, v1, v2
34 // GFX11: encoding: [0x01,0x05,0x22,0x7c]
36 v_cmp_lt_f32_e32 vcc_lo, v1, v2
37 // GFX11: encoding: [0x01,0x05,0x22,0x7c]
39 //===----------------------------------------------------------------------===//
40 // VOPCX.
41 //===----------------------------------------------------------------------===//
43 v_cmpx_class_f16 v1, v2
44 // GFX11: encoding: [0x01,0x05,0xfa,0x7d]
46 v_cmpx_class_f16_e32 v1, v2
47 // GFX11: encoding: [0x01,0x05,0xfa,0x7d]
49 //===----------------------------------------------------------------------===//
50 // VOP1.DPP8.
51 //===----------------------------------------------------------------------===//
53 v_bfrev_b32 v5, v1 dpp8:[7,6,5,4,3,2,1,0]
54 // GFX11: encoding: [0xe9,0x70,0x0a,0x7e,0x01,0x77,0x39,0x05]
56 v_bfrev_b32_dpp v5, v1 dpp8:[7,6,5,4,3,2,1,0]
57 // GFX11: encoding: [0xe9,0x70,0x0a,0x7e,0x01,0x77,0x39,0x05]
59 //===----------------------------------------------------------------------===//
60 // VOP1.DPP16.
61 //===----------------------------------------------------------------------===//
63 v_bfrev_b32 v5, v1 quad_perm:[3,2,1,0]
64 // GFX11: encoding: [0xfa,0x70,0x0a,0x7e,0x01,0x1b,0x00,0xff]
66 v_bfrev_b32_dpp v5, v1 quad_perm:[3,2,1,0]
67 // GFX11: encoding: [0xfa,0x70,0x0a,0x7e,0x01,0x1b,0x00,0xff]
69 //===----------------------------------------------------------------------===//
70 // VOP2.DPP8.
71 //===----------------------------------------------------------------------===//
73 v_add_f16 v5, v1, v2 dpp8:[7,6,5,4,3,2,1,0]
74 // GFX11: encoding: [0xe9,0x04,0x0a,0x64,0x01,0x77,0x39,0x05]
76 v_add_f16_dpp v5, v1, v2 dpp8:[7,6,5,4,3,2,1,0]
77 // GFX11: encoding: [0xe9,0x04,0x0a,0x64,0x01,0x77,0x39,0x05]
79 //===----------------------------------------------------------------------===//
80 // VOP2.DPP16.
81 //===----------------------------------------------------------------------===//
83 v_add_f16 v5, v1, v2 quad_perm:[3,2,1,0]
84 // GFX11: encoding: [0xfa,0x04,0x0a,0x64,0x01,0x1b,0x00,0xff]
86 v_add_f16_dpp v5, v1, v2 quad_perm:[3,2,1,0]
87 // GFX11: encoding: [0xfa,0x04,0x0a,0x64,0x01,0x1b,0x00,0xff]
89 //===----------------------------------------------------------------------===//
90 // VOPC.DPP8.
91 //===----------------------------------------------------------------------===//
93 v_cmp_le_u16 v1, v2 dpp8:[7,7,7,3,4,4,6,7] fi:1
94 // GFX11: encoding: [0xea,0x04,0x76,0x7c,0x01,0xff,0x47,0xfa]
96 v_cmp_le_u16_dpp v1, v2 dpp8:[7,7,7,3,4,4,6,7] fi:1
97 // GFX11: encoding: [0xea,0x04,0x76,0x7c,0x01,0xff,0x47,0xfa]
99 //===----------------------------------------------------------------------===//
100 // VOPC.DPP16.
101 //===----------------------------------------------------------------------===//
103 v_cmp_gt_u16 v1, v2 row_shl:0x7 row_mask:0x0 bank_mask:0x0 fi:1
104 // GFX11: encoding: [0xfa,0x04,0x78,0x7c,0x01,0x07,0x05,0x00]
106 v_cmp_gt_u16_dpp v1, v2 row_shl:0x7 row_mask:0x0 bank_mask:0x0 fi:1
107 // GFX11: encoding: [0xfa,0x04,0x78,0x7c,0x01,0x07,0x05,0x00]
109 //===----------------------------------------------------------------------===//
110 // VOPCX.DPP8.
111 //===----------------------------------------------------------------------===//
113 v_cmpx_class_f16 v1, v2 dpp8:[7,6,5,4,3,2,1,0]
114 // GFX11: encoding: [0xe9,0x04,0xfa,0x7d,0x01,0x77,0x39,0x05]
116 v_cmpx_class_f16_dpp v1, v2 dpp8:[7,6,5,4,3,2,1,0]
117 // GFX11: encoding: [0xe9,0x04,0xfa,0x7d,0x01,0x77,0x39,0x05]
119 //===----------------------------------------------------------------------===//
120 // VOPCX.DPP16.
121 //===----------------------------------------------------------------------===//
123 v_cmpx_class_f16 v1, v2 quad_perm:[3,2,1,0]
124 // GFX11: encoding: [0xfa,0x04,0xfa,0x7d,0x01,0x1b,0x00,0xff]
126 v_cmpx_class_f16_dpp v1, v2 quad_perm:[3,2,1,0]
127 // GFX11: encoding: [0xfa,0x04,0xfa,0x7d,0x01,0x1b,0x00,0xff]
129 //===----------------------------------------------------------------------===//
130 // VOP1 -> VOP3.
131 //===----------------------------------------------------------------------===//
133 v_sin_f32 v5, 0.5 mul:2
134 // GFX11: encoding: [0x05,0x00,0xb5,0xd5,0xf0,0x00,0x00,0x08]
136 v_sin_f32_e64 v5, 0.5 mul:2
137 // GFX11: encoding: [0x05,0x00,0xb5,0xd5,0xf0,0x00,0x00,0x08]
139 v_sin_f32_e64 v5, v1
140 // GFX11: encoding: [0x05,0x00,0xb5,0xd5,0x01,0x01,0x00,0x00]
142 v_sin_f32 v5, v1
143 // GFX11: encoding: [0x01,0x6b,0x0a,0x7e]
145 //===----------------------------------------------------------------------===//
146 // VOP2 -> VOP3.
147 //===----------------------------------------------------------------------===//
149 v_add_f32 v5, v1, -v2
150 // GFX11: encoding: [0x05,0x00,0x03,0xd5,0x01,0x05,0x02,0x40]
152 v_add_f32_e64 v5, v1, -v2
153 // GFX11: encoding: [0x05,0x00,0x03,0xd5,0x01,0x05,0x02,0x40]
155 v_add_f32_e64 v5, v1, v2
156 // GFX11: encoding: [0x05,0x00,0x03,0xd5,0x01,0x05,0x02,0x00]
158 v_add_f32 v5, v1, v2
159 // GFX11: encoding: [0x01,0x05,0x0a,0x06]
161 //===----------------------------------------------------------------------===//
162 // VOPC -> VOP3.
163 //===----------------------------------------------------------------------===//
165 v_cmp_f_f32 s10, -v1, v2
166 // GFX11: encoding: [0x0a,0x00,0x10,0xd4,0x01,0x05,0x02,0x20]
168 v_cmp_f_f32_e64 s10, -v1, v2
169 // GFX11: encoding: [0x0a,0x00,0x10,0xd4,0x01,0x05,0x02,0x20]
171 v_cmp_f_f32_e64 vcc_lo, v1, v2
172 // GFX11: encoding: [0x6a,0x00,0x10,0xd4,0x01,0x05,0x02,0x00]
174 v_cmp_f_f32 vcc_lo, v1, v2
175 // GFX11: encoding: [0x01,0x05,0x20,0x7c]
177 //===----------------------------------------------------------------------===//
178 // VOPCX -> VOP3.
179 //===----------------------------------------------------------------------===//
181 v_cmpx_f_f32 -v1, v2
182 // GFX11: encoding: [0x7e,0x00,0x90,0xd4,0x01,0x05,0x02,0x20]
184 v_cmpx_f_f32_e64 -v1, v2
185 // GFX11: encoding: [0x7e,0x00,0x90,0xd4,0x01,0x05,0x02,0x20]
187 v_cmpx_f_f32_e64 v1, v2
188 // GFX11: encoding: [0x7e,0x00,0x90,0xd4,0x01,0x05,0x02,0x00]
190 v_cmpx_f_f32 v1, v2
191 // GFX11: encoding: [0x01,0x05,0x20,0x7d]
193 //===----------------------------------------------------------------------===//
194 // VOP3.
195 //===----------------------------------------------------------------------===//
197 v_add3_u32 v5, v1, v2, s3
198 // GFX11: encoding: [0x05,0x00,0x55,0xd6,0x01,0x05,0x0e,0x00]
200 v_add3_u32_e64 v5, v1, v2, s3
201 // GFX11: encoding: [0x05,0x00,0x55,0xd6,0x01,0x05,0x0e,0x00]
203 //===----------------------------------------------------------------------===//
204 // VOP1 -> VOP3.DPP8.
205 //===----------------------------------------------------------------------===//
207 v_sin_f32 v5, v1 div:2 dpp8:[0,0,0,0,0,0,0,0]
208 // GFX11: encoding: [0x05,0x00,0xb5,0xd5,0xe9,0x00,0x00,0x18,0x01,0x00,0x00,0x00]
210 v_sin_f32_e64_dpp v5, v1 div:2 dpp8:[0,0,0,0,0,0,0,0]
211 // GFX11: encoding: [0x05,0x00,0xb5,0xd5,0xe9,0x00,0x00,0x18,0x01,0x00,0x00,0x00]
213 v_sin_f32_e64_dpp v5, v1 dpp8:[7,6,5,4,3,2,1,0]
214 // GFX11: encoding: [0x05,0x00,0xb5,0xd5,0xe9,0x00,0x00,0x00,0x01,0x77,0x39,0x05]
216 v_sin_f32 v5, v1 dpp8:[7,6,5,4,3,2,1,0]
217 // GFX11: encoding: [0xe9,0x6a,0x0a,0x7e,0x01,0x77,0x39,0x05]
219 //===----------------------------------------------------------------------===//
220 // VOP2 -> VOP3.DPP8.
221 //===----------------------------------------------------------------------===//
223 v_add_f32 v5, v1, v2 mul:4 dpp8:[7,6,5,4,3,2,1,0]
224 // GFX11: encoding: [0x05,0x00,0x03,0xd5,0xe9,0x04,0x02,0x10,0x01,0x77,0x39,0x05]
226 v_add_f32_e64_dpp v5, v1, v2 mul:4 dpp8:[7,6,5,4,3,2,1,0]
227 // GFX11: encoding: [0x05,0x00,0x03,0xd5,0xe9,0x04,0x02,0x10,0x01,0x77,0x39,0x05]
229 v_add_f32_e64_dpp v5, v1, v2 dpp8:[7,6,5,4,3,2,1,0]
230 // GFX11: encoding: [0x05,0x00,0x03,0xd5,0xe9,0x04,0x02,0x00,0x01,0x77,0x39,0x05]
232 v_add_f32 v5, v1, v2 dpp8:[7,6,5,4,3,2,1,0]
233 // GFX11: encoding: [0xe9,0x04,0x0a,0x06,0x01,0x77,0x39,0x05]
235 //===----------------------------------------------------------------------===//
236 // VOPC -> VOP3.DPP8.
237 //===----------------------------------------------------------------------===//
239 v_cmp_class_f32 s5, v1, v2 dpp8:[7,6,5,4,3,2,1,0]
240 // GFX11: encoding: [0x05,0x00,0x7e,0xd4,0xe9,0x04,0x02,0x00,0x01,0x77,0x39,0x05]
242 v_cmp_class_f32_e64_dpp s5, v1, v2 dpp8:[7,6,5,4,3,2,1,0]
243 // GFX11: encoding: [0x05,0x00,0x7e,0xd4,0xe9,0x04,0x02,0x00,0x01,0x77,0x39,0x05]
245 v_cmp_class_f32_e64_dpp vcc_lo, v1, v2 dpp8:[7,6,5,4,3,2,1,0]
246 // GFX11: encoding: [0x6a,0x00,0x7e,0xd4,0xe9,0x04,0x02,0x00,0x01,0x77,0x39,0x05]
248 v_cmp_class_f32 vcc_lo, v1, v2 dpp8:[7,6,5,4,3,2,1,0]
249 // GFX11: encoding: [0xe9,0x04,0xfc,0x7c,0x01,0x77,0x39,0x05]
251 //===----------------------------------------------------------------------===//
252 // VOPCX -> VOP3.DPP8.
253 //===----------------------------------------------------------------------===//
255 v_cmpx_class_f32 -v1, v2 dpp8:[7,6,5,4,3,2,1,0]
256 // GFX11: encoding: [0x7e,0x00,0xfe,0xd4,0xe9,0x04,0x02,0x20,0x01,0x77,0x39,0x05]
258 v_cmpx_class_f32_e64_dpp -v1, v2 dpp8:[7,6,5,4,3,2,1,0]
259 // GFX11: encoding: [0x7e,0x00,0xfe,0xd4,0xe9,0x04,0x02,0x20,0x01,0x77,0x39,0x05]
261 v_cmpx_class_f32_e64_dpp v1, v2 dpp8:[7,6,5,4,3,2,1,0]
262 // GFX11: encoding: [0x7e,0x00,0xfe,0xd4,0xe9,0x04,0x02,0x00,0x01,0x77,0x39,0x05]
264 v_cmpx_class_f32 v1, v2 dpp8:[7,6,5,4,3,2,1,0]
265 // GFX11: encoding: [0xe9,0x04,0xfc,0x7d,0x01,0x77,0x39,0x05]
267 //===----------------------------------------------------------------------===//
268 // VOP1 -> VOP3.DPP16.
269 //===----------------------------------------------------------------------===//
271 v_sin_f32 v5, v1 div:2 row_xmask:15
272 // GFX11: encoding: [0x05,0x00,0xb5,0xd5,0xfa,0x00,0x00,0x18,0x01,0x6f,0x01,0xff]
274 v_sin_f32_e64_dpp v5, v1 div:2 row_xmask:15
275 // GFX11: encoding: [0x05,0x00,0xb5,0xd5,0xfa,0x00,0x00,0x18,0x01,0x6f,0x01,0xff]
277 v_sin_f32_e64_dpp v5, v1 quad_perm:[3,2,1,0]
278 // GFX11: encoding: [0x05,0x00,0xb5,0xd5,0xfa,0x00,0x00,0x00,0x01,0x1b,0x00,0xff]
280 v_sin_f32 v5, v1 quad_perm:[3,2,1,0]
281 // GFX11: encoding: [0xfa,0x6a,0x0a,0x7e,0x01,0x1b,0x00,0xff]
283 //===----------------------------------------------------------------------===//
284 // VOP2 -> VOP3.DPP16.
285 //===----------------------------------------------------------------------===//
287 v_add_f32 v5, v1, v2 div:2 quad_perm:[3,2,1,0]
288 // GFX11: encoding: [0x05,0x00,0x03,0xd5,0xfa,0x04,0x02,0x18,0x01,0x1b,0x00,0xff]
290 v_add_f32_e64_dpp v5, v1, v2 div:2 quad_perm:[3,2,1,0]
291 // GFX11: encoding: [0x05,0x00,0x03,0xd5,0xfa,0x04,0x02,0x18,0x01,0x1b,0x00,0xff]
293 v_add_f32_e64_dpp v5, v1, v2 quad_perm:[3,2,1,0]
294 // GFX11: encoding: [0x05,0x00,0x03,0xd5,0xfa,0x04,0x02,0x00,0x01,0x1b,0x00,0xff]
296 v_add_f32 v5, v1, v2 quad_perm:[3,2,1,0]
297 // GFX11: encoding: [0xfa,0x04,0x0a,0x06,0x01,0x1b,0x00,0xff]
299 //===----------------------------------------------------------------------===//
300 // VOPC -> VOP3.DPP16.
301 //===----------------------------------------------------------------------===//
303 v_cmp_class_f32 s5, v1, v2 quad_perm:[3,2,1,0]
304 // GFX11: encoding: [0x05,0x00,0x7e,0xd4,0xfa,0x04,0x02,0x00,0x01,0x1b,0x00,0xff]
306 v_cmp_class_f32_e64_dpp s5, v1, v2 quad_perm:[3,2,1,0]
307 // GFX11: encoding: [0x05,0x00,0x7e,0xd4,0xfa,0x04,0x02,0x00,0x01,0x1b,0x00,0xff]
309 v_cmp_class_f32_e64_dpp vcc_lo, v1, v2 row_share:0 row_mask:0xf bank_mask:0xf
310 // GFX11: encoding: [0x6a,0x00,0x7e,0xd4,0xfa,0x04,0x02,0x00,0x01,0x50,0x01,0xff]
312 v_cmp_class_f32 vcc_lo, v1, v2 row_share:0 row_mask:0xf bank_mask:0xf
313 // GFX11: encoding: [0xfa,0x04,0xfc,0x7c,0x01,0x50,0x01,0xff]
315 //===----------------------------------------------------------------------===//
316 // VOPCX -> VOP3.DPP16.
317 //===----------------------------------------------------------------------===//
319 v_cmpx_class_f32_e64_dpp v1, v2 quad_perm:[3,2,1,0]
320 // GFX11: encoding: [0x7e,0x00,0xfe,0xd4,0xfa,0x04,0x02,0x00,0x01,0x1b,0x00,0xff]
322 v_cmpx_class_f32 v1, v2 quad_perm:[3,2,1,0]
323 // GFX11: encoding: [0xfa,0x04,0xfc,0x7d,0x01,0x1b,0x00,0xff]
325 //===----------------------------------------------------------------------===//
326 // VOP3P.
327 //===----------------------------------------------------------------------===//
329 v_dot2_f32_f16 v0, v1, v2, v3
330 // GFX11: encoding: [0x00,0x40,0x13,0xcc,0x01,0x05,0x0e,0x1c]
332 v_dot2_f32_f16_e64 v0, v1, v2, v3
333 // GFX11: encoding: [0x00,0x40,0x13,0xcc,0x01,0x05,0x0e,0x1c]
335 //===----------------------------------------------------------------------===//
336 // VOP3P.DPP8.
337 //===----------------------------------------------------------------------===//
339 v_dot2_f32_f16 v0, v1, v2, v3 dpp8:[7,6,5,4,3,2,1,0]
340 // GFX11: encoding: [0x00,0x00,0x13,0xcc,0xe9,0x04,0x0e,0x04,0x01,0x77,0x39,0x05]
342 v_dot2_f32_f16_e64_dpp v0, v1, v2, v3 dpp8:[7,6,5,4,3,2,1,0]
343 // GFX11: encoding: [0x00,0x00,0x13,0xcc,0xe9,0x04,0x0e,0x04,0x01,0x77,0x39,0x05]
345 //===----------------------------------------------------------------------===//
346 // VOP3P.DPP16.
347 //===----------------------------------------------------------------------===//
349 v_dot2_f32_f16 v0, v1, v2, v3 quad_perm:[1,2,3,0]
350 // GFX11: encoding: [0x00,0x00,0x13,0xcc,0xfa,0x04,0x0e,0x04,0x01,0x39,0x00,0xff]
352 v_dot2_f32_f16_e64_dpp v0, v1, v2, v3 quad_perm:[1,2,3,0]
353 // GFX11: encoding: [0x00,0x00,0x13,0xcc,0xfa,0x04,0x0e,0x04,0x01,0x39,0x00,0xff]