cpu-ia64-opc.c revision 1.1 1 1.1 christos /* Copyright 1998, 1999, 2000, 2001, 2002, 2003, 2005, 2006, 2007, 2009
2 1.1 christos Free Software Foundation, Inc.
3 1.1 christos Contributed by David Mosberger-Tang <davidm (at) hpl.hp.com>
4 1.1 christos
5 1.1 christos This file is part of BFD, the Binary File Descriptor library.
6 1.1 christos
7 1.1 christos This program is free software; you can redistribute it and/or modify
8 1.1 christos it under the terms of the GNU General Public License as published by
9 1.1 christos the Free Software Foundation; either version 3 of the License, or
10 1.1 christos (at your option) any later version.
11 1.1 christos
12 1.1 christos This program is distributed in the hope that it will be useful,
13 1.1 christos but WITHOUT ANY WARRANTY; without even the implied warranty of
14 1.1 christos MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 1.1 christos GNU General Public License for more details.
16 1.1 christos
17 1.1 christos You should have received a copy of the GNU General Public License
18 1.1 christos along with this program; if not, write to the Free Software
19 1.1 christos Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20 1.1 christos MA 02110-1301, USA. */
21 1.1 christos
22 1.1 christos /* Logically, this code should be part of libopcode but since some of
23 1.1 christos the operand insertion/extraction functions help bfd to implement
24 1.1 christos relocations, this code is included as part of cpu-ia64.c. This
25 1.1 christos avoids circular dependencies between libopcode and libbfd and also
26 1.1 christos obviates the need for applications to link in libopcode when all
27 1.1 christos they really want is libbfd.
28 1.1 christos
29 1.1 christos --davidm Mon Apr 13 22:14:02 1998 */
30 1.1 christos
31 1.1 christos #include "../opcodes/ia64-opc.h"
32 1.1 christos
33 1.1 christos #define NELEMS(a) ((int) (sizeof (a) / sizeof ((a)[0])))
34 1.1 christos
35 1.1 christos static const char*
36 1.1 christos ins_rsvd (const struct ia64_operand *self ATTRIBUTE_UNUSED,
37 1.1 christos ia64_insn value ATTRIBUTE_UNUSED, ia64_insn *code ATTRIBUTE_UNUSED)
38 1.1 christos {
39 1.1 christos return "internal error---this shouldn't happen";
40 1.1 christos }
41 1.1 christos
42 1.1 christos static const char*
43 1.1 christos ext_rsvd (const struct ia64_operand *self ATTRIBUTE_UNUSED,
44 1.1 christos ia64_insn code ATTRIBUTE_UNUSED, ia64_insn *valuep ATTRIBUTE_UNUSED)
45 1.1 christos {
46 1.1 christos return "internal error---this shouldn't happen";
47 1.1 christos }
48 1.1 christos
49 1.1 christos static const char*
50 1.1 christos ins_const (const struct ia64_operand *self ATTRIBUTE_UNUSED,
51 1.1 christos ia64_insn value ATTRIBUTE_UNUSED, ia64_insn *code ATTRIBUTE_UNUSED)
52 1.1 christos {
53 1.1 christos return 0;
54 1.1 christos }
55 1.1 christos
56 1.1 christos static const char*
57 1.1 christos ext_const (const struct ia64_operand *self ATTRIBUTE_UNUSED,
58 1.1 christos ia64_insn code ATTRIBUTE_UNUSED, ia64_insn *valuep ATTRIBUTE_UNUSED)
59 1.1 christos {
60 1.1 christos return 0;
61 1.1 christos }
62 1.1 christos
63 1.1 christos static const char*
64 1.1 christos ins_reg (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
65 1.1 christos {
66 1.1 christos if (value >= 1u << self->field[0].bits)
67 1.1 christos return "register number out of range";
68 1.1 christos
69 1.1 christos *code |= value << self->field[0].shift;
70 1.1 christos return 0;
71 1.1 christos }
72 1.1 christos
73 1.1 christos static const char*
74 1.1 christos ext_reg (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
75 1.1 christos {
76 1.1 christos *valuep = ((code >> self->field[0].shift)
77 1.1 christos & ((1u << self->field[0].bits) - 1));
78 1.1 christos return 0;
79 1.1 christos }
80 1.1 christos
81 1.1 christos static const char*
82 1.1 christos ins_immu (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
83 1.1 christos {
84 1.1 christos ia64_insn new_insn = 0;
85 1.1 christos int i;
86 1.1 christos
87 1.1 christos for (i = 0; i < NELEMS (self->field) && self->field[i].bits; ++i)
88 1.1 christos {
89 1.1 christos new_insn |= ((value & ((((ia64_insn) 1) << self->field[i].bits) - 1))
90 1.1 christos << self->field[i].shift);
91 1.1 christos value >>= self->field[i].bits;
92 1.1 christos }
93 1.1 christos if (value)
94 1.1 christos return "integer operand out of range";
95 1.1 christos
96 1.1 christos *code |= new_insn;
97 1.1 christos return 0;
98 1.1 christos }
99 1.1 christos
100 1.1 christos static const char*
101 1.1 christos ext_immu (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
102 1.1 christos {
103 1.1 christos BFD_HOST_U_64_BIT value = 0;
104 1.1 christos int i, bits = 0, total = 0;
105 1.1 christos
106 1.1 christos for (i = 0; i < NELEMS (self->field) && self->field[i].bits; ++i)
107 1.1 christos {
108 1.1 christos bits = self->field[i].bits;
109 1.1 christos value |= ((code >> self->field[i].shift)
110 1.1 christos & ((((BFD_HOST_U_64_BIT) 1) << bits) - 1)) << total;
111 1.1 christos total += bits;
112 1.1 christos }
113 1.1 christos *valuep = value;
114 1.1 christos return 0;
115 1.1 christos }
116 1.1 christos
117 1.1 christos static const char*
118 1.1 christos ins_immu5b (const struct ia64_operand *self, ia64_insn value,
119 1.1 christos ia64_insn *code)
120 1.1 christos {
121 1.1 christos if (value < 32 || value > 63)
122 1.1 christos return "value must be between 32 and 63";
123 1.1 christos return ins_immu (self, value - 32, code);
124 1.1 christos }
125 1.1 christos
126 1.1 christos static const char*
127 1.1 christos ext_immu5b (const struct ia64_operand *self, ia64_insn code,
128 1.1 christos ia64_insn *valuep)
129 1.1 christos {
130 1.1 christos const char *result;
131 1.1 christos
132 1.1 christos result = ext_immu (self, code, valuep);
133 1.1 christos if (result)
134 1.1 christos return result;
135 1.1 christos
136 1.1 christos *valuep = *valuep + 32;
137 1.1 christos return 0;
138 1.1 christos }
139 1.1 christos
140 1.1 christos static const char*
141 1.1 christos ins_immus8 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
142 1.1 christos {
143 1.1 christos if (value & 0x7)
144 1.1 christos return "value not an integer multiple of 8";
145 1.1 christos return ins_immu (self, value >> 3, code);
146 1.1 christos }
147 1.1 christos
148 1.1 christos static const char*
149 1.1 christos ext_immus8 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
150 1.1 christos {
151 1.1 christos const char *result;
152 1.1 christos
153 1.1 christos result = ext_immu (self, code, valuep);
154 1.1 christos if (result)
155 1.1 christos return result;
156 1.1 christos
157 1.1 christos *valuep = *valuep << 3;
158 1.1 christos return 0;
159 1.1 christos }
160 1.1 christos
161 1.1 christos static const char*
162 1.1 christos ins_imms_scaled (const struct ia64_operand *self, ia64_insn value,
163 1.1 christos ia64_insn *code, int scale)
164 1.1 christos {
165 1.1 christos BFD_HOST_64_BIT svalue = value, sign_bit = 0;
166 1.1 christos ia64_insn new_insn = 0;
167 1.1 christos int i;
168 1.1 christos
169 1.1 christos svalue >>= scale;
170 1.1 christos
171 1.1 christos for (i = 0; i < NELEMS (self->field) && self->field[i].bits; ++i)
172 1.1 christos {
173 1.1 christos new_insn |= ((svalue & ((((ia64_insn) 1) << self->field[i].bits) - 1))
174 1.1 christos << self->field[i].shift);
175 1.1 christos sign_bit = (svalue >> (self->field[i].bits - 1)) & 1;
176 1.1 christos svalue >>= self->field[i].bits;
177 1.1 christos }
178 1.1 christos if ((!sign_bit && svalue != 0) || (sign_bit && svalue != -1))
179 1.1 christos return "integer operand out of range";
180 1.1 christos
181 1.1 christos *code |= new_insn;
182 1.1 christos return 0;
183 1.1 christos }
184 1.1 christos
185 1.1 christos static const char*
186 1.1 christos ext_imms_scaled (const struct ia64_operand *self, ia64_insn code,
187 1.1 christos ia64_insn *valuep, int scale)
188 1.1 christos {
189 1.1 christos int i, bits = 0, total = 0;
190 1.1 christos BFD_HOST_64_BIT val = 0, sign;
191 1.1 christos
192 1.1 christos for (i = 0; i < NELEMS (self->field) && self->field[i].bits; ++i)
193 1.1 christos {
194 1.1 christos bits = self->field[i].bits;
195 1.1 christos val |= ((code >> self->field[i].shift)
196 1.1 christos & ((((BFD_HOST_U_64_BIT) 1) << bits) - 1)) << total;
197 1.1 christos total += bits;
198 1.1 christos }
199 1.1 christos /* sign extend: */
200 1.1 christos sign = (BFD_HOST_64_BIT) 1 << (total - 1);
201 1.1 christos val = (val ^ sign) - sign;
202 1.1 christos
203 1.1 christos *valuep = (val << scale);
204 1.1 christos return 0;
205 1.1 christos }
206 1.1 christos
207 1.1 christos static const char*
208 1.1 christos ins_imms (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
209 1.1 christos {
210 1.1 christos return ins_imms_scaled (self, value, code, 0);
211 1.1 christos }
212 1.1 christos
213 1.1 christos static const char*
214 1.1 christos ins_immsu4 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
215 1.1 christos {
216 1.1 christos value = ((value & 0xffffffff) ^ 0x80000000) - 0x80000000;
217 1.1 christos
218 1.1 christos return ins_imms_scaled (self, value, code, 0);
219 1.1 christos }
220 1.1 christos
221 1.1 christos static const char*
222 1.1 christos ext_imms (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
223 1.1 christos {
224 1.1 christos return ext_imms_scaled (self, code, valuep, 0);
225 1.1 christos }
226 1.1 christos
227 1.1 christos static const char*
228 1.1 christos ins_immsm1 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
229 1.1 christos {
230 1.1 christos --value;
231 1.1 christos return ins_imms_scaled (self, value, code, 0);
232 1.1 christos }
233 1.1 christos
234 1.1 christos static const char*
235 1.1 christos ins_immsm1u4 (const struct ia64_operand *self, ia64_insn value,
236 1.1 christos ia64_insn *code)
237 1.1 christos {
238 1.1 christos value = ((value & 0xffffffff) ^ 0x80000000) - 0x80000000;
239 1.1 christos
240 1.1 christos --value;
241 1.1 christos return ins_imms_scaled (self, value, code, 0);
242 1.1 christos }
243 1.1 christos
244 1.1 christos static const char*
245 1.1 christos ext_immsm1 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
246 1.1 christos {
247 1.1 christos const char *res = ext_imms_scaled (self, code, valuep, 0);
248 1.1 christos
249 1.1 christos ++*valuep;
250 1.1 christos return res;
251 1.1 christos }
252 1.1 christos
253 1.1 christos static const char*
254 1.1 christos ins_imms1 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
255 1.1 christos {
256 1.1 christos return ins_imms_scaled (self, value, code, 1);
257 1.1 christos }
258 1.1 christos
259 1.1 christos static const char*
260 1.1 christos ext_imms1 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
261 1.1 christos {
262 1.1 christos return ext_imms_scaled (self, code, valuep, 1);
263 1.1 christos }
264 1.1 christos
265 1.1 christos static const char*
266 1.1 christos ins_imms4 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
267 1.1 christos {
268 1.1 christos return ins_imms_scaled (self, value, code, 4);
269 1.1 christos }
270 1.1 christos
271 1.1 christos static const char*
272 1.1 christos ext_imms4 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
273 1.1 christos {
274 1.1 christos return ext_imms_scaled (self, code, valuep, 4);
275 1.1 christos }
276 1.1 christos
277 1.1 christos static const char*
278 1.1 christos ins_imms16 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
279 1.1 christos {
280 1.1 christos return ins_imms_scaled (self, value, code, 16);
281 1.1 christos }
282 1.1 christos
283 1.1 christos static const char*
284 1.1 christos ext_imms16 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
285 1.1 christos {
286 1.1 christos return ext_imms_scaled (self, code, valuep, 16);
287 1.1 christos }
288 1.1 christos
289 1.1 christos static const char*
290 1.1 christos ins_cimmu (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
291 1.1 christos {
292 1.1 christos ia64_insn mask = (((ia64_insn) 1) << self->field[0].bits) - 1;
293 1.1 christos return ins_immu (self, value ^ mask, code);
294 1.1 christos }
295 1.1 christos
296 1.1 christos static const char*
297 1.1 christos ext_cimmu (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
298 1.1 christos {
299 1.1 christos const char *result;
300 1.1 christos ia64_insn mask;
301 1.1 christos
302 1.1 christos mask = (((ia64_insn) 1) << self->field[0].bits) - 1;
303 1.1 christos result = ext_immu (self, code, valuep);
304 1.1 christos if (!result)
305 1.1 christos {
306 1.1 christos mask = (((ia64_insn) 1) << self->field[0].bits) - 1;
307 1.1 christos *valuep ^= mask;
308 1.1 christos }
309 1.1 christos return result;
310 1.1 christos }
311 1.1 christos
312 1.1 christos static const char*
313 1.1 christos ins_cnt (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
314 1.1 christos {
315 1.1 christos --value;
316 1.1 christos if (value >= ((BFD_HOST_U_64_BIT) 1) << self->field[0].bits)
317 1.1 christos return "count out of range";
318 1.1 christos
319 1.1 christos *code |= value << self->field[0].shift;
320 1.1 christos return 0;
321 1.1 christos }
322 1.1 christos
323 1.1 christos static const char*
324 1.1 christos ext_cnt (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
325 1.1 christos {
326 1.1 christos *valuep = ((code >> self->field[0].shift)
327 1.1 christos & ((((BFD_HOST_U_64_BIT) 1) << self->field[0].bits) - 1)) + 1;
328 1.1 christos return 0;
329 1.1 christos }
330 1.1 christos
331 1.1 christos static const char*
332 1.1 christos ins_cnt2b (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
333 1.1 christos {
334 1.1 christos --value;
335 1.1 christos
336 1.1 christos if (value > 2)
337 1.1 christos return "count must be in range 1..3";
338 1.1 christos
339 1.1 christos *code |= value << self->field[0].shift;
340 1.1 christos return 0;
341 1.1 christos }
342 1.1 christos
343 1.1 christos static const char*
344 1.1 christos ext_cnt2b (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
345 1.1 christos {
346 1.1 christos *valuep = ((code >> self->field[0].shift) & 0x3) + 1;
347 1.1 christos return 0;
348 1.1 christos }
349 1.1 christos
350 1.1 christos static const char*
351 1.1 christos ins_cnt2c (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
352 1.1 christos {
353 1.1 christos switch (value)
354 1.1 christos {
355 1.1 christos case 0: value = 0; break;
356 1.1 christos case 7: value = 1; break;
357 1.1 christos case 15: value = 2; break;
358 1.1 christos case 16: value = 3; break;
359 1.1 christos default: return "count must be 0, 7, 15, or 16";
360 1.1 christos }
361 1.1 christos *code |= value << self->field[0].shift;
362 1.1 christos return 0;
363 1.1 christos }
364 1.1 christos
365 1.1 christos static const char*
366 1.1 christos ext_cnt2c (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
367 1.1 christos {
368 1.1 christos ia64_insn value;
369 1.1 christos
370 1.1 christos value = (code >> self->field[0].shift) & 0x3;
371 1.1 christos switch (value)
372 1.1 christos {
373 1.1 christos case 0: value = 0; break;
374 1.1 christos case 1: value = 7; break;
375 1.1 christos case 2: value = 15; break;
376 1.1 christos case 3: value = 16; break;
377 1.1 christos }
378 1.1 christos *valuep = value;
379 1.1 christos return 0;
380 1.1 christos }
381 1.1 christos
382 1.1 christos static const char*
383 1.1 christos ins_cnt6a (const struct ia64_operand *self, ia64_insn value,
384 1.1 christos ia64_insn *code)
385 1.1 christos {
386 1.1 christos if (value < 1 || value > 64)
387 1.1 christos return "value must be between 1 and 64";
388 1.1 christos return ins_immu (self, value - 1, code);
389 1.1 christos }
390 1.1 christos
391 1.1 christos static const char*
392 1.1 christos ext_cnt6a (const struct ia64_operand *self, ia64_insn code,
393 1.1 christos ia64_insn *valuep)
394 1.1 christos {
395 1.1 christos const char *result;
396 1.1 christos
397 1.1 christos result = ext_immu (self, code, valuep);
398 1.1 christos if (result)
399 1.1 christos return result;
400 1.1 christos
401 1.1 christos *valuep = *valuep + 1;
402 1.1 christos return 0;
403 1.1 christos }
404 1.1 christos
405 1.1 christos static const char*
406 1.1 christos ins_strd5b (const struct ia64_operand *self, ia64_insn value,
407 1.1 christos ia64_insn *code)
408 1.1 christos {
409 1.1 christos if ( value & 0x3f )
410 1.1 christos return "value must be a multiple of 64";
411 1.1 christos return ins_imms_scaled (self, value, code, 6);
412 1.1 christos }
413 1.1 christos
414 1.1 christos static const char*
415 1.1 christos ext_strd5b (const struct ia64_operand *self, ia64_insn code,
416 1.1 christos ia64_insn *valuep)
417 1.1 christos {
418 1.1 christos return ext_imms_scaled (self, code, valuep, 6);
419 1.1 christos }
420 1.1 christos
421 1.1 christos
422 1.1 christos static const char*
423 1.1 christos ins_inc3 (const struct ia64_operand *self, ia64_insn value, ia64_insn *code)
424 1.1 christos {
425 1.1 christos BFD_HOST_64_BIT val = value;
426 1.1 christos BFD_HOST_U_64_BIT sign = 0;
427 1.1 christos
428 1.1 christos if (val < 0)
429 1.1 christos {
430 1.1 christos sign = 0x4;
431 1.1 christos value = -value;
432 1.1 christos }
433 1.1 christos switch (value)
434 1.1 christos {
435 1.1 christos case 1: value = 3; break;
436 1.1 christos case 4: value = 2; break;
437 1.1 christos case 8: value = 1; break;
438 1.1 christos case 16: value = 0; break;
439 1.1 christos default: return "count must be +/- 1, 4, 8, or 16";
440 1.1 christos }
441 1.1 christos *code |= (sign | value) << self->field[0].shift;
442 1.1 christos return 0;
443 1.1 christos }
444 1.1 christos
445 1.1 christos static const char*
446 1.1 christos ext_inc3 (const struct ia64_operand *self, ia64_insn code, ia64_insn *valuep)
447 1.1 christos {
448 1.1 christos BFD_HOST_64_BIT val;
449 1.1 christos int negate;
450 1.1 christos
451 1.1 christos val = (code >> self->field[0].shift) & 0x7;
452 1.1 christos negate = val & 0x4;
453 1.1 christos switch (val & 0x3)
454 1.1 christos {
455 1.1 christos case 0: val = 16; break;
456 1.1 christos case 1: val = 8; break;
457 1.1 christos case 2: val = 4; break;
458 1.1 christos case 3: val = 1; break;
459 1.1 christos }
460 1.1 christos if (negate)
461 1.1 christos val = -val;
462 1.1 christos
463 1.1 christos *valuep = val;
464 1.1 christos return 0;
465 1.1 christos }
466 1.1 christos
467 1.1 christos #define CST IA64_OPND_CLASS_CST
468 1.1 christos #define REG IA64_OPND_CLASS_REG
469 1.1 christos #define IND IA64_OPND_CLASS_IND
470 1.1 christos #define ABS IA64_OPND_CLASS_ABS
471 1.1 christos #define REL IA64_OPND_CLASS_REL
472 1.1 christos
473 1.1 christos #define SDEC IA64_OPND_FLAG_DECIMAL_SIGNED
474 1.1 christos #define UDEC IA64_OPND_FLAG_DECIMAL_UNSIGNED
475 1.1 christos
476 1.1 christos const struct ia64_operand elf64_ia64_operands[IA64_OPND_COUNT] =
477 1.1 christos {
478 1.1 christos /* constants: */
479 1.1 christos { CST, ins_const, ext_const, "NIL", {{ 0, 0}}, 0, "<none>" },
480 1.1 christos { CST, ins_const, ext_const, "ar.csd", {{ 0, 0}}, 0, "ar.csd" },
481 1.1 christos { CST, ins_const, ext_const, "ar.ccv", {{ 0, 0}}, 0, "ar.ccv" },
482 1.1 christos { CST, ins_const, ext_const, "ar.pfs", {{ 0, 0}}, 0, "ar.pfs" },
483 1.1 christos { CST, ins_const, ext_const, "1", {{ 0, 0}}, 0, "1" },
484 1.1 christos { CST, ins_const, ext_const, "8", {{ 0, 0}}, 0, "8" },
485 1.1 christos { CST, ins_const, ext_const, "16", {{ 0, 0}}, 0, "16" },
486 1.1 christos { CST, ins_const, ext_const, "r0", {{ 0, 0}}, 0, "r0" },
487 1.1 christos { CST, ins_const, ext_const, "ip", {{ 0, 0}}, 0, "ip" },
488 1.1 christos { CST, ins_const, ext_const, "pr", {{ 0, 0}}, 0, "pr" },
489 1.1 christos { CST, ins_const, ext_const, "pr.rot", {{ 0, 0}}, 0, "pr.rot" },
490 1.1 christos { CST, ins_const, ext_const, "psr", {{ 0, 0}}, 0, "psr" },
491 1.1 christos { CST, ins_const, ext_const, "psr.l", {{ 0, 0}}, 0, "psr.l" },
492 1.1 christos { CST, ins_const, ext_const, "psr.um", {{ 0, 0}}, 0, "psr.um" },
493 1.1 christos
494 1.1 christos /* register operands: */
495 1.1 christos { REG, ins_reg, ext_reg, "ar", {{ 7, 20}}, 0, /* AR3 */
496 1.1 christos "an application register" },
497 1.1 christos { REG, ins_reg, ext_reg, "b", {{ 3, 6}}, 0, /* B1 */
498 1.1 christos "a branch register" },
499 1.1 christos { REG, ins_reg, ext_reg, "b", {{ 3, 13}}, 0, /* B2 */
500 1.1 christos "a branch register"},
501 1.1 christos { REG, ins_reg, ext_reg, "cr", {{ 7, 20}}, 0, /* CR */
502 1.1 christos "a control register"},
503 1.1 christos { REG, ins_reg, ext_reg, "f", {{ 7, 6}}, 0, /* F1 */
504 1.1 christos "a floating-point register" },
505 1.1 christos { REG, ins_reg, ext_reg, "f", {{ 7, 13}}, 0, /* F2 */
506 1.1 christos "a floating-point register" },
507 1.1 christos { REG, ins_reg, ext_reg, "f", {{ 7, 20}}, 0, /* F3 */
508 1.1 christos "a floating-point register" },
509 1.1 christos { REG, ins_reg, ext_reg, "f", {{ 7, 27}}, 0, /* F4 */
510 1.1 christos "a floating-point register" },
511 1.1 christos { REG, ins_reg, ext_reg, "p", {{ 6, 6}}, 0, /* P1 */
512 1.1 christos "a predicate register" },
513 1.1 christos { REG, ins_reg, ext_reg, "p", {{ 6, 27}}, 0, /* P2 */
514 1.1 christos "a predicate register" },
515 1.1 christos { REG, ins_reg, ext_reg, "r", {{ 7, 6}}, 0, /* R1 */
516 1.1 christos "a general register" },
517 1.1 christos { REG, ins_reg, ext_reg, "r", {{ 7, 13}}, 0, /* R2 */
518 1.1 christos "a general register" },
519 1.1 christos { REG, ins_reg, ext_reg, "r", {{ 7, 20}}, 0, /* R3 */
520 1.1 christos "a general register" },
521 1.1 christos { REG, ins_reg, ext_reg, "r", {{ 2, 20}}, 0, /* R3_2 */
522 1.1 christos "a general register r0-r3" },
523 1.1 christos { REG, ins_reg, ext_reg, "dahr", {{ 3, 23}}, 0, /* DAHR */
524 1.1 christos "a dahr register dahr0-7" },
525 1.1 christos
526 1.1 christos /* memory operands: */
527 1.1 christos { IND, ins_reg, ext_reg, "", {{7, 20}}, 0, /* MR3 */
528 1.1 christos "a memory address" },
529 1.1 christos
530 1.1 christos /* indirect operands: */
531 1.1 christos { IND, ins_reg, ext_reg, "cpuid", {{7, 20}}, 0, /* CPUID_R3 */
532 1.1 christos "a cpuid register" },
533 1.1 christos { IND, ins_reg, ext_reg, "dbr", {{7, 20}}, 0, /* DBR_R3 */
534 1.1 christos "a dbr register" },
535 1.1 christos { IND, ins_reg, ext_reg, "dtr", {{7, 20}}, 0, /* DTR_R3 */
536 1.1 christos "a dtr register" },
537 1.1 christos { IND, ins_reg, ext_reg, "itr", {{7, 20}}, 0, /* ITR_R3 */
538 1.1 christos "an itr register" },
539 1.1 christos { IND, ins_reg, ext_reg, "ibr", {{7, 20}}, 0, /* IBR_R3 */
540 1.1 christos "an ibr register" },
541 1.1 christos { IND, ins_reg, ext_reg, "msr", {{7, 20}}, 0, /* MSR_R3 */
542 1.1 christos "an msr register" },
543 1.1 christos { IND, ins_reg, ext_reg, "pkr", {{7, 20}}, 0, /* PKR_R3 */
544 1.1 christos "a pkr register" },
545 1.1 christos { IND, ins_reg, ext_reg, "pmc", {{7, 20}}, 0, /* PMC_R3 */
546 1.1 christos "a pmc register" },
547 1.1 christos { IND, ins_reg, ext_reg, "pmd", {{7, 20}}, 0, /* PMD_R3 */
548 1.1 christos "a pmd register" },
549 1.1 christos { IND, ins_reg, ext_reg, "dahr", {{7, 20}}, 0, /* DAHR_R3 */
550 1.1 christos "a dahr register" },
551 1.1 christos { IND, ins_reg, ext_reg, "rr", {{7, 20}}, 0, /* RR_R3 */
552 1.1 christos "an rr register" },
553 1.1 christos
554 1.1 christos /* immediate operands: */
555 1.1 christos { ABS, ins_cimmu, ext_cimmu, 0, {{ 5, 20 }}, UDEC, /* CCNT5 */
556 1.1 christos "a 5-bit count (0-31)" },
557 1.1 christos { ABS, ins_cnt, ext_cnt, 0, {{ 2, 27 }}, UDEC, /* CNT2a */
558 1.1 christos "a 2-bit count (1-4)" },
559 1.1 christos { ABS, ins_cnt2b, ext_cnt2b, 0, {{ 2, 27 }}, UDEC, /* CNT2b */
560 1.1 christos "a 2-bit count (1-3)" },
561 1.1 christos { ABS, ins_cnt2c, ext_cnt2c, 0, {{ 2, 30 }}, UDEC, /* CNT2c */
562 1.1 christos "a count (0, 7, 15, or 16)" },
563 1.1 christos { ABS, ins_immu, ext_immu, 0, {{ 5, 14}}, UDEC, /* CNT5 */
564 1.1 christos "a 5-bit count (0-31)" },
565 1.1 christos { ABS, ins_immu, ext_immu, 0, {{ 6, 27}}, UDEC, /* CNT6 */
566 1.1 christos "a 6-bit count (0-63)" },
567 1.1 christos { ABS, ins_cimmu, ext_cimmu, 0, {{ 6, 20}}, UDEC, /* CPOS6a */
568 1.1 christos "a 6-bit bit pos (0-63)" },
569 1.1 christos { ABS, ins_cimmu, ext_cimmu, 0, {{ 6, 14}}, UDEC, /* CPOS6b */
570 1.1 christos "a 6-bit bit pos (0-63)" },
571 1.1 christos { ABS, ins_cimmu, ext_cimmu, 0, {{ 6, 31}}, UDEC, /* CPOS6c */
572 1.1 christos "a 6-bit bit pos (0-63)" },
573 1.1 christos { ABS, ins_imms, ext_imms, 0, {{ 1, 36}}, SDEC, /* IMM1 */
574 1.1 christos "a 1-bit integer (-1, 0)" },
575 1.1 christos { ABS, ins_immu, ext_immu, 0, {{ 2, 13}}, UDEC, /* IMMU2 */
576 1.1 christos "a 2-bit unsigned (0-3)" },
577 1.1 christos { ABS, ins_immu5b, ext_immu5b, 0, {{ 5, 14}}, UDEC, /* IMMU5b */
578 1.1 christos "a 5-bit unsigned (32 + (0-31))" },
579 1.1 christos { ABS, ins_immu, ext_immu, 0, {{ 7, 13}}, 0, /* IMMU7a */
580 1.1 christos "a 7-bit unsigned (0-127)" },
581 1.1 christos { ABS, ins_immu, ext_immu, 0, {{ 7, 20}}, 0, /* IMMU7b */
582 1.1 christos "a 7-bit unsigned (0-127)" },
583 1.1 christos { ABS, ins_immu, ext_immu, 0, {{ 7, 13}}, UDEC, /* SOF */
584 1.1 christos "a frame size (register count)" },
585 1.1 christos { ABS, ins_immu, ext_immu, 0, {{ 7, 20}}, UDEC, /* SOL */
586 1.1 christos "a local register count" },
587 1.1 christos { ABS, ins_immus8,ext_immus8,0, {{ 4, 27}}, UDEC, /* SOR */
588 1.1 christos "a rotating register count (integer multiple of 8)" },
589 1.1 christos { ABS, ins_imms, ext_imms, 0, /* IMM8 */
590 1.1 christos {{ 7, 13}, { 1, 36}}, SDEC,
591 1.1 christos "an 8-bit integer (-128-127)" },
592 1.1 christos { ABS, ins_immsu4, ext_imms, 0, /* IMM8U4 */
593 1.1 christos {{ 7, 13}, { 1, 36}}, SDEC,
594 1.1 christos "an 8-bit signed integer for 32-bit unsigned compare (-128-127)" },
595 1.1 christos { ABS, ins_immsm1, ext_immsm1, 0, /* IMM8M1 */
596 1.1 christos {{ 7, 13}, { 1, 36}}, SDEC,
597 1.1 christos "an 8-bit integer (-127-128)" },
598 1.1 christos { ABS, ins_immsm1u4, ext_immsm1, 0, /* IMM8M1U4 */
599 1.1 christos {{ 7, 13}, { 1, 36}}, SDEC,
600 1.1 christos "an 8-bit integer for 32-bit unsigned compare (-127-(-1),1-128,0x100000000)" },
601 1.1 christos { ABS, ins_immsm1, ext_immsm1, 0, /* IMM8M1U8 */
602 1.1 christos {{ 7, 13}, { 1, 36}}, SDEC,
603 1.1 christos "an 8-bit integer for 64-bit unsigned compare (-127-(-1),1-128,0x10000000000000000)" },
604 1.1 christos { ABS, ins_immu, ext_immu, 0, {{ 2, 33}, { 7, 20}}, 0, /* IMMU9 */
605 1.1 christos "a 9-bit unsigned (0-511)" },
606 1.1 christos { ABS, ins_imms, ext_imms, 0, /* IMM9a */
607 1.1 christos {{ 7, 6}, { 1, 27}, { 1, 36}}, SDEC,
608 1.1 christos "a 9-bit integer (-256-255)" },
609 1.1 christos { ABS, ins_imms, ext_imms, 0, /* IMM9b */
610 1.1 christos {{ 7, 13}, { 1, 27}, { 1, 36}}, SDEC,
611 1.1 christos "a 9-bit integer (-256-255)" },
612 1.1 christos { ABS, ins_imms, ext_imms, 0, /* IMM14 */
613 1.1 christos {{ 7, 13}, { 6, 27}, { 1, 36}}, SDEC,
614 1.1 christos "a 14-bit integer (-8192-8191)" },
615 1.1 christos { ABS, ins_immu, ext_immu, 0, /* IMMU16 */
616 1.1 christos {{4, 6}, {11, 12}, { 1, 36}}, UDEC,
617 1.1 christos "a 16-bit unsigned" },
618 1.1 christos { ABS, ins_imms1, ext_imms1, 0, /* IMM17 */
619 1.1 christos {{ 7, 6}, { 8, 24}, { 1, 36}}, 0,
620 1.1 christos "a 17-bit integer (-65536-65535)" },
621 1.1 christos { ABS, ins_immu, ext_immu, 0, /* IMMU19 */
622 1.1 christos {{4, 6}, {14, 12}, { 1, 36}}, UDEC,
623 1.1 christos "a 19-bit unsigned" },
624 1.1 christos { ABS, ins_immu, ext_immu, 0, {{20, 6}, { 1, 36}}, 0, /* IMMU21 */
625 1.1 christos "a 21-bit unsigned" },
626 1.1 christos { ABS, ins_imms, ext_imms, 0, /* IMM22 */
627 1.1 christos {{ 7, 13}, { 9, 27}, { 5, 22}, { 1, 36}}, SDEC,
628 1.1 christos "a 22-bit signed integer" },
629 1.1 christos { ABS, ins_immu, ext_immu, 0, /* IMMU24 */
630 1.1 christos {{21, 6}, { 2, 31}, { 1, 36}}, 0,
631 1.1 christos "a 24-bit unsigned" },
632 1.1 christos { ABS, ins_imms16,ext_imms16,0, {{27, 6}, { 1, 36}}, 0, /* IMM44 */
633 1.1 christos "a 44-bit unsigned (least 16 bits ignored/zeroes)" },
634 1.1 christos { ABS, ins_rsvd, ext_rsvd, 0, {{0, 0}}, 0, /* IMMU62 */
635 1.1 christos "a 62-bit unsigned" },
636 1.1 christos { ABS, ins_rsvd, ext_rsvd, 0, {{0, 0}}, 0, /* IMMU64 */
637 1.1 christos "a 64-bit unsigned" },
638 1.1 christos { ABS, ins_inc3, ext_inc3, 0, {{ 3, 13}}, SDEC, /* INC3 */
639 1.1 christos "an increment (+/- 1, 4, 8, or 16)" },
640 1.1 christos { ABS, ins_cnt, ext_cnt, 0, {{ 4, 27}}, UDEC, /* LEN4 */
641 1.1 christos "a 4-bit length (1-16)" },
642 1.1 christos { ABS, ins_cnt, ext_cnt, 0, {{ 6, 27}}, UDEC, /* LEN6 */
643 1.1 christos "a 6-bit length (1-64)" },
644 1.1 christos { ABS, ins_immu, ext_immu, 0, {{ 4, 20}}, 0, /* MBTYPE4 */
645 1.1 christos "a mix type (@rev, @mix, @shuf, @alt, or @brcst)" },
646 1.1 christos { ABS, ins_immu, ext_immu, 0, {{ 8, 20}}, 0, /* MBTYPE8 */
647 1.1 christos "an 8-bit mix type" },
648 1.1 christos { ABS, ins_immu, ext_immu, 0, {{ 6, 14}}, UDEC, /* POS6 */
649 1.1 christos "a 6-bit bit pos (0-63)" },
650 1.1 christos { REL, ins_imms4, ext_imms4, 0, {{ 7, 6}, { 2, 33}}, 0, /* TAG13 */
651 1.1 christos "a branch tag" },
652 1.1 christos { REL, ins_imms4, ext_imms4, 0, {{ 9, 24}}, 0, /* TAG13b */
653 1.1 christos "a branch tag" },
654 1.1 christos { REL, ins_imms4, ext_imms4, 0, {{20, 6}, { 1, 36}}, 0, /* TGT25 */
655 1.1 christos "a branch target" },
656 1.1 christos { REL, ins_imms4, ext_imms4, 0, /* TGT25b */
657 1.1 christos {{ 7, 6}, {13, 20}, { 1, 36}}, 0,
658 1.1 christos "a branch target" },
659 1.1 christos { REL, ins_imms4, ext_imms4, 0, {{20, 13}, { 1, 36}}, 0, /* TGT25c */
660 1.1 christos "a branch target" },
661 1.1 christos { REL, ins_rsvd, ext_rsvd, 0, {{0, 0}}, 0, /* TGT64 */
662 1.1 christos "a branch target" },
663 1.1 christos
664 1.1 christos { ABS, ins_const, ext_const, 0, {{0, 0}}, 0, /* LDXMOV */
665 1.1 christos "ldxmov target" },
666 1.1 christos { ABS, ins_cnt6a, ext_cnt6a, 0, {{6, 6}}, UDEC, /* CNT6a */
667 1.1 christos "lfetch count" },
668 1.1 christos { ABS, ins_strd5b, ext_strd5b, 0, {{5, 13}}, SDEC, /* STRD5b*/
669 1.1 christos "lfetch stride" },
670 1.1 christos };
671