1 // RUN: not llvm-mc -arch=amdgcn -show-encoding %s | FileCheck %s --check-prefix=GCN --check-prefix=SI --check-prefix=SICI
2 // RUN: not llvm-mc -arch=amdgcn -mcpu=SI -show-encoding %s | FileCheck %s --check-prefix=GCN --check-prefix=SI --check-prefix=SICI
3 // RUN: not llvm-mc -arch=amdgcn -mcpu=bonaire -show-encoding %s | FileCheck %s --check-prefix=GCN --check-prefix=SICI --check-prefix=CIVI
4 // RUN: not llvm-mc -arch=amdgcn -mcpu=tonga -show-encoding %s | FileCheck %s --check-prefix=GCN --check-prefix=CIVI --check-prefix=VI
6 // RUN: not llvm-mc -arch=amdgcn -show-encoding %s 2>&1 | FileCheck %s --check-prefix=NOSI --check-prefix=NOSICI
7 // RUN: not llvm-mc -arch=amdgcn -mcpu=SI -show-encoding %s 2>&1 | FileCheck %s --check-prefix=NOSI --check-prefix=NOSICI
8 // RUN: not llvm-mc -arch=amdgcn -mcpu=bonaire -show-encoding %s 2>&1 | FileCheck %s --check-prefix=NOSICI
9 // RUN: not llvm-mc -arch=amdgcn -mcpu=tonga -show-encoding %s 2>&1 | FileCheck %s -check-prefix=NOVI
11 // Force 32-bit encoding
13 // GCN: v_mov_b32_e32 v1, v2 ; encoding: [0x02,0x03,0x02,0x7e]
16 // Force 32-bit encoding for special instructions
17 // FIXME: We should be printing _e32 suffixes for these:
19 // GCN: v_nop ; encoding: [0x00,0x00,0x00,0x7e]
22 // SICI: v_clrexcp ; encoding: [0x00,0x82,0x00,0x7e]
23 // VI: v_clrexcp ; encoding: [0x00,0x6a,0x00,0x7e]
26 //===----------------------------------------------------------------------===//
28 //===----------------------------------------------------------------------===//
31 // GCN: v_nop ; encoding: [0x00,0x00,0x00,0x7e]
34 // GCN: v_mov_b32_e32 v1, v2 ; encoding: [0x02,0x03,0x02,0x7e]
37 // GCN: v_readfirstlane_b32 s1, v2 ; encoding: [0x02,0x05,0x02,0x7e]
38 v_readfirstlane_b32 s1, v2
40 // GCN: v_cvt_i32_f64_e32 v1, v[2:3] ; encoding: [0x02,0x07,0x02,0x7e]
41 v_cvt_i32_f64 v1, v[2:3]
43 // GCN: v_cvt_f64_i32_e32 v[1:2], v2 ; encoding: [0x02,0x09,0x02,0x7e]
44 v_cvt_f64_i32 v[1:2], v2
46 // GCN: v_cvt_f32_i32_e32 v1, v2 ; encoding: [0x02,0x0b,0x02,0x7e]
49 // GCN: v_cvt_f32_u32_e32 v1, v2 ; encoding: [0x02,0x0d,0x02,0x7e]
52 // GCN: v_cvt_u32_f32_e32 v1, v2 ; encoding: [0x02,0x0f,0x02,0x7e
55 // GCN: v_cvt_i32_f32_e32 v1, v2 ; encoding: [0x02,0x11,0x02,0x7e]
58 // SICI: v_mov_fed_b32_e32 v1, v2 ; encoding: [0x02,0x13,0x02,0x7e]
59 // NOVI: error: instruction not supported on this GPU
62 // GCN: v_cvt_f16_f32_e32 v1, v2 ; encoding: [0x02,0x15,0x02,0x7e]
65 // GCN: v_cvt_f32_f16_e32 v1, v2 ; encoding: [0x02,0x17,0x02,0x7e]
68 // GCN: v_cvt_rpi_i32_f32_e32 v1, v2 ; encoding: [0x02,0x19,0x02,0x7e]
69 v_cvt_rpi_i32_f32 v1, v2
71 // GCN: v_cvt_flr_i32_f32_e32 v1, v2 ; encoding: [0x02,0x1b,0x02,0x7e]
72 v_cvt_flr_i32_f32 v1, v2
74 // GCN: v_cvt_off_f32_i4_e32 v1, v2 ; encoding: [0x02,0x1d,0x02,0x7e]
75 v_cvt_off_f32_i4_e32 v1, v2
77 // GCN: v_cvt_f32_f64_e32 v1, v[2:3] ; encoding: [0x02,0x1f,0x02,0x7e]
78 v_cvt_f32_f64 v1, v[2:3]
80 // GCN: v_cvt_f64_f32_e32 v[1:2], v2 ; encoding: [0x02,0x21,0x02,0x7e]
81 v_cvt_f64_f32 v[1:2], v2
83 // GCN: v_cvt_f32_ubyte0_e32 v1, v2 ; encoding: [0x02,0x23,0x02,0x7e]
84 v_cvt_f32_ubyte0 v1, v2
86 // GCN: v_cvt_f32_ubyte1_e32 v1, v2 ; encoding: [0x02,0x25,0x02,0x7e]
87 v_cvt_f32_ubyte1_e32 v1, v2
89 // GCN: v_cvt_f32_ubyte2_e32 v1, v2 ; encoding: [0x02,0x27,0x02,0x7e]
90 v_cvt_f32_ubyte2 v1, v2
92 // GCN: v_cvt_f32_ubyte3_e32 v1, v2 ; encoding: [0x02,0x29,0x02,0x7e]
93 v_cvt_f32_ubyte3 v1, v2
95 // GCN: v_cvt_u32_f64_e32 v1, v[2:3] ; encoding: [0x02,0x2b,0x02,0x7e]
96 v_cvt_u32_f64 v1, v[2:3]
98 // GCN: v_cvt_f64_u32_e32 v[1:2], v2 ; encoding: [0x02,0x2d,0x02,0x7e]
99 v_cvt_f64_u32 v[1:2], v2
101 // NOSI: error: instruction not supported on this GPU
102 // NOSI: v_trunc_f64_e32 v[1:2], v[2:3]
103 // CIVI: v_trunc_f64_e32 v[1:2], v[2:3] ; encoding: [0x02,0x2f,0x02,0x7e]
104 v_trunc_f64_e32 v[1:2], v[2:3]
106 // NOSI: error: instruction not supported on this GPU
107 // NOSI: v_ceil_f64_e32 v[1:2], v[2:3]
108 // CIVI: v_ceil_f64_e32 v[1:2], v[2:3] ; encoding: [0x02,0x31,0x02,0x7e]
109 v_ceil_f64_e32 v[1:2], v[2:3]
111 // NOSI: error: instruction not supported on this GPU
112 // NOSI: v_rndne_f64_e32 v[1:2], v[2:3]
113 // CIVI: v_rndne_f64_e32 v[1:2], v[2:3] ; encoding: [0x02,0x33,0x02,0x7e]
114 v_rndne_f64_e32 v[1:2], v[2:3]
116 // NOSI: error: instruction not supported on this GPU
117 // NOSI: v_floor_f64_e32 v[1:2], v[2:3]
118 // CIVI: v_floor_f64_e32 v[1:2], v[2:3] ; encoding: [0x02,0x35,0x02,0x7e]
119 v_floor_f64_e32 v[1:2], v[2:3]
121 // SICI: v_fract_f32_e32 v1, v2 ; encoding: [0x02,0x41,0x02,0x7e]
122 // VI: v_fract_f32_e32 v1, v2 ; encoding: [0x02,0x37,0x02,0x7e]
125 // SICI: v_trunc_f32_e32 v1, v2 ; encoding: [0x02,0x43,0x02,0x7e]
126 // VI: v_trunc_f32_e32 v1, v2 ; encoding: [0x02,0x39,0x02,0x7e]
129 // SICI: v_ceil_f32_e32 v1, v2 ; encoding: [0x02,0x45,0x02,0x7e]
130 // VI: v_ceil_f32_e32 v1, v2 ; encoding: [0x02,0x3b,0x02,0x7e]
133 // SICI: v_rndne_f32_e32 v1, v2 ; encoding: [0x02,0x47,0x02,0x7e]
134 // VI: v_rndne_f32_e32 v1, v2 ; encoding: [0x02,0x3d,0x02,0x7e]
137 // SICI: v_floor_f32_e32 v1, v2 ; encoding: [0x02,0x49,0x02,0x7e]
138 // VI: v_floor_f32_e32 v1, v2 ; encoding: [0x02,0x3f,0x02,0x7e]
139 v_floor_f32_e32 v1, v2
141 // SICI: v_exp_f32_e32 v1, v2 ; encoding: [0x02,0x4b,0x02,0x7e]
142 // VI: v_exp_f32_e32 v1, v2 ; encoding: [0x02,0x41,0x02,0x7e]
145 // SICI: v_log_clamp_f32_e32 v1, v2 ; encoding: [0x02,0x4d,0x02,0x7e]
146 // NOVI: error: instruction not supported on this GPU
147 // NOVI: v_log_clamp_f32 v1, v2
148 v_log_clamp_f32 v1, v2
150 // SICI: v_log_f32_e32 v1, v2 ; encoding: [0x02,0x4f,0x02,0x7e]
151 // VI: v_log_f32_e32 v1, v2 ; encoding: [0x02,0x43,0x02,0x7e]
154 // SICI: v_rcp_clamp_f32_e32 v1, v2 ; encoding: [0x02,0x51,0x02,0x7e]
155 // NOVI: error: instruction not supported on this GPU
156 // NOVI: v_rcp_clamp_f32 v1, v2
157 v_rcp_clamp_f32 v1, v2
159 // SICI: v_rcp_legacy_f32_e32 v1, v2 ; encoding: [0x02,0x53,0x02,0x7e]
160 // NOVI: error: instruction not supported on this GPU
161 // NOVI: v_rcp_legacy_f32 v1, v2
162 v_rcp_legacy_f32 v1, v2
164 // SICI: v_rcp_f32_e32 v1, v2 ; encoding: [0x02,0x55,0x02,0x7e]
165 // VI: v_rcp_f32_e32 v1, v2 ; encoding: [0x02,0x45,0x02,0x7e]
168 // SICI: v_rcp_iflag_f32_e32 v1, v2 ; encoding: [0x02,0x57,0x02,0x7e]
169 // VI: v_rcp_iflag_f32_e32 v1, v2 ; encoding: [0x02,0x47,0x02,0x7e]
170 v_rcp_iflag_f32 v1, v2
172 // SICI: v_rsq_clamp_f32_e32 v1, v2 ; encoding: [0x02,0x59,0x02,0x7e]
173 // NOVI: error: instruction not supported on this GPU
174 // NOVI: v_rsq_clamp_f32 v1, v2
175 v_rsq_clamp_f32 v1, v2
177 // SICI: v_rsq_legacy_f32_e32 v1, v2 ; encoding: [0x02,0x5b,0x02,0x7e]
178 // NOVI: error: instruction not supported on this GPU
179 // NOVI: v_rsq_legacy_f32 v1, v2
180 v_rsq_legacy_f32 v1, v2
182 // SICI: v_rsq_f32_e32 v1, v2 ; encoding: [0x02,0x5d,0x02,0x7e]
183 // VI: v_rsq_f32_e32 v1, v2 ; encoding: [0x02,0x49,0x02,0x7e]
186 // SICI: v_rcp_f64_e32 v[1:2], v[2:3] ; encoding: [0x02,0x5f,0x02,0x7e]
187 // VI: v_rcp_f64_e32 v[1:2], v[2:3] ; encoding: [0x02,0x4b,0x02,0x7e]
188 v_rcp_f64 v[1:2], v[2:3]
190 // SICI: v_rcp_clamp_f64_e32 v[1:2], v[2:3] ; encoding: [0x02,0x61,0x02,0x7e]
191 // NOVI: error: instruction not supported on this GPU
192 // NOVI: v_rcp_clamp_f64 v[1:2], v[2:3]
193 v_rcp_clamp_f64 v[1:2], v[2:3]
195 // SICI: v_rsq_f64_e32 v[1:2], v[2:3] ; encoding: [0x02,0x63,0x02,0x7e]
196 // VI: v_rsq_f64_e32 v[1:2], v[2:3] ; encoding: [0x02,0x4d,0x02,0x7e]
197 v_rsq_f64 v[1:2], v[2:3]
199 // SICI: v_rsq_clamp_f64_e32 v[1:2], v[2:3] ; encoding: [0x02,0x65,0x02,0x7e]
200 // NOVI: error: instruction not supported on this GPU
201 // NOVI: v_rsq_clamp_f64 v[1:2], v[2:3]
202 v_rsq_clamp_f64 v[1:2], v[2:3]
204 // SICI: v_sqrt_f32_e32 v1, v2 ; encoding: [0x02,0x67,0x02,0x7e]
205 // VI: v_sqrt_f32_e32 v1, v2 ; encoding: [0x02,0x4f,0x02,0x7e]
208 // SICI: v_sqrt_f64_e32 v[1:2], v[2:3] ; encoding: [0x02,0x69,0x02,0x7e]
209 // VI: v_sqrt_f64_e32 v[1:2], v[2:3] ; encoding: [0x02,0x51,0x02,0x7e]
210 v_sqrt_f64 v[1:2], v[2:3]
212 // SICI: v_sin_f32_e32 v1, v2 ; encoding: [0x02,0x6b,0x02,0x7e]
213 // VI: v_sin_f32_e32 v1, v2 ; encoding: [0x02,0x53,0x02,0x7e]
216 // SICI: v_cos_f32_e32 v1, v2 ; encoding: [0x02,0x6d,0x02,0x7e]
217 // VI: v_cos_f32_e32 v1, v2 ; encoding: [0x02,0x55,0x02,0x7e]
220 // SICI: v_not_b32_e32 v1, v2 ; encoding: [0x02,0x6f,0x02,0x7e]
221 // VI: v_not_b32_e32 v1, v2 ; encoding: [0x02,0x57,0x02,0x7e]
224 // SICI: v_bfrev_b32_e32 v1, v2 ; encoding: [0x02,0x71,0x02,0x7e]
225 // VI: v_bfrev_b32_e32 v1, v2 ; encoding: [0x02,0x59,0x02,0x7e]
228 // SICI: v_ffbh_u32_e32 v1, v2 ; encoding: [0x02,0x73,0x02,0x7e]
229 // VI: v_ffbh_u32_e32 v1, v2 ; encoding: [0x02,0x5b,0x02,0x7e]
232 // SICI: v_ffbl_b32_e32 v1, v2 ; encoding: [0x02,0x75,0x02,0x7e]
233 // VI: v_ffbl_b32_e32 v1, v2 ; encoding: [0x02,0x5d,0x02,0x7e]
236 // SICI: v_ffbh_i32_e32 v1, v2 ; encoding: [0x02,0x77,0x02,0x7e]
237 // VI: v_ffbh_i32_e32 v1, v2 ; encoding: [0x02,0x5f,0x02,0x7e]
238 v_ffbh_i32_e32 v1, v2
240 // SICI: v_frexp_exp_i32_f64_e32 v1, v[2:3] ; encoding: [0x02,0x79,0x02,0x7e]
241 // VI: v_frexp_exp_i32_f64_e32 v1, v[2:3] ; encoding: [0x02,0x61,0x02,0x7e]
242 v_frexp_exp_i32_f64 v1, v[2:3]
244 // SICI: v_frexp_mant_f64_e32 v[1:2], v[2:3] ; encoding: [0x02,0x7b,0x02,0x7e]
245 // VI; v_frexp_mant_f64_e32 v[1:2], v[2:3] ; encoding: [0x02,0x63,0x02,0x7e]
246 v_frexp_mant_f64 v[1:2], v[2:3]
248 // SICI: v_fract_f64_e32 v[1:2], v[2:3] ; encoding: [0x02,0x7d,0x02,0x7e]
249 // VI: v_fract_f64_e32 v[1:2], v[2:3] ; encoding: [0x02,0x65,0x02,0x7e]
250 v_fract_f64 v[1:2], v[2:3]
252 // SICI: v_frexp_exp_i32_f32_e32 v1, v2 ; encoding: [0x02,0x7f,0x02,0x7e]
253 // VI: v_frexp_exp_i32_f32_e32 v1, v2 ; encoding: [0x02,0x67,0x02,0x7e]
254 v_frexp_exp_i32_f32 v1, v2
256 // SICI: v_frexp_mant_f32_e32 v1, v2 ; encoding: [0x02,0x81,0x02,0x7e]
257 // VI: v_frexp_mant_f32_e32 v1, v2 ; encoding: [0x02,0x69,0x02,0x7e]
258 v_frexp_mant_f32 v1, v2
260 // SICI: v_clrexcp ; encoding: [0x00,0x82,0x00,0x7e]
261 // VI: v_clrexcp ; encoding: [0x00,0x6a,0x00,0x7e]
264 // SICI: v_movreld_b32_e32 v1, v2 ; encoding: [0x02,0x85,0x02,0x7e]
265 // VI: v_movreld_b32_e32 v1, v2 ; encoding: [0x02,0x6d,0x02,0x7e]
268 // SICI: v_movrels_b32_e32 v1, v2 ; encoding: [0x02,0x87,0x02,0x7e]
269 // VI: v_movrels_b32_e32 v1, v2 ; encoding: [0x02,0x6f,0x02,0x7e]
272 // SICI: v_movrelsd_b32_e32 v1, v2 ; encoding: [0x02,0x89,0x02,0x7e]
273 // VI: v_movrelsd_b32_e32 v1, v2 ; encoding: [0x02,0x71,0x02,0x7e]
274 v_movrelsd_b32 v1, v2
276 // NOSI: error: instruction not supported on this GPU
277 // NOSI: v_log_legacy_f32 v1, v2
278 // CI: v_log_legacy_f32_e32 v1, v2 ; encoding: [0x02,0x8b,0x02,0x7e]
279 // VI: v_log_legacy_f32_e32 v1, v2 ; encoding: [0x02,0x99,0x02,0x7e]
280 v_log_legacy_f32 v1, v2
282 // NOSI: error: instruction not supported on this GPU
283 // NOSI: v_exp_legacy_f32 v1, v2
284 // CI: v_exp_legacy_f32_e32 v1, v2 ; encoding: [0x02,0x8d,0x02,0x7e]
285 // VI: v_exp_legacy_f32_e32 v1, v2 ; encoding: [0x02,0x97,0x02,0x7e]
286 v_exp_legacy_f32 v1, v2
288 // NOSICI: error: instruction not supported on this GPU
289 // NOSICI: v_cvt_f16_u16 v1, v2
290 // VI: v_cvt_f16_u16_e32 v1, v2 ; encoding: [0x02,0x73,0x02,0x7e]
293 // NOSICI: error: instruction not supported on this GPU
294 // NOSICI: v_cvt_f16_i16 v1, v2
295 // VI: v_cvt_f16_i16_e32 v1, v2 ; encoding: [0x02,0x75,0x02,0x7e]
298 // NOSICI: error: instruction not supported on this GPU
299 // NOSICI: v_cvt_u16_f16 v1, v2
300 // VI: v_cvt_u16_f16_e32 v1, v2 ; encoding: [0x02,0x77,0x02,0x7e]
303 // NOSICI: error: instruction not supported on this GPU
304 // NOSICI: v_cvt_i16_f16 v1, v2
305 // VI: v_cvt_i16_f16_e32 v1, v2 ; encoding: [0x02,0x79,0x02,0x7e]
308 // NOSICI: error: instruction not supported on this GPU
309 // NOSICI: v_rcp_f16 v1, v2
310 // VI: v_rcp_f16_e32 v1, v2 ; encoding: [0x02,0x7b,0x02,0x7e]
313 // NOSICI: error: instruction not supported on this GPU
314 // NOSICI: v_sqrt_f16 v1, v2
315 // VI: v_sqrt_f16_e32 v1, v2 ; encoding: [0x02,0x7d,0x02,0x7e]
318 // NOSICI: error: instruction not supported on this GPU
319 // NOSICI: v_rsq_f16 v1, v2
320 // VI: v_rsq_f16_e32 v1, v2 ; encoding: [0x02,0x7f,0x02,0x7e]
323 // NOSICI: error: instruction not supported on this GPU
324 // NOSICI: v_log_f16 v1, v2
325 // VI: v_log_f16_e32 v1, v2 ; encoding: [0x02,0x81,0x02,0x7e]
328 // NOSICI: error: instruction not supported on this GPU
329 // NOSICI: v_exp_f16 v1, v2
330 // VI: v_exp_f16_e32 v1, v2 ; encoding: [0x02,0x83,0x02,0x7e]
333 // NOSICI: error: instruction not supported on this GPU
334 // NOSICI: v_frexp_mant_f16 v1, v2
335 // VI: v_frexp_mant_f16_e32 v1, v2 ; encoding: [0x02,0x85,0x02,0x7e]
336 v_frexp_mant_f16 v1, v2
338 // NOSICI: error: instruction not supported on this GPU
339 // NOSICI: v_frexp_exp_i16_f16 v1, v2
340 // VI: v_frexp_exp_i16_f16_e32 v1, v2 ; encoding: [0x02,0x87,0x02,0x7e]
341 v_frexp_exp_i16_f16 v1, v2
343 // NOSICI: error: instruction not supported on this GPU
344 // NOSICI: v_floor_f16 v1, v2
345 // VI: v_floor_f16_e32 v1, v2 ; encoding: [0x02,0x89,0x02,0x7e]
348 // NOSICI: error: instruction not supported on this GPU
349 // NOSICI: v_ceil_f16 v1, v2
350 // VI: v_ceil_f16_e32 v1, v2 ; encoding: [0x02,0x8b,0x02,0x7e]
353 // NOSICI: error: instruction not supported on this GPU
354 // NOSICI: v_trunc_f16 v1, v2
355 // VI: v_trunc_f16_e32 v1, v2 ; encoding: [0x02,0x8d,0x02,0x7e]
358 // NOSICI: error: instruction not supported on this GPU
359 // NOSICI: v_rndne_f16 v1, v2
360 // VI: v_rndne_f16_e32 v1, v2 ; encoding: [0x02,0x8f,0x02,0x7e]
363 // NOSICI: error: instruction not supported on this GPU
364 // NOSICI: v_fract_f16 v1, v2
365 // VI: v_fract_f16_e32 v1, v2 ; encoding: [0x02,0x91,0x02,0x7e]
368 // NOSICI: error: instruction not supported on this GPU
369 // NOSICI: v_sin_f16 v1, v2
370 // VI: v_sin_f16_e32 v1, v2 ; encoding: [0x02,0x93,0x02,0x7e]
373 // NOSICI: error: instruction not supported on this GPU
374 // NOSICI: v_cos_f16 v1, v2
375 // VI: v_cos_f16_e32 v1, v2 ; encoding: [0x02,0x95,0x02,0x7e]