* hppa.h (pa_opcodes): Use 'fX' for first register operand
[deliverable/binutils-gdb.git] / opcodes / hppa-dis.c
CommitLineData
252b5132
RH
1/* Disassembler for the PA-RISC. Somewhat derived from sparc-pinsn.c.
2 Copyright 1989, 1990, 1992, 1993 Free Software Foundation, Inc.
3
4 Contributed by the Center for Software Science at the
5 University of Utah (pa-gdb-bugs@cs.utah.edu).
6
7This program is free software; you can redistribute it and/or modify
8it under the terms of the GNU General Public License as published by
9the Free Software Foundation; either version 2 of the License, or
10(at your option) any later version.
11
12This program is distributed in the hope that it will be useful,
13but WITHOUT ANY WARRANTY; without even the implied warranty of
14MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15GNU General Public License for more details.
16
17You should have received a copy of the GNU General Public License
18along with this program; if not, write to the Free Software
19Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
20
21#include <ansidecl.h>
22#include "sysdep.h"
23#include "dis-asm.h"
24#include "libhppa.h"
25#include "opcode/hppa.h"
26
27/* Integer register names, indexed by the numbers which appear in the
28 opcodes. */
29static const char *const reg_names[] =
30 {"flags", "r1", "rp", "r3", "r4", "r5", "r6", "r7", "r8", "r9",
31 "r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19",
32 "r20", "r21", "r22", "r23", "r24", "r25", "r26", "dp", "ret0", "ret1",
33 "sp", "r31"};
34
35/* Floating point register names, indexed by the numbers which appear in the
36 opcodes. */
37static const char *const fp_reg_names[] =
38 {"fpsr", "fpe2", "fpe4", "fpe6",
39 "fr4", "fr5", "fr6", "fr7", "fr8",
40 "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15",
41 "fr16", "fr17", "fr18", "fr19", "fr20", "fr21", "fr22", "fr23",
42 "fr24", "fr25", "fr26", "fr27", "fr28", "fr29", "fr30", "fr31"};
43
44typedef unsigned int CORE_ADDR;
45
46/* Get at various relevent fields of an instruction word. */
47
48#define MASK_5 0x1f
3b67cf2b 49#define MASK_10 0x3ff
252b5132
RH
50#define MASK_11 0x7ff
51#define MASK_14 0x3fff
52#define MASK_21 0x1fffff
53
54/* This macro gets bit fields using HP's numbering (MSB = 0) */
55
56#define GET_FIELD(X, FROM, TO) \
57 ((X) >> (31 - (TO)) & ((1 << ((TO) - (FROM) + 1)) - 1))
58
59/* Some of these have been converted to 2-d arrays because they
60 consume less storage this way. If the maintenance becomes a
61 problem, convert them back to const 1-d pointer arrays. */
58d0c905 62static const char *const control_reg[] = {
252b5132
RH
63 "rctr", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7",
64 "pidr1", "pidr2", "ccr", "sar", "pidr3", "pidr4",
65 "iva", "eiem", "itmr", "pcsq", "pcoq", "iir", "isr",
66 "ior", "ipsw", "eirr", "tr0", "tr1", "tr2", "tr3",
67 "tr4", "tr5", "tr6", "tr7"
68};
69
58d0c905 70static const char *const compare_cond_names[] = {
b333b6c6
JL
71 "", ",=", ",<", ",<=", ",<<", ",<<=", ",sv", ",od",
72 ",tr", ",<>", ",>=", ",>", ",>>=", ",>>", ",nsv", ",ev"
73};
58d0c905 74static const char *const compare_cond_64_names[] = {
b333b6c6
JL
75 "", ",*=", ",*<", ",*<=", ",*<<", ",*<<=", ",*sv", ",*od",
76 ",*tr", ",*<>", ",*>=", ",*>", ",*>>=", ",*>>", ",*nsv", ",*ev"
77};
58d0c905 78static const char *const cmpib_cond_64_names[] = {
b333b6c6 79 ",*<<", ",*=", ",*<", ",*<=", ",*>>=", ",*<>", ",*>=", ",*>"
252b5132 80};
58d0c905 81static const char *const add_cond_names[] = {
b333b6c6
JL
82 "", ",=", ",<", ",<=", ",nuv", ",znv", ",sv", ",od",
83 ",tr", ",<>", ",>=", ",>", ",uv", ",vnz", ",nsv", ",ev"
84};
58d0c905 85static const char *const add_cond_64_names[] = {
d1e9bd1f 86 "", ",*=", ",*<", ",*<=", ",*nuv", ",*znv", ",*sv", ",*od",
b333b6c6
JL
87 ",*tr", ",*<>", ",*>=", ",*>", ",*uv", ",*vnz", ",*nsv", ",*ev"
88};
58d0c905 89static const char *const wide_add_cond_names[] = {
b333b6c6
JL
90 "", ",=", ",<", ",<=", ",nuv", ",*=", ",*<", ",*<=",
91 ",tr", ",<>", ",>=", ",>", ",uv", ",*<>", ",*>=", ",*>"
252b5132
RH
92};
93static const char *const logical_cond_names[] = {
94 "", ",=", ",<", ",<=", 0, 0, 0, ",od",
95 ",tr", ",<>", ",>=", ",>", 0, 0, 0, ",ev"};
b333b6c6 96static const char *const logical_cond_64_names[] = {
d1e9bd1f 97 "", ",*=", ",*<", ",*<=", 0, 0, 0, ",*od",
b333b6c6 98 ",*tr", ",*<>", ",*>=", ",*>", 0, 0, 0, ",*ev"};
252b5132
RH
99static const char *const unit_cond_names[] = {
100 "", 0, ",sbz", ",shz", ",sdc", 0, ",sbc", ",shc",
101 ",tr", 0, ",nbz", ",nhz", ",ndc", 0, ",nbc", ",nhc"
102};
b333b6c6 103static const char *const unit_cond_64_names[] = {
d1e9bd1f 104 "", ",*swz", ",*sbz", ",*shz", ",*sdc", ",*swc", ",*sbc", ",*shc",
b333b6c6
JL
105 ",*tr", ",*nwz", ",*nbz", ",*nhz", ",*ndc", ",*nwc", ",*nbc", ",*nhc"
106};
58d0c905 107static const char *const shift_cond_names[] = {
252b5132
RH
108 "", ",=", ",<", ",od", ",tr", ",<>", ",>=", ",ev"
109};
58d0c905 110static const char *const shift_cond_64_names[] = {
d1e9bd1f 111 "", ",*=", ",*<", ",*od", ",*tr", ",*<>", ",*>=", ",*ev"
b333b6c6 112};
58d0c905 113static const char *const bb_cond_64_names[] = {
b333b6c6
JL
114 ",*<", ",*>="
115};
58d0c905
JL
116static const char *const index_compl_names[] = {"", ",m", ",s", ",sm"};
117static const char *const short_ldst_compl_names[] = {"", ",ma", "", ",mb"};
252b5132
RH
118static const char *const short_bytes_compl_names[] = {
119 "", ",b,m", ",e", ",e,m"
120};
121static const char *const float_format_names[] = {",sgl", ",dbl", "", ",quad"};
58d0c905 122static const char *const float_comp_names[] =
252b5132
RH
123{
124 ",false?", ",false", ",?", ",!<=>", ",=", ",=t", ",?=", ",!<>",
125 ",!?>=", ",<", ",?<", ",!>=", ",!?>", ",<=", ",?<=", ",!>",
126 ",!?<=", ",>", ",?>", ",!<=", ",!?<", ",>=", ",?>=", ",!<",
127 ",!?=", ",<>", ",!=", ",!=t", ",!?", ",<=>", ",true?", ",true"
128};
58d0c905
JL
129static const char *const signed_unsigned_names[] = {",u", ",s"};
130static const char *const mix_half_names[] = {",l", ",r"};
131static const char *const saturation_names[] = {",us", ",ss", 0, ""};
132static const char *const read_write_names[] = {",r", ",w"};
133static const char *const add_compl_names[] = { 0, "", ",l", ",tsv" };
252b5132
RH
134
135/* For a bunch of different instructions form an index into a
136 completer name table. */
137#define GET_COMPL(insn) (GET_FIELD (insn, 26, 26) | \
138 GET_FIELD (insn, 18, 18) << 1)
139
140#define GET_COND(insn) (GET_FIELD ((insn), 16, 18) + \
141 (GET_FIELD ((insn), 19, 19) ? 8 : 0))
142
143/* Utility function to print registers. Put these first, so gcc's function
144 inlining can do its stuff. */
145
146#define fputs_filtered(STR,F) (*info->fprintf_func) (info->stream, "%s", STR)
147
148static void
149fput_reg (reg, info)
150 unsigned reg;
151 disassemble_info *info;
152{
153 (*info->fprintf_func) (info->stream, reg ? reg_names[reg] : "r0");
154}
155
156static void
157fput_fp_reg (reg, info)
158 unsigned reg;
159 disassemble_info *info;
160{
161 (*info->fprintf_func) (info->stream, reg ? fp_reg_names[reg] : "fr0");
162}
163
164static void
165fput_fp_reg_r (reg, info)
166 unsigned reg;
167 disassemble_info *info;
168{
169 /* Special case floating point exception registers. */
170 if (reg < 4)
171 (*info->fprintf_func) (info->stream, "fpe%d", reg * 2 + 1);
172 else
173 (*info->fprintf_func) (info->stream, "%sR", reg ? fp_reg_names[reg]
174 : "fr0");
175}
176
177static void
178fput_creg (reg, info)
179 unsigned reg;
180 disassemble_info *info;
181{
182 (*info->fprintf_func) (info->stream, control_reg[reg]);
183}
184
185/* print constants with sign */
186
187static void
188fput_const (num, info)
189 unsigned num;
190 disassemble_info *info;
191{
192 if ((int)num < 0)
193 (*info->fprintf_func) (info->stream, "-%x", -(int)num);
194 else
195 (*info->fprintf_func) (info->stream, "%x", num);
196}
197
198/* Routines to extract various sized constants out of hppa
199 instructions. */
200
201/* extract a 3-bit space register number from a be, ble, mtsp or mfsp */
202static int
203extract_3 (word)
204 unsigned word;
205{
206 return GET_FIELD (word, 18, 18) << 2 | GET_FIELD (word, 16, 17);
207}
208
209static int
210extract_5_load (word)
211 unsigned word;
212{
213 return low_sign_extend (word >> 16 & MASK_5, 5);
214}
215
216/* extract the immediate field from a st{bhw}s instruction */
217static int
218extract_5_store (word)
219 unsigned word;
220{
221 return low_sign_extend (word & MASK_5, 5);
222}
223
224/* extract the immediate field from a break instruction */
225static unsigned
226extract_5r_store (word)
227 unsigned word;
228{
229 return (word & MASK_5);
230}
231
232/* extract the immediate field from a {sr}sm instruction */
233static unsigned
234extract_5R_store (word)
235 unsigned word;
236{
237 return (word >> 16 & MASK_5);
238}
239
3b67cf2b
JL
240/* extract the 10 bit immediate field from a {sr}sm instruction */
241static unsigned
242extract_10U_store (word)
243 unsigned word;
244{
245 return (word >> 16 & MASK_10);
246}
247
252b5132
RH
248/* extract the immediate field from a bb instruction */
249static unsigned
250extract_5Q_store (word)
251 unsigned word;
252{
253 return (word >> 21 & MASK_5);
254}
255
256/* extract an 11 bit immediate field */
257static int
258extract_11 (word)
259 unsigned word;
260{
261 return low_sign_extend (word & MASK_11, 11);
262}
263
264/* extract a 14 bit immediate field */
265static int
266extract_14 (word)
267 unsigned word;
268{
269 return low_sign_extend (word & MASK_14, 14);
270}
271
272/* extract a 21 bit constant */
273
274static int
275extract_21 (word)
276 unsigned word;
277{
278 int val;
279
280 word &= MASK_21;
281 word <<= 11;
282 val = GET_FIELD (word, 20, 20);
283 val <<= 11;
284 val |= GET_FIELD (word, 9, 19);
285 val <<= 2;
286 val |= GET_FIELD (word, 5, 6);
287 val <<= 5;
288 val |= GET_FIELD (word, 0, 4);
289 val <<= 2;
290 val |= GET_FIELD (word, 7, 8);
291 return sign_extend (val, 21) << 11;
292}
293
294/* extract a 12 bit constant from branch instructions */
295
296static int
297extract_12 (word)
298 unsigned word;
299{
300 return sign_extend (GET_FIELD (word, 19, 28) |
301 GET_FIELD (word, 29, 29) << 10 |
302 (word & 0x1) << 11, 12) << 2;
303}
304
305/* extract a 17 bit constant from branch instructions, returning the
306 19 bit signed value. */
307
308static int
309extract_17 (word)
310 unsigned word;
311{
312 return sign_extend (GET_FIELD (word, 19, 28) |
313 GET_FIELD (word, 29, 29) << 10 |
314 GET_FIELD (word, 11, 15) << 11 |
315 (word & 0x1) << 16, 17) << 2;
316}
317
318/* Print one instruction. */
319int
320print_insn_hppa (memaddr, info)
321 bfd_vma memaddr;
322 disassemble_info *info;
323{
324 bfd_byte buffer[4];
325 unsigned int insn, i;
326
327 {
328 int status =
329 (*info->read_memory_func) (memaddr, buffer, sizeof (buffer), info);
330 if (status != 0)
331 {
332 (*info->memory_error_func) (status, memaddr, info);
333 return -1;
334 }
335 }
336
337 insn = bfd_getb32 (buffer);
338
339 for (i = 0; i < NUMOPCODES; ++i)
340 {
341 const struct pa_opcode *opcode = &pa_opcodes[i];
342 if ((insn & opcode->mask) == opcode->match)
343 {
344 register const char *s;
345
346 (*info->fprintf_func) (info->stream, "%s", opcode->name);
347
feb12992 348 if (!strchr ("cfCY?-+nHNZFIu", opcode->args[0]))
252b5132
RH
349 (*info->fprintf_func) (info->stream, " ");
350 for (s = opcode->args; *s != '\0'; ++s)
351 {
352 switch (*s)
353 {
354 case 'x':
355 fput_reg (GET_FIELD (insn, 11, 15), info);
356 break;
1eee34f5 357 case 'a':
252b5132
RH
358 case 'b':
359 fput_reg (GET_FIELD (insn, 6, 10), info);
360 break;
361 case '^':
362 fput_creg (GET_FIELD (insn, 6, 10), info);
363 break;
252b5132
RH
364 case 't':
365 fput_reg (GET_FIELD (insn, 27, 31), info);
366 break;
a349b151
JL
367
368 /* Handle floating point registers. */
369 case 'f':
370 switch (*++s)
371 {
372 case 't':
252b5132 373 fput_fp_reg (GET_FIELD (insn, 27, 31), info);
a349b151
JL
374 break;
375 case 'T':
376 if (GET_FIELD (insn, 25, 25))
377 fput_fp_reg_r (GET_FIELD (insn, 27, 31), info);
378 else
379 fput_fp_reg (GET_FIELD (insn, 27, 31), info);
380 break;
381 case 'a':
382 if (GET_FIELD (insn, 25, 25))
383 fput_fp_reg_r (GET_FIELD (insn, 6, 10), info);
384 else
385 fput_fp_reg (GET_FIELD (insn, 6, 10), info);
386 break;
387 case 'A':
388 if (GET_FIELD (insn, 24, 24))
389 fput_fp_reg_r (GET_FIELD (insn, 6, 10), info);
390 else
391 fput_fp_reg (GET_FIELD (insn, 6, 10), info);
392
393 break;
394 case 'b':
395 if (GET_FIELD (insn, 25, 25))
396 fput_fp_reg_r (GET_FIELD (insn, 11, 15), info);
397 else
398 fput_fp_reg (GET_FIELD (insn, 11, 15), info);
399 break;
400 case 'B':
401 if (GET_FIELD (insn, 19, 19))
402 fput_fp_reg_r (GET_FIELD (insn, 11, 15), info);
403 else
404 fput_fp_reg (GET_FIELD (insn, 11, 15), info);
405 break;
406 case 'C':
407 {
408 int reg = GET_FIELD (insn, 21, 22);
409 reg |= GET_FIELD (insn, 16, 18) << 2;
410 if (GET_FIELD (insn, 23, 23) != 0)
411 fput_fp_reg_r (reg, info);
412 else
413 fput_fp_reg (reg, info);
414 break;
415 }
416 case 'i':
417 {
418 int reg = GET_FIELD (insn, 6, 10);
252b5132 419
a349b151
JL
420 reg |= (GET_FIELD (insn, 26, 26) << 4);
421 fput_fp_reg (reg, info);
422 break;
423 }
424 case 'j':
425 {
426 int reg = GET_FIELD (insn, 11, 15);
252b5132 427
a349b151
JL
428 reg |= (GET_FIELD (insn, 26, 26) << 4);
429 fput_fp_reg (reg, info);
430 break;
431 }
432 case 'k':
433 {
434 int reg = GET_FIELD (insn, 27, 31);
252b5132 435
a349b151
JL
436 reg |= (GET_FIELD (insn, 26, 26) << 4);
437 fput_fp_reg (reg, info);
438 break;
439 }
440 case 'l':
441 {
442 int reg = GET_FIELD (insn, 21, 25);
252b5132 443
a349b151
JL
444 reg |= (GET_FIELD (insn, 26, 26) << 4);
445 fput_fp_reg (reg, info);
446 break;
447 }
448 case 'm':
449 {
450 int reg = GET_FIELD (insn, 16, 20);
451
452 reg |= (GET_FIELD (insn, 26, 26) << 4);
453 fput_fp_reg (reg, info);
454 break;
455 }
456 }
2f87f883 457 break;
252b5132 458
252b5132
RH
459 case '5':
460 fput_const (extract_5_load (insn), info);
461 break;
462 case 's':
463 (*info->fprintf_func) (info->stream,
464 "sr%d", GET_FIELD (insn, 16, 17));
465 break;
b333b6c6 466
252b5132
RH
467 case 'S':
468 (*info->fprintf_func) (info->stream, "sr%d", extract_3 (insn));
469 break;
3281117a
JL
470
471 /* Handle completers. */
252b5132 472 case 'c':
3281117a
JL
473 switch (*++s)
474 {
475 case 'x':
476 (*info->fprintf_func) (info->stream, "%s ",
477 index_compl_names[GET_COMPL (insn)]);
478 break;
479 case 'm':
480 (*info->fprintf_func) (info->stream, "%s ",
481 short_ldst_compl_names[GET_COMPL (insn)]);
482 break;
483 case 's':
484 (*info->fprintf_func) (info->stream, "%s ",
485 short_bytes_compl_names[GET_COMPL (insn)]);
486 break;
3b67cf2b
JL
487 case 'L':
488 (*info->fprintf_func) (info->stream, ",l");
489 break;
490 case 'w':
491 (*info->fprintf_func) (info->stream, "%s ",
492 read_write_names[GET_FIELD (insn, 25, 25)]);
493 break;
494 case 'W':
495 (*info->fprintf_func) (info->stream, ",w");
496 break;
497 case 'r':
498 if (GET_FIELD (insn, 23, 26) == 5)
499 (*info->fprintf_func) (info->stream, ",r");
500 break;
3281117a
JL
501 case 'Z':
502 if (GET_FIELD (insn, 26, 26))
503 (*info->fprintf_func) (info->stream, ",m ");
504 else
505 (*info->fprintf_func) (info->stream, " ");
506 break;
3b67cf2b
JL
507 case 'i':
508 if (GET_FIELD (insn, 25, 25))
509 (*info->fprintf_func) (info->stream, ",i");
510 break;
af10de82
JL
511 case 'z':
512 if (!GET_FIELD (insn, 21, 21))
513 (*info->fprintf_func) (info->stream, ",z");
514 break;
3b67cf2b
JL
515 case 'a':
516 (*info->fprintf_func)
517 (info->stream, "%s", add_compl_names[GET_FIELD
518 (insn, 20, 21)]);
519 break;
520 case 'Y':
521 (*info->fprintf_func)
522 (info->stream, ",dc%s", add_compl_names[GET_FIELD
523 (insn, 20, 21)]);
524 break;
525 case 'y':
526 (*info->fprintf_func)
527 (info->stream, ",c%s", add_compl_names[GET_FIELD
528 (insn, 20, 21)]);
529 break;
530 case 'v':
531 if (GET_FIELD (insn, 20, 20))
532 (*info->fprintf_func) (info->stream, ",tsv");
533 break;
534 case 't':
535 (*info->fprintf_func) (info->stream, ",tc");
536 if (GET_FIELD (insn, 20, 20))
537 (*info->fprintf_func) (info->stream, ",tsv");
538 break;
539 case 'B':
540 (*info->fprintf_func) (info->stream, ",db");
541 if (GET_FIELD (insn, 20, 20))
542 (*info->fprintf_func) (info->stream, ",tsv");
543 break;
544 case 'b':
545 (*info->fprintf_func) (info->stream, ",b");
546 if (GET_FIELD (insn, 20, 20))
547 (*info->fprintf_func) (info->stream, ",tsv");
548 break;
549 case 'T':
550 if (GET_FIELD (insn, 25, 25))
551 (*info->fprintf_func) (info->stream, ",tc");
552 break;
1eee34f5
JL
553 case 'S':
554 /* EXTRD/W has a following condition. */
555 if (*(s + 1) == '?')
556 (*info->fprintf_func)
557 (info->stream, "%s", signed_unsigned_names[GET_FIELD
558 (insn, 21, 21)]);
559 else
560 (*info->fprintf_func)
561 (info->stream, "%s ", signed_unsigned_names[GET_FIELD
562 (insn, 21, 21)]);
563 break;
564 case 'h':
565 (*info->fprintf_func)
566 (info->stream, "%s", mix_half_names[GET_FIELD
567 (insn, 17, 17)]);
568 break;
569 case 'H':
570 (*info->fprintf_func)
571 (info->stream, "%s", saturation_names[GET_FIELD
572 (insn, 24, 25)]);
573 break;
574 case '*':
575 (*info->fprintf_func)
576 (info->stream, ",%d%d%d%d ",
577 GET_FIELD (insn, 17, 18), GET_FIELD (insn, 20, 21),
578 GET_FIELD (insn, 22, 23), GET_FIELD (insn, 24, 25));
579 break;
3281117a 580 }
252b5132 581 break;
feb12992
JL
582
583 /* Handle conditions. */
252b5132 584 case '?':
feb12992
JL
585 {
586 s++;
587 switch (*s)
588 {
589 case 'f':
590 (*info->fprintf_func) (info->stream, "%s ",
591 float_comp_names[GET_FIELD
592 (insn, 27, 31)]);
593 break;
594
595 /* these four conditions are for the set of instructions
596 which distinguish true/false conditions by opcode
597 rather than by the 'f' bit (sigh): comb, comib,
598 addb, addib */
599 case 't':
a349b151 600 fputs_filtered (compare_cond_names[GET_FIELD (insn, 16, 18)],
feb12992
JL
601 info);
602 break;
b333b6c6
JL
603 case 'T':
604 fputs_filtered (compare_cond_names[GET_FIELD (insn, 16, 18)
605 + 8], info);
606 break;
607 case 'r':
608 fputs_filtered (compare_cond_64_names[GET_FIELD (insn, 16, 18)],
609 info);
610 break;
611 case 'R':
612 fputs_filtered (compare_cond_64_names[GET_FIELD (insn, 16, 18)
613 + 8], info);
614 break;
615 case 'Q':
616 fputs_filtered (cmpib_cond_64_names[GET_FIELD (insn, 16, 18)],
617 info);
618 break;
feb12992 619 case 'n':
a349b151 620 fputs_filtered (compare_cond_names[GET_FIELD (insn, 16, 18)
feb12992
JL
621 + GET_FIELD (insn, 4, 4) * 8], info);
622 break;
623 case '@':
624 fputs_filtered (add_cond_names[GET_FIELD (insn, 16, 18)
625 + GET_FIELD (insn, 4, 4) * 8], info);
626 break;
627 case 's':
628 (*info->fprintf_func) (info->stream, "%s ",
629 compare_cond_names[GET_COND (insn)]);
630 break;
b333b6c6
JL
631 case 'S':
632 (*info->fprintf_func) (info->stream, "%s ",
633 compare_cond_64_names[GET_COND (insn)]);
634 break;
feb12992
JL
635 case 'a':
636 (*info->fprintf_func) (info->stream, "%s ",
637 add_cond_names[GET_COND (insn)]);
638 break;
b333b6c6
JL
639 case 'A':
640 (*info->fprintf_func) (info->stream, "%s ",
641 add_cond_64_names[GET_COND (insn)]);
642 break;
feb12992
JL
643 case 'd':
644 (*info->fprintf_func) (info->stream, "%s",
a349b151 645 add_cond_names[GET_FIELD (insn, 16, 18)]);
feb12992 646 break;
a349b151 647
b333b6c6
JL
648 case 'D':
649 (*info->fprintf_func) (info->stream, "%s",
a349b151
JL
650 add_cond_names[GET_FIELD (insn, 16, 18)
651 + 8]);
b333b6c6
JL
652 break;
653 case 'w':
a349b151 654 (*info->fprintf_func)
b333b6c6
JL
655 (info->stream, "%s",
656 wide_add_cond_names[GET_FIELD (insn, 16, 18)]);
657 break;
658
659 case 'W':
a349b151 660 (*info->fprintf_func)
b333b6c6
JL
661 (info->stream, "%s",
662 wide_add_cond_names[GET_FIELD (insn, 16, 18) + 8]);
663 break;
feb12992
JL
664
665 case 'l':
666 (*info->fprintf_func) (info->stream, "%s ",
667 logical_cond_names[GET_COND (insn)]);
668 break;
b333b6c6
JL
669 case 'L':
670 (*info->fprintf_func) (info->stream, "%s ",
671 logical_cond_64_names[GET_COND (insn)]);
672 break;
feb12992
JL
673 case 'u':
674 (*info->fprintf_func) (info->stream, "%s ",
675 unit_cond_names[GET_COND (insn)]);
676 break;
b333b6c6
JL
677 case 'U':
678 (*info->fprintf_func) (info->stream, "%s ",
679 unit_cond_64_names[GET_COND (insn)]);
680 break;
feb12992
JL
681 case 'y':
682 case 'x':
683 case 'b':
684 (*info->fprintf_func)
685 (info->stream, "%s",
686 shift_cond_names[GET_FIELD (insn, 16, 18)]);
687
688 /* If the next character in args is 'n', it will handle
689 putting out the space. */
690 if (s[1] != 'n')
691 (*info->fprintf_func) (info->stream, " ");
692 break;
b333b6c6
JL
693 case 'X':
694 (*info->fprintf_func) (info->stream, "%s",
695 shift_cond_64_names[GET_FIELD (insn, 16, 18)]);
696 break;
697 case 'B':
698 (*info->fprintf_func)
699 (info->stream, "%s",
700 bb_cond_64_names[GET_FIELD (insn, 16, 16)]);
feb12992 701
b333b6c6
JL
702 /* If the next character in args is 'n', it will handle
703 putting out the space. */
704 if (s[1] != 'n')
705 (*info->fprintf_func) (info->stream, " ");
706 break;
feb12992
JL
707 }
708 break;
709 }
252b5132 710
252b5132
RH
711 case 'V':
712 fput_const (extract_5_store (insn), info);
713 break;
714 case 'r':
715 fput_const (extract_5r_store (insn), info);
716 break;
717 case 'R':
718 fput_const (extract_5R_store (insn), info);
719 break;
3b67cf2b
JL
720 case 'U':
721 fput_const (extract_10U_store (insn), info);
722 break;
252b5132
RH
723 case 'Q':
724 fput_const (extract_5Q_store (insn), info);
725 break;
726 case 'i':
727 fput_const (extract_11 (insn), info);
728 break;
729 case 'j':
730 fput_const (extract_14 (insn), info);
731 break;
732 case 'k':
733 fput_const (extract_21 (insn), info);
734 break;
735 case 'n':
736 if (insn & 0x2)
737 (*info->fprintf_func) (info->stream, ",n ");
738 else
739 (*info->fprintf_func) (info->stream, " ");
740 break;
741 case 'N':
742 if ((insn & 0x20) && s[1])
743 (*info->fprintf_func) (info->stream, ",n ");
744 else if (insn & 0x20)
745 (*info->fprintf_func) (info->stream, ",n");
746 else if (s[1])
747 (*info->fprintf_func) (info->stream, " ");
748 break;
749 case 'w':
750 (*info->print_address_func) (memaddr + 8 + extract_12 (insn),
751 info);
752 break;
753 case 'W':
754 /* 17 bit PC-relative branch. */
755 (*info->print_address_func) ((memaddr + 8
756 + extract_17 (insn)),
757 info);
758 break;
759 case 'z':
760 /* 17 bit displacement. This is an offset from a register
761 so it gets disasssembled as just a number, not any sort
762 of address. */
763 fput_const (extract_17 (insn), info);
764 break;
d1e9bd1f
JL
765
766 case 'Z':
767 /* addil %r1 implicit output. */
2beaab59 768 (*info->fprintf_func) (info->stream, "%%r1");
d1e9bd1f
JL
769 break;
770
46424e05
JL
771 case '.':
772 (*info->fprintf_func) (info->stream, "%d",
773 GET_FIELD (insn, 24, 25));
774 break;
3b67cf2b
JL
775 case '*':
776 (*info->fprintf_func) (info->stream, "%d",
777 GET_FIELD (insn, 22, 25));
778 break;
b7d6d485 779 case '!':
2beaab59 780 (*info->fprintf_func) (info->stream, "%%sar");
b7d6d485 781 break;
252b5132
RH
782 case 'p':
783 (*info->fprintf_func) (info->stream, "%d",
784 31 - GET_FIELD (insn, 22, 26));
785 break;
46424e05
JL
786 case '~':
787 {
788 int num;
789 num = GET_FIELD (insn, 20, 20) << 5;
790 num |= GET_FIELD (insn, 22, 26);
791 (*info->fprintf_func) (info->stream, "%d", 63 - num);
792 break;
793 }
252b5132
RH
794 case 'P':
795 (*info->fprintf_func) (info->stream, "%d",
796 GET_FIELD (insn, 22, 26));
797 break;
af10de82
JL
798 case 'q':
799 {
800 int num;
801 num = GET_FIELD (insn, 20, 20) << 5;
802 num |= GET_FIELD (insn, 22, 26);
803 (*info->fprintf_func) (info->stream, "%d", num);
804 break;
805 }
252b5132
RH
806 case 'T':
807 (*info->fprintf_func) (info->stream, "%d",
808 32 - GET_FIELD (insn, 27, 31));
809 break;
af10de82
JL
810 case '%':
811 {
812 int num;
813 num = (GET_FIELD (insn, 23, 23) + 1) * 32;
814 num -= GET_FIELD (insn, 27, 31);
815 (*info->fprintf_func) (info->stream, "%d", num);
816 break;
817 }
818 case '|':
819 {
820 int num;
821 num = (GET_FIELD (insn, 19, 19) + 1) * 32;
822 num -= GET_FIELD (insn, 27, 31);
823 (*info->fprintf_func) (info->stream, "%d", num);
824 break;
825 }
46424e05
JL
826 case '$':
827 fput_const (GET_FIELD (insn, 20, 28), info);
828 break;
252b5132
RH
829 case 'A':
830 fput_const (GET_FIELD (insn, 6, 18), info);
831 break;
252b5132
RH
832 case 'D':
833 fput_const (GET_FIELD (insn, 6, 31), info);
834 break;
a349b151 835 case 'v':
252b5132
RH
836 (*info->fprintf_func) (info->stream, ",%d", GET_FIELD (insn, 23, 25));
837 break;
838 case 'O':
839 fput_const ((GET_FIELD (insn, 6,20) << 5 |
840 GET_FIELD (insn, 27, 31)), info);
841 break;
842 case 'o':
843 fput_const (GET_FIELD (insn, 6, 20), info);
844 break;
252b5132
RH
845 case '2':
846 fput_const ((GET_FIELD (insn, 6, 22) << 5 |
847 GET_FIELD (insn, 27, 31)), info);
848 break;
849 case '1':
850 fput_const ((GET_FIELD (insn, 11, 20) << 5 |
851 GET_FIELD (insn, 27, 31)), info);
852 break;
853 case '0':
854 fput_const ((GET_FIELD (insn, 16, 20) << 5 |
855 GET_FIELD (insn, 27, 31)), info);
856 break;
857 case 'u':
858 (*info->fprintf_func) (info->stream, ",%d", GET_FIELD (insn, 23, 25));
859 break;
860 case 'F':
861 /* if no destination completer and not before a completer
862 for fcmp, need a space here */
4f312591 863 if (s[1] == 'G' || s[1] == '?')
252b5132
RH
864 fputs_filtered (float_format_names[GET_FIELD (insn, 19, 20)],
865 info);
866 else
867 (*info->fprintf_func) (info->stream, "%s ",
868 float_format_names[GET_FIELD
869 (insn, 19, 20)]);
870 break;
871 case 'G':
872 (*info->fprintf_func) (info->stream, "%s ",
873 float_format_names[GET_FIELD (insn,
874 17, 18)]);
875 break;
876 case 'H':
877 if (GET_FIELD (insn, 26, 26) == 1)
878 (*info->fprintf_func) (info->stream, "%s ",
879 float_format_names[0]);
880 else
881 (*info->fprintf_func) (info->stream, "%s ",
882 float_format_names[1]);
883 break;
884 case 'I':
885 /* if no destination completer and not before a completer
886 for fcmp, need a space here */
4f312591 887 if (s[1] == '?')
252b5132
RH
888 fputs_filtered (float_format_names[GET_FIELD (insn, 20, 20)],
889 info);
890 else
891 (*info->fprintf_func) (info->stream, "%s ",
892 float_format_names[GET_FIELD
893 (insn, 20, 20)]);
894 break;
252b5132
RH
895 default:
896 (*info->fprintf_func) (info->stream, "%c", *s);
897 break;
898 }
899 }
900 return sizeof(insn);
901 }
902 }
903 (*info->fprintf_func) (info->stream, "#%8x", insn);
904 return sizeof(insn);
905}
This page took 0.081347 seconds and 4 git commands to generate.