1 /* Disassembler for the PA-RISC. Somewhat derived from sparc-pinsn.c.
2 Copyright 1989, 1990, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2003,
3 2005 Free Software Foundation, Inc.
5 Contributed by the Center for Software Science at the
6 University of Utah (pa-gdb-bugs@cs.utah.edu).
8 This program is free software; you can redistribute it and/or modify
9 it under the terms of the GNU General Public License as published by
10 the Free Software Foundation; either version 2 of the License, or
11 (at your option) any later version.
13 This program is distributed in the hope that it will be useful,
14 but WITHOUT ANY WARRANTY; without even the implied warranty of
15 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this program; if not, write to the Free Software
20 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21 MA 02110-1301, USA. */
26 #include "opcode/hppa.h"
28 /* Integer register names, indexed by the numbers which appear in the
30 static const char *const reg_names[] =
32 "flags", "r1", "rp", "r3", "r4", "r5", "r6", "r7", "r8", "r9",
33 "r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19",
34 "r20", "r21", "r22", "r23", "r24", "r25", "r26", "dp", "ret0", "ret1",
38 /* Floating point register names, indexed by the numbers which appear in the
40 static const char *const fp_reg_names[] =
42 "fpsr", "fpe2", "fpe4", "fpe6",
43 "fr4", "fr5", "fr6", "fr7", "fr8",
44 "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15",
45 "fr16", "fr17", "fr18", "fr19", "fr20", "fr21", "fr22", "fr23",
46 "fr24", "fr25", "fr26", "fr27", "fr28", "fr29", "fr30", "fr31"
49 typedef unsigned int CORE_ADDR;
51 /* Get at various relevent fields of an instruction word. */
56 #define MASK_14 0x3fff
57 #define MASK_16 0xffff
58 #define MASK_21 0x1fffff
60 /* These macros get bit fields using HP's numbering (MSB = 0). */
62 #define GET_FIELD(X, FROM, TO) \
63 ((X) >> (31 - (TO)) & ((1 << ((TO) - (FROM) + 1)) - 1))
65 #define GET_BIT(X, WHICH) \
66 GET_FIELD (X, WHICH, WHICH)
68 /* Some of these have been converted to 2-d arrays because they
69 consume less storage this way. If the maintenance becomes a
70 problem, convert them back to const 1-d pointer arrays. */
71 static const char *const control_reg[] =
73 "rctr", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7",
74 "pidr1", "pidr2", "ccr", "sar", "pidr3", "pidr4",
75 "iva", "eiem", "itmr", "pcsq", "pcoq", "iir", "isr",
76 "ior", "ipsw", "eirr", "tr0", "tr1", "tr2", "tr3",
77 "tr4", "tr5", "tr6", "tr7"
80 static const char *const compare_cond_names[] =
82 "", ",=", ",<", ",<=", ",<<", ",<<=", ",sv", ",od",
83 ",tr", ",<>", ",>=", ",>", ",>>=", ",>>", ",nsv", ",ev"
85 static const char *const compare_cond_64_names[] =
87 "", ",*=", ",*<", ",*<=", ",*<<", ",*<<=", ",*sv", ",*od",
88 ",*tr", ",*<>", ",*>=", ",*>", ",*>>=", ",*>>", ",*nsv", ",*ev"
90 static const char *const cmpib_cond_64_names[] =
92 ",*<<", ",*=", ",*<", ",*<=", ",*>>=", ",*<>", ",*>=", ",*>"
94 static const char *const add_cond_names[] =
96 "", ",=", ",<", ",<=", ",nuv", ",znv", ",sv", ",od",
97 ",tr", ",<>", ",>=", ",>", ",uv", ",vnz", ",nsv", ",ev"
99 static const char *const add_cond_64_names[] =
101 "", ",*=", ",*<", ",*<=", ",*nuv", ",*znv", ",*sv", ",*od",
102 ",*tr", ",*<>", ",*>=", ",*>", ",*uv", ",*vnz", ",*nsv", ",*ev"
104 static const char *const wide_add_cond_names[] =
106 "", ",=", ",<", ",<=", ",nuv", ",*=", ",*<", ",*<=",
107 ",tr", ",<>", ",>=", ",>", ",uv", ",*<>", ",*>=", ",*>"
109 static const char *const logical_cond_names[] =
111 "", ",=", ",<", ",<=", 0, 0, 0, ",od",
112 ",tr", ",<>", ",>=", ",>", 0, 0, 0, ",ev"};
113 static const char *const logical_cond_64_names[] =
115 "", ",*=", ",*<", ",*<=", 0, 0, 0, ",*od",
116 ",*tr", ",*<>", ",*>=", ",*>", 0, 0, 0, ",*ev"};
117 static const char *const unit_cond_names[] =
119 "", ",swz", ",sbz", ",shz", ",sdc", ",swc", ",sbc", ",shc",
120 ",tr", ",nwz", ",nbz", ",nhz", ",ndc", ",nwc", ",nbc", ",nhc"
122 static const char *const unit_cond_64_names[] =
124 "", ",*swz", ",*sbz", ",*shz", ",*sdc", ",*swc", ",*sbc", ",*shc",
125 ",*tr", ",*nwz", ",*nbz", ",*nhz", ",*ndc", ",*nwc", ",*nbc", ",*nhc"
127 static const char *const shift_cond_names[] =
129 "", ",=", ",<", ",od", ",tr", ",<>", ",>=", ",ev"
131 static const char *const shift_cond_64_names[] =
133 "", ",*=", ",*<", ",*od", ",*tr", ",*<>", ",*>=", ",*ev"
135 static const char *const bb_cond_64_names[] =
139 static const char *const index_compl_names[] = {"", ",m", ",s", ",sm"};
140 static const char *const short_ldst_compl_names[] = {"", ",ma", "", ",mb"};
141 static const char *const short_bytes_compl_names[] =
143 "", ",b,m", ",e", ",e,m"
145 static const char *const float_format_names[] = {",sgl", ",dbl", "", ",quad"};
146 static const char *const fcnv_fixed_names[] = {",w", ",dw", "", ",qw"};
147 static const char *const fcnv_ufixed_names[] = {",uw", ",udw", "", ",uqw"};
148 static const char *const float_comp_names[] =
150 ",false?", ",false", ",?", ",!<=>", ",=", ",=t", ",?=", ",!<>",
151 ",!?>=", ",<", ",?<", ",!>=", ",!?>", ",<=", ",?<=", ",!>",
152 ",!?<=", ",>", ",?>", ",!<=", ",!?<", ",>=", ",?>=", ",!<",
153 ",!?=", ",<>", ",!=", ",!=t", ",!?", ",<=>", ",true?", ",true"
155 static const char *const signed_unsigned_names[] = {",u", ",s"};
156 static const char *const mix_half_names[] = {",l", ",r"};
157 static const char *const saturation_names[] = {",us", ",ss", 0, ""};
158 static const char *const read_write_names[] = {",r", ",w"};
159 static const char *const add_compl_names[] = { 0, "", ",l", ",tsv" };
161 /* For a bunch of different instructions form an index into a
162 completer name table. */
163 #define GET_COMPL(insn) (GET_FIELD (insn, 26, 26) | \
164 GET_FIELD (insn, 18, 18) << 1)
166 #define GET_COND(insn) (GET_FIELD ((insn), 16, 18) + \
167 (GET_FIELD ((insn), 19, 19) ? 8 : 0))
169 /* Utility function to print registers. Put these first, so gcc's function
170 inlining can do its stuff. */
172 #define fputs_filtered(STR,F) (*info->fprintf_func) (info->stream, "%s", STR)
175 fput_reg (unsigned reg, disassemble_info *info)
177 (*info->fprintf_func) (info->stream, reg ? reg_names[reg] : "r0");
181 fput_fp_reg (unsigned reg, disassemble_info *info)
183 (*info->fprintf_func) (info->stream, reg ? fp_reg_names[reg] : "fr0");
187 fput_fp_reg_r (unsigned reg, disassemble_info *info)
189 /* Special case floating point exception registers. */
191 (*info->fprintf_func) (info->stream, "fpe%d", reg * 2 + 1);
193 (*info->fprintf_func) (info->stream, "%sR",
194 reg ? fp_reg_names[reg] : "fr0");
198 fput_creg (unsigned reg, disassemble_info *info)
200 (*info->fprintf_func) (info->stream, control_reg[reg]);
203 /* Print constants with sign. */
206 fput_const (unsigned num, disassemble_info *info)
209 (*info->fprintf_func) (info->stream, "-%x", - (int) num);
211 (*info->fprintf_func) (info->stream, "%x", num);
214 /* Routines to extract various sized constants out of hppa
217 /* Extract a 3-bit space register number from a be, ble, mtsp or mfsp. */
219 extract_3 (unsigned word)
221 return GET_FIELD (word, 18, 18) << 2 | GET_FIELD (word, 16, 17);
225 extract_5_load (unsigned word)
227 return low_sign_extend (word >> 16 & MASK_5, 5);
230 /* Extract the immediate field from a st{bhw}s instruction. */
233 extract_5_store (unsigned word)
235 return low_sign_extend (word & MASK_5, 5);
238 /* Extract the immediate field from a break instruction. */
241 extract_5r_store (unsigned word)
243 return (word & MASK_5);
246 /* Extract the immediate field from a {sr}sm instruction. */
249 extract_5R_store (unsigned word)
251 return (word >> 16 & MASK_5);
254 /* Extract the 10 bit immediate field from a {sr}sm instruction. */
257 extract_10U_store (unsigned word)
259 return (word >> 16 & MASK_10);
262 /* Extract the immediate field from a bb instruction. */
265 extract_5Q_store (unsigned word)
267 return (word >> 21 & MASK_5);
270 /* Extract an 11 bit immediate field. */
273 extract_11 (unsigned word)
275 return low_sign_extend (word & MASK_11, 11);
278 /* Extract a 14 bit immediate field. */
281 extract_14 (unsigned word)
283 return low_sign_extend (word & MASK_14, 14);
286 /* Extract a 16 bit immediate field (PA2.0 wide only). */
289 extract_16 (unsigned word)
293 m0 = GET_BIT (word, 16);
294 m1 = GET_BIT (word, 17);
295 m15 = GET_BIT (word, 31);
296 word = (word >> 1) & 0x1fff;
297 word = word | (m15 << 15) | ((m15 ^ m0) << 14) | ((m15 ^ m1) << 13);
298 return sign_extend (word, 16);
301 /* Extract a 21 bit constant. */
304 extract_21 (unsigned word)
310 val = GET_FIELD (word, 20, 20);
312 val |= GET_FIELD (word, 9, 19);
314 val |= GET_FIELD (word, 5, 6);
316 val |= GET_FIELD (word, 0, 4);
318 val |= GET_FIELD (word, 7, 8);
319 return sign_extend (val, 21) << 11;
322 /* Extract a 12 bit constant from branch instructions. */
325 extract_12 (unsigned word)
327 return sign_extend (GET_FIELD (word, 19, 28)
328 | GET_FIELD (word, 29, 29) << 10
329 | (word & 0x1) << 11, 12) << 2;
332 /* Extract a 17 bit constant from branch instructions, returning the
333 19 bit signed value. */
336 extract_17 (unsigned word)
338 return sign_extend (GET_FIELD (word, 19, 28)
339 | GET_FIELD (word, 29, 29) << 10
340 | GET_FIELD (word, 11, 15) << 11
341 | (word & 0x1) << 16, 17) << 2;
345 extract_22 (unsigned word)
347 return sign_extend (GET_FIELD (word, 19, 28)
348 | GET_FIELD (word, 29, 29) << 10
349 | GET_FIELD (word, 11, 15) << 11
350 | GET_FIELD (word, 6, 10) << 16
351 | (word & 0x1) << 21, 22) << 2;
354 /* Print one instruction. */
357 print_insn_hppa (bfd_vma memaddr, disassemble_info *info)
360 unsigned int insn, i;
364 (*info->read_memory_func) (memaddr, buffer, sizeof (buffer), info);
367 (*info->memory_error_func) (status, memaddr, info);
372 insn = bfd_getb32 (buffer);
374 for (i = 0; i < NUMOPCODES; ++i)
376 const struct pa_opcode *opcode = &pa_opcodes[i];
378 if ((insn & opcode->mask) == opcode->match)
382 if (opcode->arch == pa20w)
385 (*info->fprintf_func) (info->stream, "%s", opcode->name);
387 if (!strchr ("cfCY?-+nHNZFIuv{", opcode->args[0]))
388 (*info->fprintf_func) (info->stream, " ");
389 for (s = opcode->args; *s != '\0'; ++s)
394 fput_reg (GET_FIELD (insn, 11, 15), info);
398 fput_reg (GET_FIELD (insn, 6, 10), info);
401 fput_creg (GET_FIELD (insn, 6, 10), info);
404 fput_reg (GET_FIELD (insn, 27, 31), info);
407 /* Handle floating point registers. */
412 fput_fp_reg (GET_FIELD (insn, 27, 31), info);
415 if (GET_FIELD (insn, 25, 25))
416 fput_fp_reg_r (GET_FIELD (insn, 27, 31), info);
418 fput_fp_reg (GET_FIELD (insn, 27, 31), info);
421 if (GET_FIELD (insn, 25, 25))
422 fput_fp_reg_r (GET_FIELD (insn, 6, 10), info);
424 fput_fp_reg (GET_FIELD (insn, 6, 10), info);
427 /* 'fA' will not generate a space before the regsiter
428 name. Normally that is fine. Except that it
429 causes problems with xmpyu which has no FP format
432 fputs_filtered (" ", info);
436 if (GET_FIELD (insn, 24, 24))
437 fput_fp_reg_r (GET_FIELD (insn, 6, 10), info);
439 fput_fp_reg (GET_FIELD (insn, 6, 10), info);
442 if (GET_FIELD (insn, 25, 25))
443 fput_fp_reg_r (GET_FIELD (insn, 11, 15), info);
445 fput_fp_reg (GET_FIELD (insn, 11, 15), info);
448 if (GET_FIELD (insn, 19, 19))
449 fput_fp_reg_r (GET_FIELD (insn, 11, 15), info);
451 fput_fp_reg (GET_FIELD (insn, 11, 15), info);
455 int reg = GET_FIELD (insn, 21, 22);
456 reg |= GET_FIELD (insn, 16, 18) << 2;
457 if (GET_FIELD (insn, 23, 23) != 0)
458 fput_fp_reg_r (reg, info);
460 fput_fp_reg (reg, info);
465 int reg = GET_FIELD (insn, 6, 10);
467 reg |= (GET_FIELD (insn, 26, 26) << 4);
468 fput_fp_reg (reg, info);
473 int reg = GET_FIELD (insn, 11, 15);
475 reg |= (GET_FIELD (insn, 26, 26) << 4);
476 fput_fp_reg (reg, info);
481 int reg = GET_FIELD (insn, 27, 31);
483 reg |= (GET_FIELD (insn, 26, 26) << 4);
484 fput_fp_reg (reg, info);
489 int reg = GET_FIELD (insn, 21, 25);
491 reg |= (GET_FIELD (insn, 26, 26) << 4);
492 fput_fp_reg (reg, info);
497 int reg = GET_FIELD (insn, 16, 20);
499 reg |= (GET_FIELD (insn, 26, 26) << 4);
500 fput_fp_reg (reg, info);
504 /* 'fe' will not generate a space before the register
505 name. Normally that is fine. Except that it
506 causes problems with fstw fe,y(b) which has no FP
509 fputs_filtered (" ", info);
513 if (GET_FIELD (insn, 30, 30))
514 fput_fp_reg_r (GET_FIELD (insn, 11, 15), info);
516 fput_fp_reg (GET_FIELD (insn, 11, 15), info);
519 fput_fp_reg (GET_FIELD (insn, 11, 15), info);
525 fput_const (extract_5_load (insn), info);
529 int space = GET_FIELD (insn, 16, 17);
530 /* Zero means implicit addressing, not use of sr0. */
532 (*info->fprintf_func) (info->stream, "sr%d", space);
537 (*info->fprintf_func) (info->stream, "sr%d",
541 /* Handle completers. */
546 (*info->fprintf_func)
548 index_compl_names[GET_COMPL (insn)]);
551 (*info->fprintf_func)
552 (info->stream, "%s ",
553 index_compl_names[GET_COMPL (insn)]);
556 (*info->fprintf_func)
558 short_ldst_compl_names[GET_COMPL (insn)]);
561 (*info->fprintf_func)
562 (info->stream, "%s ",
563 short_ldst_compl_names[GET_COMPL (insn)]);
566 (*info->fprintf_func)
567 (info->stream, "%s ",
568 short_bytes_compl_names[GET_COMPL (insn)]);
571 (*info->fprintf_func)
573 short_bytes_compl_names[GET_COMPL (insn)]);
577 switch (GET_FIELD (insn, 20, 21))
580 (*info->fprintf_func) (info->stream, ",bc ");
583 (*info->fprintf_func) (info->stream, ",sl ");
586 (*info->fprintf_func) (info->stream, " ");
590 switch (GET_FIELD (insn, 20, 21))
593 (*info->fprintf_func) (info->stream, ",co ");
596 (*info->fprintf_func) (info->stream, " ");
600 (*info->fprintf_func) (info->stream, ",o");
603 (*info->fprintf_func) (info->stream, ",gate");
606 (*info->fprintf_func) (info->stream, ",l,push");
609 (*info->fprintf_func) (info->stream, ",pop");
613 (*info->fprintf_func) (info->stream, ",l");
616 (*info->fprintf_func)
617 (info->stream, "%s ",
618 read_write_names[GET_FIELD (insn, 25, 25)]);
621 (*info->fprintf_func) (info->stream, ",w ");
624 if (GET_FIELD (insn, 23, 26) == 5)
625 (*info->fprintf_func) (info->stream, ",r");
628 if (GET_FIELD (insn, 26, 26))
629 (*info->fprintf_func) (info->stream, ",m ");
631 (*info->fprintf_func) (info->stream, " ");
634 if (GET_FIELD (insn, 25, 25))
635 (*info->fprintf_func) (info->stream, ",i");
638 if (!GET_FIELD (insn, 21, 21))
639 (*info->fprintf_func) (info->stream, ",z");
642 (*info->fprintf_func)
644 add_compl_names[GET_FIELD (insn, 20, 21)]);
647 (*info->fprintf_func)
648 (info->stream, ",dc%s",
649 add_compl_names[GET_FIELD (insn, 20, 21)]);
652 (*info->fprintf_func)
653 (info->stream, ",c%s",
654 add_compl_names[GET_FIELD (insn, 20, 21)]);
657 if (GET_FIELD (insn, 20, 20))
658 (*info->fprintf_func) (info->stream, ",tsv");
661 (*info->fprintf_func) (info->stream, ",tc");
662 if (GET_FIELD (insn, 20, 20))
663 (*info->fprintf_func) (info->stream, ",tsv");
666 (*info->fprintf_func) (info->stream, ",db");
667 if (GET_FIELD (insn, 20, 20))
668 (*info->fprintf_func) (info->stream, ",tsv");
671 (*info->fprintf_func) (info->stream, ",b");
672 if (GET_FIELD (insn, 20, 20))
673 (*info->fprintf_func) (info->stream, ",tsv");
676 if (GET_FIELD (insn, 25, 25))
677 (*info->fprintf_func) (info->stream, ",tc");
680 /* EXTRD/W has a following condition. */
682 (*info->fprintf_func)
684 signed_unsigned_names[GET_FIELD (insn, 21, 21)]);
686 (*info->fprintf_func)
687 (info->stream, "%s ",
688 signed_unsigned_names[GET_FIELD (insn, 21, 21)]);
691 (*info->fprintf_func)
693 mix_half_names[GET_FIELD (insn, 17, 17)]);
696 (*info->fprintf_func)
697 (info->stream, "%s ",
698 saturation_names[GET_FIELD (insn, 24, 25)]);
701 (*info->fprintf_func)
702 (info->stream, ",%d%d%d%d ",
703 GET_FIELD (insn, 17, 18), GET_FIELD (insn, 20, 21),
704 GET_FIELD (insn, 22, 23), GET_FIELD (insn, 24, 25));
711 m = GET_FIELD (insn, 28, 28);
712 a = GET_FIELD (insn, 29, 29);
715 fputs_filtered (",ma ", info);
717 fputs_filtered (",mb ", info);
719 fputs_filtered (" ", info);
725 int opc = GET_FIELD (insn, 0, 5);
727 if (opc == 0x16 || opc == 0x1e)
729 if (GET_FIELD (insn, 29, 29) == 0)
730 fputs_filtered (",ma ", info);
732 fputs_filtered (",mb ", info);
735 fputs_filtered (" ", info);
741 int opc = GET_FIELD (insn, 0, 5);
743 if (opc == 0x13 || opc == 0x1b)
745 if (GET_FIELD (insn, 18, 18) == 1)
746 fputs_filtered (",mb ", info);
748 fputs_filtered (",ma ", info);
750 else if (opc == 0x17 || opc == 0x1f)
752 if (GET_FIELD (insn, 31, 31) == 1)
753 fputs_filtered (",ma ", info);
755 fputs_filtered (",mb ", info);
758 fputs_filtered (" ", info);
765 /* Handle conditions. */
772 (*info->fprintf_func)
773 (info->stream, "%s ",
774 float_comp_names[GET_FIELD (insn, 27, 31)]);
777 /* These four conditions are for the set of instructions
778 which distinguish true/false conditions by opcode
779 rather than by the 'f' bit (sigh): comb, comib,
783 (compare_cond_names[GET_FIELD (insn, 16, 18)], info);
787 (compare_cond_names[GET_FIELD (insn, 16, 18)
788 + GET_FIELD (insn, 4, 4) * 8],
793 (compare_cond_64_names[GET_FIELD (insn, 16, 18)
794 + GET_FIELD (insn, 2, 2) * 8],
799 (cmpib_cond_64_names[GET_FIELD (insn, 16, 18)],
804 (add_cond_names[GET_FIELD (insn, 16, 18)
805 + GET_FIELD (insn, 4, 4) * 8],
809 (*info->fprintf_func)
810 (info->stream, "%s ",
811 compare_cond_names[GET_COND (insn)]);
814 (*info->fprintf_func)
815 (info->stream, "%s ",
816 compare_cond_64_names[GET_COND (insn)]);
819 (*info->fprintf_func)
820 (info->stream, "%s ",
821 add_cond_names[GET_COND (insn)]);
824 (*info->fprintf_func)
825 (info->stream, "%s ",
826 add_cond_64_names[GET_COND (insn)]);
829 (*info->fprintf_func)
831 add_cond_names[GET_FIELD (insn, 16, 18)]);
835 (*info->fprintf_func)
837 wide_add_cond_names[GET_FIELD (insn, 16, 18) +
838 GET_FIELD (insn, 4, 4) * 8]);
842 (*info->fprintf_func)
843 (info->stream, "%s ",
844 logical_cond_names[GET_COND (insn)]);
847 (*info->fprintf_func)
848 (info->stream, "%s ",
849 logical_cond_64_names[GET_COND (insn)]);
852 (*info->fprintf_func)
853 (info->stream, "%s ",
854 unit_cond_names[GET_COND (insn)]);
857 (*info->fprintf_func)
858 (info->stream, "%s ",
859 unit_cond_64_names[GET_COND (insn)]);
864 (*info->fprintf_func)
866 shift_cond_names[GET_FIELD (insn, 16, 18)]);
868 /* If the next character in args is 'n', it will handle
869 putting out the space. */
871 (*info->fprintf_func) (info->stream, " ");
874 (*info->fprintf_func)
875 (info->stream, "%s ",
876 shift_cond_64_names[GET_FIELD (insn, 16, 18)]);
879 (*info->fprintf_func)
881 bb_cond_64_names[GET_FIELD (insn, 16, 16)]);
883 /* If the next character in args is 'n', it will handle
884 putting out the space. */
886 (*info->fprintf_func) (info->stream, " ");
893 fput_const (extract_5_store (insn), info);
896 fput_const (extract_5r_store (insn), info);
899 fput_const (extract_5R_store (insn), info);
902 fput_const (extract_10U_store (insn), info);
906 fput_const (extract_5Q_store (insn), info);
909 fput_const (extract_11 (insn), info);
912 fput_const (extract_14 (insn), info);
915 fputs_filtered ("L%", info);
916 fput_const (extract_21 (insn), info);
920 /* 16-bit long disp., PA2.0 wide only. */
921 fput_const (extract_16 (insn), info);
925 (*info->fprintf_func) (info->stream, ",n ");
927 (*info->fprintf_func) (info->stream, " ");
930 if ((insn & 0x20) && s[1])
931 (*info->fprintf_func) (info->stream, ",n ");
932 else if (insn & 0x20)
933 (*info->fprintf_func) (info->stream, ",n");
935 (*info->fprintf_func) (info->stream, " ");
938 (*info->print_address_func)
939 (memaddr + 8 + extract_12 (insn), info);
942 /* 17 bit PC-relative branch. */
943 (*info->print_address_func)
944 ((memaddr + 8 + extract_17 (insn)), info);
947 /* 17 bit displacement. This is an offset from a register
948 so it gets disasssembled as just a number, not any sort
950 fput_const (extract_17 (insn), info);
954 /* addil %r1 implicit output. */
955 fputs_filtered ("r1", info);
959 /* be,l %sr0,%r31 implicit output. */
960 fputs_filtered ("sr0,r31", info);
964 (*info->fprintf_func) (info->stream, "0");
968 (*info->fprintf_func) (info->stream, "%d",
969 GET_FIELD (insn, 24, 25));
972 (*info->fprintf_func) (info->stream, "%d",
973 GET_FIELD (insn, 22, 25));
976 fputs_filtered ("sar", info);
979 (*info->fprintf_func) (info->stream, "%d",
980 31 - GET_FIELD (insn, 22, 26));
985 num = GET_FIELD (insn, 20, 20) << 5;
986 num |= GET_FIELD (insn, 22, 26);
987 (*info->fprintf_func) (info->stream, "%d", 63 - num);
991 (*info->fprintf_func) (info->stream, "%d",
992 GET_FIELD (insn, 22, 26));
997 num = GET_FIELD (insn, 20, 20) << 5;
998 num |= GET_FIELD (insn, 22, 26);
999 (*info->fprintf_func) (info->stream, "%d", num);
1003 (*info->fprintf_func) (info->stream, "%d",
1004 32 - GET_FIELD (insn, 27, 31));
1009 num = (GET_FIELD (insn, 23, 23) + 1) * 32;
1010 num -= GET_FIELD (insn, 27, 31);
1011 (*info->fprintf_func) (info->stream, "%d", num);
1017 num = (GET_FIELD (insn, 19, 19) + 1) * 32;
1018 num -= GET_FIELD (insn, 27, 31);
1019 (*info->fprintf_func) (info->stream, "%d", num);
1023 fput_const (GET_FIELD (insn, 20, 28), info);
1026 fput_const (GET_FIELD (insn, 6, 18), info);
1029 fput_const (GET_FIELD (insn, 6, 31), info);
1032 (*info->fprintf_func) (info->stream, ",%d",
1033 GET_FIELD (insn, 23, 25));
1036 fput_const ((GET_FIELD (insn, 6,20) << 5 |
1037 GET_FIELD (insn, 27, 31)), info);
1040 fput_const (GET_FIELD (insn, 6, 20), info);
1043 fput_const ((GET_FIELD (insn, 6, 22) << 5 |
1044 GET_FIELD (insn, 27, 31)), info);
1047 fput_const ((GET_FIELD (insn, 11, 20) << 5 |
1048 GET_FIELD (insn, 27, 31)), info);
1051 fput_const ((GET_FIELD (insn, 16, 20) << 5 |
1052 GET_FIELD (insn, 27, 31)), info);
1055 (*info->fprintf_func) (info->stream, ",%d",
1056 GET_FIELD (insn, 23, 25));
1059 /* If no destination completer and not before a completer
1060 for fcmp, need a space here. */
1061 if (s[1] == 'G' || s[1] == '?')
1063 (float_format_names[GET_FIELD (insn, 19, 20)], info);
1065 (*info->fprintf_func)
1066 (info->stream, "%s ",
1067 float_format_names[GET_FIELD (insn, 19, 20)]);
1070 (*info->fprintf_func)
1071 (info->stream, "%s ",
1072 float_format_names[GET_FIELD (insn, 17, 18)]);
1075 if (GET_FIELD (insn, 26, 26) == 1)
1076 (*info->fprintf_func) (info->stream, "%s ",
1077 float_format_names[0]);
1079 (*info->fprintf_func) (info->stream, "%s ",
1080 float_format_names[1]);
1083 /* If no destination completer and not before a completer
1084 for fcmp, need a space here. */
1087 (float_format_names[GET_FIELD (insn, 20, 20)], info);
1089 (*info->fprintf_func)
1090 (info->stream, "%s ",
1091 float_format_names[GET_FIELD (insn, 20, 20)]);
1095 fput_const (extract_14 (insn), info);
1100 int sign = GET_FIELD (insn, 31, 31);
1101 int imm10 = GET_FIELD (insn, 18, 27);
1105 disp = (-1 << 10) | imm10;
1110 fput_const (disp, info);
1116 int sign = GET_FIELD (insn, 31, 31);
1117 int imm11 = GET_FIELD (insn, 18, 28);
1121 disp = (-1 << 11) | imm11;
1126 fput_const (disp, info);
1133 /* 16-bit long disp., PA2.0 wide only. */
1134 int disp = extract_16 (insn);
1136 fput_const (disp, info);
1142 /* 16-bit long disp., PA2.0 wide only. */
1143 int disp = extract_16 (insn);
1145 fput_const (disp, info);
1150 break; /* Dealt with by '{' */
1154 int sub = GET_FIELD (insn, 14, 16);
1155 int df = GET_FIELD (insn, 17, 18);
1156 int sf = GET_FIELD (insn, 19, 20);
1157 const char * const * source = float_format_names;
1158 const char * const * dest = float_format_names;
1163 fputs_filtered (",UND ", info);
1169 source = sub & 4 ? fcnv_ufixed_names : fcnv_fixed_names;
1171 dest = sub & 4 ? fcnv_ufixed_names : fcnv_fixed_names;
1173 (*info->fprintf_func) (info->stream, "%s%s%s ",
1174 t, source[sf], dest[df]);
1180 int y = GET_FIELD (insn, 16, 18);
1183 fput_const ((y ^ 1) - 1, info);
1191 cbit = GET_FIELD (insn, 16, 18);
1194 (*info->fprintf_func) (info->stream, ",%d", cbit - 1);
1200 int cond = GET_FIELD (insn, 27, 31);
1204 case 0: fputs_filtered (" ", info); break;
1205 case 1: fputs_filtered ("acc ", info); break;
1206 case 2: fputs_filtered ("rej ", info); break;
1207 case 5: fputs_filtered ("acc8 ", info); break;
1208 case 6: fputs_filtered ("rej8 ", info); break;
1209 case 9: fputs_filtered ("acc6 ", info); break;
1210 case 13: fputs_filtered ("acc4 ", info); break;
1211 case 17: fputs_filtered ("acc2 ", info); break;
1218 (*info->print_address_func)
1219 (memaddr + 8 + extract_22 (insn), info);
1222 fputs_filtered (",rp", info);
1225 (*info->fprintf_func) (info->stream, "%c", *s);
1229 return sizeof (insn);
1232 (*info->fprintf_func) (info->stream, "#%8x", insn);
1233 return sizeof (insn);