1 /* Disassembler for the PA-RISC. Somewhat derived from sparc-pinsn.c.
2 Copyright 1989, 1990, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001
3 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */
25 #include "opcode/hppa.h"
27 /* Integer register names, indexed by the numbers which appear in the
29 static 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",
35 /* Floating point register names, indexed by the numbers which appear in the
37 static 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"};
44 typedef unsigned int CORE_ADDR
;
46 /* Get at various relevent fields of an instruction word. */
51 #define MASK_14 0x3fff
52 #define MASK_16 0xffff
53 #define MASK_21 0x1fffff
55 /* These macros get bit fields using HP's numbering (MSB = 0) */
57 #define GET_FIELD(X, FROM, TO) \
58 ((X) >> (31 - (TO)) & ((1 << ((TO) - (FROM) + 1)) - 1))
60 #define GET_BIT(X, WHICH) \
61 GET_FIELD (X, WHICH, WHICH)
63 /* Some of these have been converted to 2-d arrays because they
64 consume less storage this way. If the maintenance becomes a
65 problem, convert them back to const 1-d pointer arrays. */
66 static const char *const control_reg
[] = {
67 "rctr", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7",
68 "pidr1", "pidr2", "ccr", "sar", "pidr3", "pidr4",
69 "iva", "eiem", "itmr", "pcsq", "pcoq", "iir", "isr",
70 "ior", "ipsw", "eirr", "tr0", "tr1", "tr2", "tr3",
71 "tr4", "tr5", "tr6", "tr7"
74 static const char *const compare_cond_names
[] = {
75 "", ",=", ",<", ",<=", ",<<", ",<<=", ",sv", ",od",
76 ",tr", ",<>", ",>=", ",>", ",>>=", ",>>", ",nsv", ",ev"
78 static const char *const compare_cond_64_names
[] = {
79 "", ",*=", ",*<", ",*<=", ",*<<", ",*<<=", ",*sv", ",*od",
80 ",*tr", ",*<>", ",*>=", ",*>", ",*>>=", ",*>>", ",*nsv", ",*ev"
82 static const char *const cmpib_cond_64_names
[] = {
83 ",*<<", ",*=", ",*<", ",*<=", ",*>>=", ",*<>", ",*>=", ",*>"
85 static const char *const add_cond_names
[] = {
86 "", ",=", ",<", ",<=", ",nuv", ",znv", ",sv", ",od",
87 ",tr", ",<>", ",>=", ",>", ",uv", ",vnz", ",nsv", ",ev"
89 static const char *const add_cond_64_names
[] = {
90 "", ",*=", ",*<", ",*<=", ",*nuv", ",*znv", ",*sv", ",*od",
91 ",*tr", ",*<>", ",*>=", ",*>", ",*uv", ",*vnz", ",*nsv", ",*ev"
93 static const char *const wide_add_cond_names
[] = {
94 "", ",=", ",<", ",<=", ",nuv", ",*=", ",*<", ",*<=",
95 ",tr", ",<>", ",>=", ",>", ",uv", ",*<>", ",*>=", ",*>"
97 static const char *const logical_cond_names
[] = {
98 "", ",=", ",<", ",<=", 0, 0, 0, ",od",
99 ",tr", ",<>", ",>=", ",>", 0, 0, 0, ",ev"};
100 static const char *const logical_cond_64_names
[] = {
101 "", ",*=", ",*<", ",*<=", 0, 0, 0, ",*od",
102 ",*tr", ",*<>", ",*>=", ",*>", 0, 0, 0, ",*ev"};
103 static const char *const unit_cond_names
[] = {
104 "", ",swz", ",sbz", ",shz", ",sdc", ",swc", ",sbc", ",shc",
105 ",tr", ",nwz", ",nbz", ",nhz", ",ndc", ",nwc", ",nbc", ",nhc"
107 static const char *const unit_cond_64_names
[] = {
108 "", ",*swz", ",*sbz", ",*shz", ",*sdc", ",*swc", ",*sbc", ",*shc",
109 ",*tr", ",*nwz", ",*nbz", ",*nhz", ",*ndc", ",*nwc", ",*nbc", ",*nhc"
111 static const char *const shift_cond_names
[] = {
112 "", ",=", ",<", ",od", ",tr", ",<>", ",>=", ",ev"
114 static const char *const shift_cond_64_names
[] = {
115 "", ",*=", ",*<", ",*od", ",*tr", ",*<>", ",*>=", ",*ev"
117 static const char *const bb_cond_64_names
[] = {
120 static const char *const index_compl_names
[] = {"", ",m", ",s", ",sm"};
121 static const char *const short_ldst_compl_names
[] = {"", ",ma", "", ",mb"};
122 static const char *const short_bytes_compl_names
[] = {
123 "", ",b,m", ",e", ",e,m"
125 static const char *const float_format_names
[] = {",sgl", ",dbl", "", ",quad"};
126 static const char *const float_comp_names
[] =
128 ",false?", ",false", ",?", ",!<=>", ",=", ",=t", ",?=", ",!<>",
129 ",!?>=", ",<", ",?<", ",!>=", ",!?>", ",<=", ",?<=", ",!>",
130 ",!?<=", ",>", ",?>", ",!<=", ",!?<", ",>=", ",?>=", ",!<",
131 ",!?=", ",<>", ",!=", ",!=t", ",!?", ",<=>", ",true?", ",true"
133 static const char *const signed_unsigned_names
[] = {",u", ",s"};
134 static const char *const mix_half_names
[] = {",l", ",r"};
135 static const char *const saturation_names
[] = {",us", ",ss", 0, ""};
136 static const char *const read_write_names
[] = {",r", ",w"};
137 static const char *const add_compl_names
[] = { 0, "", ",l", ",tsv" };
139 /* For a bunch of different instructions form an index into a
140 completer name table. */
141 #define GET_COMPL(insn) (GET_FIELD (insn, 26, 26) | \
142 GET_FIELD (insn, 18, 18) << 1)
144 #define GET_COND(insn) (GET_FIELD ((insn), 16, 18) + \
145 (GET_FIELD ((insn), 19, 19) ? 8 : 0))
147 static void fput_reg
PARAMS ((unsigned int, disassemble_info
*));
148 static void fput_fp_reg
PARAMS ((unsigned int, disassemble_info
*));
149 static void fput_fp_reg_r
PARAMS ((unsigned int, disassemble_info
*));
150 static void fput_creg
PARAMS ((unsigned int, disassemble_info
*));
151 static void fput_const
PARAMS ((unsigned int, disassemble_info
*));
152 static int extract_3
PARAMS ((unsigned int));
153 static int extract_5_load
PARAMS ((unsigned int));
154 static int extract_5_store
PARAMS ((unsigned int));
155 static unsigned extract_5r_store
PARAMS ((unsigned int));
156 static unsigned extract_5R_store
PARAMS ((unsigned int));
157 static unsigned extract_10U_store
PARAMS ((unsigned int));
158 static unsigned extract_5Q_store
PARAMS ((unsigned int));
159 static int extract_11
PARAMS ((unsigned int));
160 static int extract_14
PARAMS ((unsigned int));
161 static int extract_16
PARAMS ((unsigned int));
162 static int extract_21
PARAMS ((unsigned int));
163 static int extract_12
PARAMS ((unsigned int));
164 static int extract_17
PARAMS ((unsigned int));
165 static int extract_22
PARAMS ((unsigned int));
167 /* Utility function to print registers. Put these first, so gcc's function
168 inlining can do its stuff. */
170 #define fputs_filtered(STR,F) (*info->fprintf_func) (info->stream, "%s", STR)
175 disassemble_info
*info
;
177 (*info
->fprintf_func
) (info
->stream
, reg
? reg_names
[reg
] : "r0");
181 fput_fp_reg (reg
, info
)
183 disassemble_info
*info
;
185 (*info
->fprintf_func
) (info
->stream
, reg
? fp_reg_names
[reg
] : "fr0");
189 fput_fp_reg_r (reg
, info
)
191 disassemble_info
*info
;
193 /* Special case floating point exception registers. */
195 (*info
->fprintf_func
) (info
->stream
, "fpe%d", reg
* 2 + 1);
197 (*info
->fprintf_func
) (info
->stream
, "%sR", reg
? fp_reg_names
[reg
]
202 fput_creg (reg
, info
)
204 disassemble_info
*info
;
206 (*info
->fprintf_func
) (info
->stream
, control_reg
[reg
]);
209 /* Print constants with sign. */
212 fput_const (num
, info
)
214 disassemble_info
*info
;
217 (*info
->fprintf_func
) (info
->stream
, "-%x", -(int)num
);
219 (*info
->fprintf_func
) (info
->stream
, "%x", num
);
222 /* Routines to extract various sized constants out of hppa
225 /* Extract a 3-bit space register number from a be, ble, mtsp or mfsp. */
230 return GET_FIELD (word
, 18, 18) << 2 | GET_FIELD (word
, 16, 17);
234 extract_5_load (word
)
237 return low_sign_extend (word
>> 16 & MASK_5
, 5);
240 /* Extract the immediate field from a st{bhw}s instruction. */
242 extract_5_store (word
)
245 return low_sign_extend (word
& MASK_5
, 5);
248 /* Extract the immediate field from a break instruction. */
250 extract_5r_store (word
)
253 return (word
& MASK_5
);
256 /* Extract the immediate field from a {sr}sm instruction. */
258 extract_5R_store (word
)
261 return (word
>> 16 & MASK_5
);
264 /* Extract the 10 bit immediate field from a {sr}sm instruction. */
266 extract_10U_store (word
)
269 return (word
>> 16 & MASK_10
);
272 /* Extract the immediate field from a bb instruction. */
274 extract_5Q_store (word
)
277 return (word
>> 21 & MASK_5
);
280 /* Extract an 11 bit immediate field. */
285 return low_sign_extend (word
& MASK_11
, 11);
288 /* Extract a 14 bit immediate field. */
293 return low_sign_extend (word
& MASK_14
, 14);
296 /* Extract a 16 bit immediate field (PA2.0 wide only). */
302 m0
= GET_BIT (word
, 16);
303 m1
= GET_BIT (word
, 17);
304 m15
= GET_BIT (word
, 31);
305 word
= (word
>> 1) & 0x1fff;
306 word
= word
| (m15
<< 15) | ((m15
^ m0
) << 14) | ((m15
^ m1
) << 13);
307 return sign_extend (word
, 16);
310 /* Extract a 21 bit constant. */
320 val
= GET_FIELD (word
, 20, 20);
322 val
|= GET_FIELD (word
, 9, 19);
324 val
|= GET_FIELD (word
, 5, 6);
326 val
|= GET_FIELD (word
, 0, 4);
328 val
|= GET_FIELD (word
, 7, 8);
329 return sign_extend (val
, 21) << 11;
332 /* Extract a 12 bit constant from branch instructions. */
338 return sign_extend (GET_FIELD (word
, 19, 28) |
339 GET_FIELD (word
, 29, 29) << 10 |
340 (word
& 0x1) << 11, 12) << 2;
343 /* Extract a 17 bit constant from branch instructions, returning the
344 19 bit signed value. */
350 return sign_extend (GET_FIELD (word
, 19, 28) |
351 GET_FIELD (word
, 29, 29) << 10 |
352 GET_FIELD (word
, 11, 15) << 11 |
353 (word
& 0x1) << 16, 17) << 2;
360 return sign_extend (GET_FIELD (word
, 19, 28) |
361 GET_FIELD (word
, 29, 29) << 10 |
362 GET_FIELD (word
, 11, 15) << 11 |
363 GET_FIELD (word
, 6, 10) << 16 |
364 (word
& 0x1) << 21, 22) << 2;
367 /* Print one instruction. */
369 print_insn_hppa (memaddr
, info
)
371 disassemble_info
*info
;
374 unsigned int insn
, i
;
378 (*info
->read_memory_func
) (memaddr
, buffer
, sizeof (buffer
), info
);
381 (*info
->memory_error_func
) (status
, memaddr
, info
);
386 insn
= bfd_getb32 (buffer
);
388 for (i
= 0; i
< NUMOPCODES
; ++i
)
390 const struct pa_opcode
*opcode
= &pa_opcodes
[i
];
391 if ((insn
& opcode
->mask
) == opcode
->match
)
393 register const char *s
;
395 if (opcode
->arch
== pa20w
)
398 (*info
->fprintf_func
) (info
->stream
, "%s", opcode
->name
);
400 if (!strchr ("cfCY?-+nHNZFIuv", opcode
->args
[0]))
401 (*info
->fprintf_func
) (info
->stream
, " ");
402 for (s
= opcode
->args
; *s
!= '\0'; ++s
)
407 fput_reg (GET_FIELD (insn
, 11, 15), info
);
411 fput_reg (GET_FIELD (insn
, 6, 10), info
);
414 fput_creg (GET_FIELD (insn
, 6, 10), info
);
417 fput_reg (GET_FIELD (insn
, 27, 31), info
);
420 /* Handle floating point registers. */
425 fput_fp_reg (GET_FIELD (insn
, 27, 31), info
);
428 if (GET_FIELD (insn
, 25, 25))
429 fput_fp_reg_r (GET_FIELD (insn
, 27, 31), info
);
431 fput_fp_reg (GET_FIELD (insn
, 27, 31), info
);
434 if (GET_FIELD (insn
, 25, 25))
435 fput_fp_reg_r (GET_FIELD (insn
, 6, 10), info
);
437 fput_fp_reg (GET_FIELD (insn
, 6, 10), info
);
440 /* 'fA' will not generate a space before the regsiter
441 name. Normally that is fine. Except that it
442 causes problems with xmpyu which has no FP format
445 fputs_filtered (" ", info
);
450 if (GET_FIELD (insn
, 24, 24))
451 fput_fp_reg_r (GET_FIELD (insn
, 6, 10), info
);
453 fput_fp_reg (GET_FIELD (insn
, 6, 10), info
);
457 if (GET_FIELD (insn
, 25, 25))
458 fput_fp_reg_r (GET_FIELD (insn
, 11, 15), info
);
460 fput_fp_reg (GET_FIELD (insn
, 11, 15), info
);
463 if (GET_FIELD (insn
, 19, 19))
464 fput_fp_reg_r (GET_FIELD (insn
, 11, 15), info
);
466 fput_fp_reg (GET_FIELD (insn
, 11, 15), info
);
470 int reg
= GET_FIELD (insn
, 21, 22);
471 reg
|= GET_FIELD (insn
, 16, 18) << 2;
472 if (GET_FIELD (insn
, 23, 23) != 0)
473 fput_fp_reg_r (reg
, info
);
475 fput_fp_reg (reg
, info
);
480 int reg
= GET_FIELD (insn
, 6, 10);
482 reg
|= (GET_FIELD (insn
, 26, 26) << 4);
483 fput_fp_reg (reg
, info
);
488 int reg
= GET_FIELD (insn
, 11, 15);
490 reg
|= (GET_FIELD (insn
, 26, 26) << 4);
491 fput_fp_reg (reg
, info
);
496 int reg
= GET_FIELD (insn
, 27, 31);
498 reg
|= (GET_FIELD (insn
, 26, 26) << 4);
499 fput_fp_reg (reg
, info
);
504 int reg
= GET_FIELD (insn
, 21, 25);
506 reg
|= (GET_FIELD (insn
, 26, 26) << 4);
507 fput_fp_reg (reg
, info
);
512 int reg
= GET_FIELD (insn
, 16, 20);
514 reg
|= (GET_FIELD (insn
, 26, 26) << 4);
515 fput_fp_reg (reg
, info
);
519 /* 'fe' will not generate a space before the register
520 name. Normally that is fine. Except that it
521 causes problems with fstw fe,y(b) which has no FP
524 fputs_filtered (" ", info
);
529 if (GET_FIELD (insn
, 30, 30))
530 fput_fp_reg_r (GET_FIELD (insn
, 11, 15), info
);
532 fput_fp_reg (GET_FIELD (insn
, 11, 15), info
);
535 fput_fp_reg (GET_FIELD (insn
, 11, 15), info
);
541 fput_const (extract_5_load (insn
), info
);
544 (*info
->fprintf_func
) (info
->stream
,
545 "sr%d", GET_FIELD (insn
, 16, 17));
549 (*info
->fprintf_func
) (info
->stream
, "sr%d", extract_3 (insn
));
552 /* Handle completers. */
557 (*info
->fprintf_func
) (info
->stream
, "%s",
558 index_compl_names
[GET_COMPL (insn
)]);
561 (*info
->fprintf_func
) (info
->stream
, "%s ",
562 index_compl_names
[GET_COMPL (insn
)]);
565 (*info
->fprintf_func
) (info
->stream
, "%s",
566 short_ldst_compl_names
[GET_COMPL (insn
)]);
569 (*info
->fprintf_func
) (info
->stream
, "%s ",
570 short_ldst_compl_names
[GET_COMPL (insn
)]);
573 (*info
->fprintf_func
) (info
->stream
, "%s ",
574 short_bytes_compl_names
[GET_COMPL (insn
)]);
577 (*info
->fprintf_func
) (info
->stream
, "%s",
578 short_bytes_compl_names
[GET_COMPL (insn
)]);
582 switch (GET_FIELD (insn
, 20, 21))
585 (*info
->fprintf_func
) (info
->stream
, ",bc ");
588 (*info
->fprintf_func
) (info
->stream
, ",sl ");
591 (*info
->fprintf_func
) (info
->stream
, " ");
595 switch (GET_FIELD (insn
, 20, 21))
598 (*info
->fprintf_func
) (info
->stream
, ",co ");
601 (*info
->fprintf_func
) (info
->stream
, " ");
605 (*info
->fprintf_func
) (info
->stream
, ",o");
608 (*info
->fprintf_func
) (info
->stream
, ",gate");
611 (*info
->fprintf_func
) (info
->stream
, ",l,push");
614 (*info
->fprintf_func
) (info
->stream
, ",pop");
618 (*info
->fprintf_func
) (info
->stream
, ",l");
621 (*info
->fprintf_func
) (info
->stream
, "%s ",
622 read_write_names
[GET_FIELD (insn
, 25, 25)]);
625 (*info
->fprintf_func
) (info
->stream
, ",w");
628 if (GET_FIELD (insn
, 23, 26) == 5)
629 (*info
->fprintf_func
) (info
->stream
, ",r");
632 if (GET_FIELD (insn
, 26, 26))
633 (*info
->fprintf_func
) (info
->stream
, ",m ");
635 (*info
->fprintf_func
) (info
->stream
, " ");
638 if (GET_FIELD (insn
, 25, 25))
639 (*info
->fprintf_func
) (info
->stream
, ",i");
642 if (!GET_FIELD (insn
, 21, 21))
643 (*info
->fprintf_func
) (info
->stream
, ",z");
646 (*info
->fprintf_func
)
647 (info
->stream
, "%s", add_compl_names
[GET_FIELD
651 (*info
->fprintf_func
)
652 (info
->stream
, ",dc%s", add_compl_names
[GET_FIELD
656 (*info
->fprintf_func
)
657 (info
->stream
, ",c%s", add_compl_names
[GET_FIELD
661 if (GET_FIELD (insn
, 20, 20))
662 (*info
->fprintf_func
) (info
->stream
, ",tsv");
665 (*info
->fprintf_func
) (info
->stream
, ",tc");
666 if (GET_FIELD (insn
, 20, 20))
667 (*info
->fprintf_func
) (info
->stream
, ",tsv");
670 (*info
->fprintf_func
) (info
->stream
, ",db");
671 if (GET_FIELD (insn
, 20, 20))
672 (*info
->fprintf_func
) (info
->stream
, ",tsv");
675 (*info
->fprintf_func
) (info
->stream
, ",b");
676 if (GET_FIELD (insn
, 20, 20))
677 (*info
->fprintf_func
) (info
->stream
, ",tsv");
680 if (GET_FIELD (insn
, 25, 25))
681 (*info
->fprintf_func
) (info
->stream
, ",tc");
684 /* EXTRD/W has a following condition. */
686 (*info
->fprintf_func
)
687 (info
->stream
, "%s", signed_unsigned_names
[GET_FIELD
690 (*info
->fprintf_func
)
691 (info
->stream
, "%s ", signed_unsigned_names
[GET_FIELD
695 (*info
->fprintf_func
)
696 (info
->stream
, "%s", mix_half_names
[GET_FIELD
700 (*info
->fprintf_func
)
701 (info
->stream
, "%s ", saturation_names
[GET_FIELD
705 (*info
->fprintf_func
)
706 (info
->stream
, ",%d%d%d%d ",
707 GET_FIELD (insn
, 17, 18), GET_FIELD (insn
, 20, 21),
708 GET_FIELD (insn
, 22, 23), GET_FIELD (insn
, 24, 25));
715 m
= GET_FIELD (insn
, 28, 28);
716 a
= GET_FIELD (insn
, 29, 29);
719 fputs_filtered (",ma ", info
);
721 fputs_filtered (",mb ", info
);
723 fputs_filtered (" ", info
);
729 int opc
= GET_FIELD (insn
, 0, 5);
731 if (opc
== 0x16 || opc
== 0x1e)
733 if (GET_FIELD (insn
, 29, 29) == 0)
734 fputs_filtered (",ma ", info
);
736 fputs_filtered (",mb ", info
);
739 fputs_filtered (" ", info
);
745 int opc
= GET_FIELD (insn
, 0, 5);
747 if (opc
== 0x13 || opc
== 0x1b)
749 if (GET_FIELD (insn
, 18, 18) == 1)
750 fputs_filtered (",mb ", info
);
752 fputs_filtered (",ma ", info
);
754 else if (opc
== 0x17 || opc
== 0x1f)
756 if (GET_FIELD (insn
, 31, 31) == 1)
757 fputs_filtered (",ma ", info
);
759 fputs_filtered (",mb ", info
);
762 fputs_filtered (" ", info
);
769 /* Handle conditions. */
776 (*info
->fprintf_func
) (info
->stream
, "%s ",
777 float_comp_names
[GET_FIELD
781 /* these four conditions are for the set of instructions
782 which distinguish true/false conditions by opcode
783 rather than by the 'f' bit (sigh): comb, comib,
786 fputs_filtered (compare_cond_names
[GET_FIELD (insn
, 16, 18)],
790 fputs_filtered (compare_cond_names
[GET_FIELD (insn
, 16, 18)
791 + GET_FIELD (insn
, 4, 4) * 8], info
);
794 fputs_filtered (compare_cond_64_names
[GET_FIELD (insn
, 16, 18)
795 + GET_FIELD (insn
, 2, 2) * 8], info
);
798 fputs_filtered (cmpib_cond_64_names
[GET_FIELD (insn
, 16, 18)],
802 fputs_filtered (add_cond_names
[GET_FIELD (insn
, 16, 18)
803 + GET_FIELD (insn
, 4, 4) * 8], info
);
806 (*info
->fprintf_func
) (info
->stream
, "%s ",
807 compare_cond_names
[GET_COND (insn
)]);
810 (*info
->fprintf_func
) (info
->stream
, "%s ",
811 compare_cond_64_names
[GET_COND (insn
)]);
814 (*info
->fprintf_func
) (info
->stream
, "%s ",
815 add_cond_names
[GET_COND (insn
)]);
818 (*info
->fprintf_func
) (info
->stream
, "%s ",
819 add_cond_64_names
[GET_COND (insn
)]);
822 (*info
->fprintf_func
) (info
->stream
, "%s",
823 add_cond_names
[GET_FIELD (insn
, 16, 18)]);
827 (*info
->fprintf_func
)
829 wide_add_cond_names
[GET_FIELD (insn
, 16, 18) +
830 GET_FIELD (insn
, 4, 4) * 8]);
834 (*info
->fprintf_func
) (info
->stream
, "%s ",
835 logical_cond_names
[GET_COND (insn
)]);
838 (*info
->fprintf_func
) (info
->stream
, "%s ",
839 logical_cond_64_names
[GET_COND (insn
)]);
842 (*info
->fprintf_func
) (info
->stream
, "%s ",
843 unit_cond_names
[GET_COND (insn
)]);
846 (*info
->fprintf_func
) (info
->stream
, "%s ",
847 unit_cond_64_names
[GET_COND (insn
)]);
852 (*info
->fprintf_func
)
854 shift_cond_names
[GET_FIELD (insn
, 16, 18)]);
856 /* If the next character in args is 'n', it will handle
857 putting out the space. */
859 (*info
->fprintf_func
) (info
->stream
, " ");
862 (*info
->fprintf_func
) (info
->stream
, "%s ",
863 shift_cond_64_names
[GET_FIELD (insn
, 16, 18)]);
866 (*info
->fprintf_func
)
868 bb_cond_64_names
[GET_FIELD (insn
, 16, 16)]);
870 /* If the next character in args is 'n', it will handle
871 putting out the space. */
873 (*info
->fprintf_func
) (info
->stream
, " ");
880 fput_const (extract_5_store (insn
), info
);
883 fput_const (extract_5r_store (insn
), info
);
886 fput_const (extract_5R_store (insn
), info
);
889 fput_const (extract_10U_store (insn
), info
);
893 fput_const (extract_5Q_store (insn
), info
);
896 fput_const (extract_11 (insn
), info
);
899 fput_const (extract_14 (insn
), info
);
902 fput_const (extract_21 (insn
), info
);
906 /* 16-bit long disp., PA2.0 wide only. */
907 fput_const (extract_16 (insn
), info
);
911 (*info
->fprintf_func
) (info
->stream
, ",n ");
913 (*info
->fprintf_func
) (info
->stream
, " ");
916 if ((insn
& 0x20) && s
[1])
917 (*info
->fprintf_func
) (info
->stream
, ",n ");
918 else if (insn
& 0x20)
919 (*info
->fprintf_func
) (info
->stream
, ",n");
921 (*info
->fprintf_func
) (info
->stream
, " ");
924 (*info
->print_address_func
) (memaddr
+ 8 + extract_12 (insn
),
928 /* 17 bit PC-relative branch. */
929 (*info
->print_address_func
) ((memaddr
+ 8
930 + extract_17 (insn
)),
934 /* 17 bit displacement. This is an offset from a register
935 so it gets disasssembled as just a number, not any sort
937 fput_const (extract_17 (insn
), info
);
941 /* addil %r1 implicit output. */
942 (*info
->fprintf_func
) (info
->stream
, "%%r1");
946 /* be,l %sr0,%r31 implicit output. */
947 (*info
->fprintf_func
) (info
->stream
, "%%sr0,%%r31");
951 (*info
->fprintf_func
) (info
->stream
, "0");
955 (*info
->fprintf_func
) (info
->stream
, "%d",
956 GET_FIELD (insn
, 24, 25));
959 (*info
->fprintf_func
) (info
->stream
, "%d",
960 GET_FIELD (insn
, 22, 25));
963 (*info
->fprintf_func
) (info
->stream
, "%%sar");
966 (*info
->fprintf_func
) (info
->stream
, "%d",
967 31 - GET_FIELD (insn
, 22, 26));
972 num
= GET_FIELD (insn
, 20, 20) << 5;
973 num
|= GET_FIELD (insn
, 22, 26);
974 (*info
->fprintf_func
) (info
->stream
, "%d", 63 - num
);
978 (*info
->fprintf_func
) (info
->stream
, "%d",
979 GET_FIELD (insn
, 22, 26));
984 num
= GET_FIELD (insn
, 20, 20) << 5;
985 num
|= GET_FIELD (insn
, 22, 26);
986 (*info
->fprintf_func
) (info
->stream
, "%d", num
);
990 (*info
->fprintf_func
) (info
->stream
, "%d",
991 32 - GET_FIELD (insn
, 27, 31));
996 num
= (GET_FIELD (insn
, 23, 23) + 1) * 32;
997 num
-= GET_FIELD (insn
, 27, 31);
998 (*info
->fprintf_func
) (info
->stream
, "%d", num
);
1004 num
= (GET_FIELD (insn
, 19, 19) + 1) * 32;
1005 num
-= GET_FIELD (insn
, 27, 31);
1006 (*info
->fprintf_func
) (info
->stream
, "%d", num
);
1010 fput_const (GET_FIELD (insn
, 20, 28), info
);
1013 fput_const (GET_FIELD (insn
, 6, 18), info
);
1016 fput_const (GET_FIELD (insn
, 6, 31), info
);
1019 (*info
->fprintf_func
) (info
->stream
, ",%d", GET_FIELD (insn
, 23, 25));
1022 fput_const ((GET_FIELD (insn
, 6,20) << 5 |
1023 GET_FIELD (insn
, 27, 31)), info
);
1026 fput_const (GET_FIELD (insn
, 6, 20), info
);
1029 fput_const ((GET_FIELD (insn
, 6, 22) << 5 |
1030 GET_FIELD (insn
, 27, 31)), info
);
1033 fput_const ((GET_FIELD (insn
, 11, 20) << 5 |
1034 GET_FIELD (insn
, 27, 31)), info
);
1037 fput_const ((GET_FIELD (insn
, 16, 20) << 5 |
1038 GET_FIELD (insn
, 27, 31)), info
);
1041 (*info
->fprintf_func
) (info
->stream
, ",%d", GET_FIELD (insn
, 23, 25));
1044 /* if no destination completer and not before a completer
1045 for fcmp, need a space here */
1046 if (s
[1] == 'G' || s
[1] == '?')
1047 fputs_filtered (float_format_names
[GET_FIELD (insn
, 19, 20)],
1050 (*info
->fprintf_func
) (info
->stream
, "%s ",
1051 float_format_names
[GET_FIELD
1055 (*info
->fprintf_func
) (info
->stream
, "%s ",
1056 float_format_names
[GET_FIELD (insn
,
1060 if (GET_FIELD (insn
, 26, 26) == 1)
1061 (*info
->fprintf_func
) (info
->stream
, "%s ",
1062 float_format_names
[0]);
1064 (*info
->fprintf_func
) (info
->stream
, "%s ",
1065 float_format_names
[1]);
1068 /* if no destination completer and not before a completer
1069 for fcmp, need a space here */
1071 fputs_filtered (float_format_names
[GET_FIELD (insn
, 20, 20)],
1074 (*info
->fprintf_func
) (info
->stream
, "%s ",
1075 float_format_names
[GET_FIELD
1080 fput_const (extract_14 (insn
), info
);
1085 int sign
= GET_FIELD (insn
, 31, 31);
1086 int imm10
= GET_FIELD (insn
, 18, 27);
1090 disp
= (-1 << 10) | imm10
;
1095 fput_const (disp
, info
);
1101 int sign
= GET_FIELD (insn
, 31, 31);
1102 int imm11
= GET_FIELD (insn
, 18, 28);
1106 disp
= (-1 << 11) | imm11
;
1111 fput_const (disp
, info
);
1118 /* 16-bit long disp., PA2.0 wide only. */
1119 int disp
= extract_16 (insn
);
1121 fput_const (disp
, info
);
1127 /* 16-bit long disp., PA2.0 wide only. */
1128 int disp
= extract_16 (insn
);
1130 fput_const (disp
, info
);
1137 fputs_filtered ("Disassembler botch.\n", info
);
1142 int y
= GET_FIELD (insn
, 16, 18);
1145 fput_const ((y
^ 1) - 1, info
);
1153 cbit
= GET_FIELD (insn
, 16, 18);
1156 (*info
->fprintf_func
) (info
->stream
, ",%d", cbit
- 1);
1162 int cond
= GET_FIELD (insn
, 27, 31);
1165 fputs_filtered (" ", info
);
1167 fputs_filtered ("acc ", info
);
1169 fputs_filtered ("rej ", info
);
1171 fputs_filtered ("acc8 ", info
);
1173 fputs_filtered ("rej8 ", info
);
1175 fputs_filtered ("acc6 ", info
);
1176 else if (cond
== 13)
1177 fputs_filtered ("acc4 ", info
);
1178 else if (cond
== 17)
1179 fputs_filtered ("acc2 ", info
);
1184 (*info
->print_address_func
) ((memaddr
+ 8
1185 + extract_22 (insn
)),
1189 fputs_filtered (",%r2", info
);
1192 (*info
->fprintf_func
) (info
->stream
, "%c", *s
);
1196 return sizeof(insn
);
1199 (*info
->fprintf_func
) (info
->stream
, "#%8x", insn
);
1200 return sizeof(insn
);