• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
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
5
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
10
11// Force 32-bit encoding
12
13// GCN: v_mov_b32_e32 v1, v2 ; encoding: [0x02,0x03,0x02,0x7e]
14v_mov_b32_e32 v1, v2
15
16// Force 32-bit encoding for special instructions
17// FIXME: We should be printing _e32 suffixes for these:
18
19// GCN: v_nop ; encoding: [0x00,0x00,0x00,0x7e]
20v_nop_e32
21
22// SICI: v_clrexcp ; encoding: [0x00,0x82,0x00,0x7e]
23// VI:   v_clrexcp ; encoding: [0x00,0x6a,0x00,0x7e]
24v_clrexcp_e32
25
26//===----------------------------------------------------------------------===//
27// Instructions
28//===----------------------------------------------------------------------===//
29
30
31// GCN: v_nop ; encoding: [0x00,0x00,0x00,0x7e]
32v_nop
33
34// GCN: v_mov_b32_e32 v1, v2 ; encoding: [0x02,0x03,0x02,0x7e]
35v_mov_b32 v1, v2
36
37// GCN: v_readfirstlane_b32 s1, v2 ; encoding: [0x02,0x05,0x02,0x7e]
38v_readfirstlane_b32 s1, v2
39
40// GCN: v_cvt_i32_f64_e32 v1, v[2:3] ; encoding: [0x02,0x07,0x02,0x7e]
41v_cvt_i32_f64 v1, v[2:3]
42
43// GCN: v_cvt_f64_i32_e32 v[1:2], v2 ; encoding: [0x02,0x09,0x02,0x7e]
44v_cvt_f64_i32 v[1:2], v2
45
46// GCN: v_cvt_f32_i32_e32 v1, v2 ; encoding: [0x02,0x0b,0x02,0x7e]
47v_cvt_f32_i32 v1, v2
48
49// GCN: v_cvt_f32_u32_e32 v1, v2 ; encoding: [0x02,0x0d,0x02,0x7e]
50v_cvt_f32_u32 v1, v2
51
52// GCN: v_cvt_u32_f32_e32 v1, v2 ; encoding: [0x02,0x0f,0x02,0x7e
53v_cvt_u32_f32 v1, v2
54
55// GCN: v_cvt_i32_f32_e32 v1, v2 ; encoding: [0x02,0x11,0x02,0x7e]
56v_cvt_i32_f32 v1, v2
57
58// SICI: v_mov_fed_b32_e32 v1, v2 ; encoding: [0x02,0x13,0x02,0x7e]
59// NOVI: error: instruction not supported on this GPU
60v_mov_fed_b32 v1, v2
61
62// GCN: v_cvt_f16_f32_e32 v1, v2 ; encoding: [0x02,0x15,0x02,0x7e]
63v_cvt_f16_f32 v1, v2
64
65// GCN: v_cvt_f32_f16_e32 v1, v2 ; encoding: [0x02,0x17,0x02,0x7e]
66v_cvt_f32_f16 v1, v2
67
68// GCN: v_cvt_rpi_i32_f32_e32 v1, v2 ; encoding: [0x02,0x19,0x02,0x7e]
69v_cvt_rpi_i32_f32 v1, v2
70
71// GCN: v_cvt_flr_i32_f32_e32 v1, v2 ; encoding: [0x02,0x1b,0x02,0x7e]
72v_cvt_flr_i32_f32 v1, v2
73
74// GCN: v_cvt_off_f32_i4_e32 v1, v2 ; encoding: [0x02,0x1d,0x02,0x7e]
75v_cvt_off_f32_i4_e32 v1, v2
76
77// GCN: v_cvt_f32_f64_e32 v1, v[2:3] ; encoding: [0x02,0x1f,0x02,0x7e]
78v_cvt_f32_f64 v1, v[2:3]
79
80// GCN: v_cvt_f64_f32_e32 v[1:2], v2 ; encoding: [0x02,0x21,0x02,0x7e]
81v_cvt_f64_f32 v[1:2], v2
82
83// GCN: v_cvt_f32_ubyte0_e32 v1, v2 ; encoding: [0x02,0x23,0x02,0x7e]
84v_cvt_f32_ubyte0 v1, v2
85
86// GCN: v_cvt_f32_ubyte1_e32 v1, v2 ; encoding: [0x02,0x25,0x02,0x7e]
87v_cvt_f32_ubyte1_e32 v1, v2
88
89// GCN: v_cvt_f32_ubyte2_e32 v1, v2 ; encoding: [0x02,0x27,0x02,0x7e]
90v_cvt_f32_ubyte2 v1, v2
91
92// GCN: v_cvt_f32_ubyte3_e32 v1, v2 ; encoding: [0x02,0x29,0x02,0x7e]
93v_cvt_f32_ubyte3 v1, v2
94
95// GCN: v_cvt_u32_f64_e32 v1, v[2:3] ; encoding: [0x02,0x2b,0x02,0x7e]
96v_cvt_u32_f64 v1, v[2:3]
97
98// GCN: v_cvt_f64_u32_e32 v[1:2], v2 ; encoding: [0x02,0x2d,0x02,0x7e]
99v_cvt_f64_u32 v[1:2], v2
100
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]
104v_trunc_f64_e32 v[1:2], v[2:3]
105
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]
109v_ceil_f64_e32 v[1:2], v[2:3]
110
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]
114v_rndne_f64_e32 v[1:2], v[2:3]
115
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]
119v_floor_f64_e32 v[1:2], v[2:3]
120
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]
123v_fract_f32 v1, v2
124
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]
127v_trunc_f32 v1, v2
128
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]
131v_ceil_f32 v1, v2
132
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]
135v_rndne_f32 v1, v2
136
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]
139v_floor_f32_e32 v1, v2
140
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]
143v_exp_f32 v1, v2
144
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
148v_log_clamp_f32 v1, v2
149
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]
152v_log_f32 v1, v2
153
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
157v_rcp_clamp_f32 v1, v2
158
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
162v_rcp_legacy_f32 v1, v2
163
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]
166v_rcp_f32 v1, v2
167
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]
170v_rcp_iflag_f32 v1, v2
171
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
175v_rsq_clamp_f32 v1, v2
176
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
180v_rsq_legacy_f32 v1, v2
181
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]
184v_rsq_f32_e32 v1, v2
185
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]
188v_rcp_f64 v[1:2], v[2:3]
189
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]
193v_rcp_clamp_f64 v[1:2], v[2:3]
194
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]
197v_rsq_f64 v[1:2], v[2:3]
198
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]
202v_rsq_clamp_f64 v[1:2], v[2:3]
203
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]
206v_sqrt_f32 v1, v2
207
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]
210v_sqrt_f64 v[1:2], v[2:3]
211
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]
214v_sin_f32 v1, v2
215
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]
218v_cos_f32 v1, v2
219
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]
222v_not_b32 v1, v2
223
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]
226v_bfrev_b32 v1, v2
227
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]
230v_ffbh_u32 v1, v2
231
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]
234v_ffbl_b32 v1, v2
235
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]
238v_ffbh_i32_e32 v1, v2
239
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]
242v_frexp_exp_i32_f64 v1, v[2:3]
243
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]
246v_frexp_mant_f64 v[1:2], v[2:3]
247
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]
250v_fract_f64 v[1:2], v[2:3]
251
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]
254v_frexp_exp_i32_f32 v1, v2
255
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]
258v_frexp_mant_f32 v1, v2
259
260// SICI: v_clrexcp ; encoding: [0x00,0x82,0x00,0x7e]
261// VI:   v_clrexcp ; encoding: [0x00,0x6a,0x00,0x7e]
262v_clrexcp
263
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]
266v_movreld_b32 v1, v2
267
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]
270v_movrels_b32 v1, v2
271
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]
274v_movrelsd_b32 v1, v2
275
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]
280v_log_legacy_f32 v1, v2
281
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]
286v_exp_legacy_f32 v1, v2
287
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]
291v_cvt_f16_u16 v1, v2
292
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]
296v_cvt_f16_i16 v1, v2
297
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]
301v_cvt_u16_f16 v1, v2
302
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]
306v_cvt_i16_f16 v1, v2
307
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]
311v_rcp_f16 v1, v2
312
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]
316v_sqrt_f16 v1, v2
317
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]
321v_rsq_f16 v1, v2
322
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]
326v_log_f16 v1, v2
327
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]
331v_exp_f16 v1, v2
332
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]
336v_frexp_mant_f16 v1, v2
337
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]
341v_frexp_exp_i16_f16 v1, v2
342
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]
346v_floor_f16 v1, v2
347
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]
351v_ceil_f16 v1, v2
352
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]
356v_trunc_f16 v1, v2
357
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]
361v_rndne_f16 v1, v2
362
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]
366v_fract_f16 v1, v2
367
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]
371v_sin_f16 v1, v2
372
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]
376v_cos_f16 v1, v2
377