1*3d8817e4Smiod /* Disassembler for the PA-RISC. Somewhat derived from sparc-pinsn.c.
2*3d8817e4Smiod Copyright 1989, 1990, 1992, 1993, 1994, 1995, 1998, 1999, 2000, 2001, 2003,
3*3d8817e4Smiod 2005 Free Software Foundation, Inc.
4*3d8817e4Smiod
5*3d8817e4Smiod Contributed by the Center for Software Science at the
6*3d8817e4Smiod University of Utah (pa-gdb-bugs@cs.utah.edu).
7*3d8817e4Smiod
8*3d8817e4Smiod This program is free software; you can redistribute it and/or modify
9*3d8817e4Smiod it under the terms of the GNU General Public License as published by
10*3d8817e4Smiod the Free Software Foundation; either version 2 of the License, or
11*3d8817e4Smiod (at your option) any later version.
12*3d8817e4Smiod
13*3d8817e4Smiod This program is distributed in the hope that it will be useful,
14*3d8817e4Smiod but WITHOUT ANY WARRANTY; without even the implied warranty of
15*3d8817e4Smiod MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16*3d8817e4Smiod GNU General Public License for more details.
17*3d8817e4Smiod
18*3d8817e4Smiod You should have received a copy of the GNU General Public License
19*3d8817e4Smiod along with this program; if not, write to the Free Software
20*3d8817e4Smiod Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
21*3d8817e4Smiod MA 02110-1301, USA. */
22*3d8817e4Smiod
23*3d8817e4Smiod #include "sysdep.h"
24*3d8817e4Smiod #include "dis-asm.h"
25*3d8817e4Smiod #include "libhppa.h"
26*3d8817e4Smiod #include "opcode/hppa.h"
27*3d8817e4Smiod
28*3d8817e4Smiod /* Integer register names, indexed by the numbers which appear in the
29*3d8817e4Smiod opcodes. */
30*3d8817e4Smiod static const char *const reg_names[] =
31*3d8817e4Smiod {
32*3d8817e4Smiod "flags", "r1", "rp", "r3", "r4", "r5", "r6", "r7", "r8", "r9",
33*3d8817e4Smiod "r10", "r11", "r12", "r13", "r14", "r15", "r16", "r17", "r18", "r19",
34*3d8817e4Smiod "r20", "r21", "r22", "r23", "r24", "r25", "r26", "dp", "ret0", "ret1",
35*3d8817e4Smiod "sp", "r31"
36*3d8817e4Smiod };
37*3d8817e4Smiod
38*3d8817e4Smiod /* Floating point register names, indexed by the numbers which appear in the
39*3d8817e4Smiod opcodes. */
40*3d8817e4Smiod static const char *const fp_reg_names[] =
41*3d8817e4Smiod {
42*3d8817e4Smiod "fpsr", "fpe2", "fpe4", "fpe6",
43*3d8817e4Smiod "fr4", "fr5", "fr6", "fr7", "fr8",
44*3d8817e4Smiod "fr9", "fr10", "fr11", "fr12", "fr13", "fr14", "fr15",
45*3d8817e4Smiod "fr16", "fr17", "fr18", "fr19", "fr20", "fr21", "fr22", "fr23",
46*3d8817e4Smiod "fr24", "fr25", "fr26", "fr27", "fr28", "fr29", "fr30", "fr31"
47*3d8817e4Smiod };
48*3d8817e4Smiod
49*3d8817e4Smiod typedef unsigned int CORE_ADDR;
50*3d8817e4Smiod
51*3d8817e4Smiod /* Get at various relevent fields of an instruction word. */
52*3d8817e4Smiod
53*3d8817e4Smiod #define MASK_5 0x1f
54*3d8817e4Smiod #define MASK_10 0x3ff
55*3d8817e4Smiod #define MASK_11 0x7ff
56*3d8817e4Smiod #define MASK_14 0x3fff
57*3d8817e4Smiod #define MASK_16 0xffff
58*3d8817e4Smiod #define MASK_21 0x1fffff
59*3d8817e4Smiod
60*3d8817e4Smiod /* These macros get bit fields using HP's numbering (MSB = 0). */
61*3d8817e4Smiod
62*3d8817e4Smiod #define GET_FIELD(X, FROM, TO) \
63*3d8817e4Smiod ((X) >> (31 - (TO)) & ((1 << ((TO) - (FROM) + 1)) - 1))
64*3d8817e4Smiod
65*3d8817e4Smiod #define GET_BIT(X, WHICH) \
66*3d8817e4Smiod GET_FIELD (X, WHICH, WHICH)
67*3d8817e4Smiod
68*3d8817e4Smiod /* Some of these have been converted to 2-d arrays because they
69*3d8817e4Smiod consume less storage this way. If the maintenance becomes a
70*3d8817e4Smiod problem, convert them back to const 1-d pointer arrays. */
71*3d8817e4Smiod static const char *const control_reg[] =
72*3d8817e4Smiod {
73*3d8817e4Smiod "rctr", "cr1", "cr2", "cr3", "cr4", "cr5", "cr6", "cr7",
74*3d8817e4Smiod "pidr1", "pidr2", "ccr", "sar", "pidr3", "pidr4",
75*3d8817e4Smiod "iva", "eiem", "itmr", "pcsq", "pcoq", "iir", "isr",
76*3d8817e4Smiod "ior", "ipsw", "eirr", "tr0", "tr1", "tr2", "tr3",
77*3d8817e4Smiod "tr4", "tr5", "tr6", "tr7"
78*3d8817e4Smiod };
79*3d8817e4Smiod
80*3d8817e4Smiod static const char *const compare_cond_names[] =
81*3d8817e4Smiod {
82*3d8817e4Smiod "", ",=", ",<", ",<=", ",<<", ",<<=", ",sv", ",od",
83*3d8817e4Smiod ",tr", ",<>", ",>=", ",>", ",>>=", ",>>", ",nsv", ",ev"
84*3d8817e4Smiod };
85*3d8817e4Smiod static const char *const compare_cond_64_names[] =
86*3d8817e4Smiod {
87*3d8817e4Smiod "", ",*=", ",*<", ",*<=", ",*<<", ",*<<=", ",*sv", ",*od",
88*3d8817e4Smiod ",*tr", ",*<>", ",*>=", ",*>", ",*>>=", ",*>>", ",*nsv", ",*ev"
89*3d8817e4Smiod };
90*3d8817e4Smiod static const char *const cmpib_cond_64_names[] =
91*3d8817e4Smiod {
92*3d8817e4Smiod ",*<<", ",*=", ",*<", ",*<=", ",*>>=", ",*<>", ",*>=", ",*>"
93*3d8817e4Smiod };
94*3d8817e4Smiod static const char *const add_cond_names[] =
95*3d8817e4Smiod {
96*3d8817e4Smiod "", ",=", ",<", ",<=", ",nuv", ",znv", ",sv", ",od",
97*3d8817e4Smiod ",tr", ",<>", ",>=", ",>", ",uv", ",vnz", ",nsv", ",ev"
98*3d8817e4Smiod };
99*3d8817e4Smiod static const char *const add_cond_64_names[] =
100*3d8817e4Smiod {
101*3d8817e4Smiod "", ",*=", ",*<", ",*<=", ",*nuv", ",*znv", ",*sv", ",*od",
102*3d8817e4Smiod ",*tr", ",*<>", ",*>=", ",*>", ",*uv", ",*vnz", ",*nsv", ",*ev"
103*3d8817e4Smiod };
104*3d8817e4Smiod static const char *const wide_add_cond_names[] =
105*3d8817e4Smiod {
106*3d8817e4Smiod "", ",=", ",<", ",<=", ",nuv", ",*=", ",*<", ",*<=",
107*3d8817e4Smiod ",tr", ",<>", ",>=", ",>", ",uv", ",*<>", ",*>=", ",*>"
108*3d8817e4Smiod };
109*3d8817e4Smiod static const char *const logical_cond_names[] =
110*3d8817e4Smiod {
111*3d8817e4Smiod "", ",=", ",<", ",<=", 0, 0, 0, ",od",
112*3d8817e4Smiod ",tr", ",<>", ",>=", ",>", 0, 0, 0, ",ev"};
113*3d8817e4Smiod static const char *const logical_cond_64_names[] =
114*3d8817e4Smiod {
115*3d8817e4Smiod "", ",*=", ",*<", ",*<=", 0, 0, 0, ",*od",
116*3d8817e4Smiod ",*tr", ",*<>", ",*>=", ",*>", 0, 0, 0, ",*ev"};
117*3d8817e4Smiod static const char *const unit_cond_names[] =
118*3d8817e4Smiod {
119*3d8817e4Smiod "", ",swz", ",sbz", ",shz", ",sdc", ",swc", ",sbc", ",shc",
120*3d8817e4Smiod ",tr", ",nwz", ",nbz", ",nhz", ",ndc", ",nwc", ",nbc", ",nhc"
121*3d8817e4Smiod };
122*3d8817e4Smiod static const char *const unit_cond_64_names[] =
123*3d8817e4Smiod {
124*3d8817e4Smiod "", ",*swz", ",*sbz", ",*shz", ",*sdc", ",*swc", ",*sbc", ",*shc",
125*3d8817e4Smiod ",*tr", ",*nwz", ",*nbz", ",*nhz", ",*ndc", ",*nwc", ",*nbc", ",*nhc"
126*3d8817e4Smiod };
127*3d8817e4Smiod static const char *const shift_cond_names[] =
128*3d8817e4Smiod {
129*3d8817e4Smiod "", ",=", ",<", ",od", ",tr", ",<>", ",>=", ",ev"
130*3d8817e4Smiod };
131*3d8817e4Smiod static const char *const shift_cond_64_names[] =
132*3d8817e4Smiod {
133*3d8817e4Smiod "", ",*=", ",*<", ",*od", ",*tr", ",*<>", ",*>=", ",*ev"
134*3d8817e4Smiod };
135*3d8817e4Smiod static const char *const bb_cond_64_names[] =
136*3d8817e4Smiod {
137*3d8817e4Smiod ",*<", ",*>="
138*3d8817e4Smiod };
139*3d8817e4Smiod static const char *const index_compl_names[] = {"", ",m", ",s", ",sm"};
140*3d8817e4Smiod static const char *const short_ldst_compl_names[] = {"", ",ma", "", ",mb"};
141*3d8817e4Smiod static const char *const short_bytes_compl_names[] =
142*3d8817e4Smiod {
143*3d8817e4Smiod "", ",b,m", ",e", ",e,m"
144*3d8817e4Smiod };
145*3d8817e4Smiod static const char *const float_format_names[] = {",sgl", ",dbl", "", ",quad"};
146*3d8817e4Smiod static const char *const fcnv_fixed_names[] = {",w", ",dw", "", ",qw"};
147*3d8817e4Smiod static const char *const fcnv_ufixed_names[] = {",uw", ",udw", "", ",uqw"};
148*3d8817e4Smiod static const char *const float_comp_names[] =
149*3d8817e4Smiod {
150*3d8817e4Smiod ",false?", ",false", ",?", ",!<=>", ",=", ",=t", ",?=", ",!<>",
151*3d8817e4Smiod ",!?>=", ",<", ",?<", ",!>=", ",!?>", ",<=", ",?<=", ",!>",
152*3d8817e4Smiod ",!?<=", ",>", ",?>", ",!<=", ",!?<", ",>=", ",?>=", ",!<",
153*3d8817e4Smiod ",!?=", ",<>", ",!=", ",!=t", ",!?", ",<=>", ",true?", ",true"
154*3d8817e4Smiod };
155*3d8817e4Smiod static const char *const signed_unsigned_names[] = {",u", ",s"};
156*3d8817e4Smiod static const char *const mix_half_names[] = {",l", ",r"};
157*3d8817e4Smiod static const char *const saturation_names[] = {",us", ",ss", 0, ""};
158*3d8817e4Smiod static const char *const read_write_names[] = {",r", ",w"};
159*3d8817e4Smiod static const char *const add_compl_names[] = { 0, "", ",l", ",tsv" };
160*3d8817e4Smiod
161*3d8817e4Smiod /* For a bunch of different instructions form an index into a
162*3d8817e4Smiod completer name table. */
163*3d8817e4Smiod #define GET_COMPL(insn) (GET_FIELD (insn, 26, 26) | \
164*3d8817e4Smiod GET_FIELD (insn, 18, 18) << 1)
165*3d8817e4Smiod
166*3d8817e4Smiod #define GET_COND(insn) (GET_FIELD ((insn), 16, 18) + \
167*3d8817e4Smiod (GET_FIELD ((insn), 19, 19) ? 8 : 0))
168*3d8817e4Smiod
169*3d8817e4Smiod /* Utility function to print registers. Put these first, so gcc's function
170*3d8817e4Smiod inlining can do its stuff. */
171*3d8817e4Smiod
172*3d8817e4Smiod #define fputs_filtered(STR,F) (*info->fprintf_func) (info->stream, "%s", STR)
173*3d8817e4Smiod
174*3d8817e4Smiod static void
fput_reg(unsigned reg,disassemble_info * info)175*3d8817e4Smiod fput_reg (unsigned reg, disassemble_info *info)
176*3d8817e4Smiod {
177*3d8817e4Smiod (*info->fprintf_func) (info->stream, reg ? reg_names[reg] : "r0");
178*3d8817e4Smiod }
179*3d8817e4Smiod
180*3d8817e4Smiod static void
fput_fp_reg(unsigned reg,disassemble_info * info)181*3d8817e4Smiod fput_fp_reg (unsigned reg, disassemble_info *info)
182*3d8817e4Smiod {
183*3d8817e4Smiod (*info->fprintf_func) (info->stream, reg ? fp_reg_names[reg] : "fr0");
184*3d8817e4Smiod }
185*3d8817e4Smiod
186*3d8817e4Smiod static void
fput_fp_reg_r(unsigned reg,disassemble_info * info)187*3d8817e4Smiod fput_fp_reg_r (unsigned reg, disassemble_info *info)
188*3d8817e4Smiod {
189*3d8817e4Smiod /* Special case floating point exception registers. */
190*3d8817e4Smiod if (reg < 4)
191*3d8817e4Smiod (*info->fprintf_func) (info->stream, "fpe%d", reg * 2 + 1);
192*3d8817e4Smiod else
193*3d8817e4Smiod (*info->fprintf_func) (info->stream, "%sR",
194*3d8817e4Smiod reg ? fp_reg_names[reg] : "fr0");
195*3d8817e4Smiod }
196*3d8817e4Smiod
197*3d8817e4Smiod static void
fput_creg(unsigned reg,disassemble_info * info)198*3d8817e4Smiod fput_creg (unsigned reg, disassemble_info *info)
199*3d8817e4Smiod {
200*3d8817e4Smiod (*info->fprintf_func) (info->stream, control_reg[reg]);
201*3d8817e4Smiod }
202*3d8817e4Smiod
203*3d8817e4Smiod /* Print constants with sign. */
204*3d8817e4Smiod
205*3d8817e4Smiod static void
fput_const(unsigned num,disassemble_info * info)206*3d8817e4Smiod fput_const (unsigned num, disassemble_info *info)
207*3d8817e4Smiod {
208*3d8817e4Smiod if ((int) num < 0)
209*3d8817e4Smiod (*info->fprintf_func) (info->stream, "-%x", - (int) num);
210*3d8817e4Smiod else
211*3d8817e4Smiod (*info->fprintf_func) (info->stream, "%x", num);
212*3d8817e4Smiod }
213*3d8817e4Smiod
214*3d8817e4Smiod /* Routines to extract various sized constants out of hppa
215*3d8817e4Smiod instructions. */
216*3d8817e4Smiod
217*3d8817e4Smiod /* Extract a 3-bit space register number from a be, ble, mtsp or mfsp. */
218*3d8817e4Smiod static int
extract_3(unsigned word)219*3d8817e4Smiod extract_3 (unsigned word)
220*3d8817e4Smiod {
221*3d8817e4Smiod return GET_FIELD (word, 18, 18) << 2 | GET_FIELD (word, 16, 17);
222*3d8817e4Smiod }
223*3d8817e4Smiod
224*3d8817e4Smiod static int
extract_5_load(unsigned word)225*3d8817e4Smiod extract_5_load (unsigned word)
226*3d8817e4Smiod {
227*3d8817e4Smiod return low_sign_extend (word >> 16 & MASK_5, 5);
228*3d8817e4Smiod }
229*3d8817e4Smiod
230*3d8817e4Smiod /* Extract the immediate field from a st{bhw}s instruction. */
231*3d8817e4Smiod
232*3d8817e4Smiod static int
extract_5_store(unsigned word)233*3d8817e4Smiod extract_5_store (unsigned word)
234*3d8817e4Smiod {
235*3d8817e4Smiod return low_sign_extend (word & MASK_5, 5);
236*3d8817e4Smiod }
237*3d8817e4Smiod
238*3d8817e4Smiod /* Extract the immediate field from a break instruction. */
239*3d8817e4Smiod
240*3d8817e4Smiod static unsigned
extract_5r_store(unsigned word)241*3d8817e4Smiod extract_5r_store (unsigned word)
242*3d8817e4Smiod {
243*3d8817e4Smiod return (word & MASK_5);
244*3d8817e4Smiod }
245*3d8817e4Smiod
246*3d8817e4Smiod /* Extract the immediate field from a {sr}sm instruction. */
247*3d8817e4Smiod
248*3d8817e4Smiod static unsigned
extract_5R_store(unsigned word)249*3d8817e4Smiod extract_5R_store (unsigned word)
250*3d8817e4Smiod {
251*3d8817e4Smiod return (word >> 16 & MASK_5);
252*3d8817e4Smiod }
253*3d8817e4Smiod
254*3d8817e4Smiod /* Extract the 10 bit immediate field from a {sr}sm instruction. */
255*3d8817e4Smiod
256*3d8817e4Smiod static unsigned
extract_10U_store(unsigned word)257*3d8817e4Smiod extract_10U_store (unsigned word)
258*3d8817e4Smiod {
259*3d8817e4Smiod return (word >> 16 & MASK_10);
260*3d8817e4Smiod }
261*3d8817e4Smiod
262*3d8817e4Smiod /* Extract the immediate field from a bb instruction. */
263*3d8817e4Smiod
264*3d8817e4Smiod static unsigned
extract_5Q_store(unsigned word)265*3d8817e4Smiod extract_5Q_store (unsigned word)
266*3d8817e4Smiod {
267*3d8817e4Smiod return (word >> 21 & MASK_5);
268*3d8817e4Smiod }
269*3d8817e4Smiod
270*3d8817e4Smiod /* Extract an 11 bit immediate field. */
271*3d8817e4Smiod
272*3d8817e4Smiod static int
extract_11(unsigned word)273*3d8817e4Smiod extract_11 (unsigned word)
274*3d8817e4Smiod {
275*3d8817e4Smiod return low_sign_extend (word & MASK_11, 11);
276*3d8817e4Smiod }
277*3d8817e4Smiod
278*3d8817e4Smiod /* Extract a 14 bit immediate field. */
279*3d8817e4Smiod
280*3d8817e4Smiod static int
extract_14(unsigned word)281*3d8817e4Smiod extract_14 (unsigned word)
282*3d8817e4Smiod {
283*3d8817e4Smiod return low_sign_extend (word & MASK_14, 14);
284*3d8817e4Smiod }
285*3d8817e4Smiod
286*3d8817e4Smiod /* Extract a 16 bit immediate field (PA2.0 wide only). */
287*3d8817e4Smiod
288*3d8817e4Smiod static int
extract_16(unsigned word)289*3d8817e4Smiod extract_16 (unsigned word)
290*3d8817e4Smiod {
291*3d8817e4Smiod int m15, m0, m1;
292*3d8817e4Smiod
293*3d8817e4Smiod m0 = GET_BIT (word, 16);
294*3d8817e4Smiod m1 = GET_BIT (word, 17);
295*3d8817e4Smiod m15 = GET_BIT (word, 31);
296*3d8817e4Smiod word = (word >> 1) & 0x1fff;
297*3d8817e4Smiod word = word | (m15 << 15) | ((m15 ^ m0) << 14) | ((m15 ^ m1) << 13);
298*3d8817e4Smiod return sign_extend (word, 16);
299*3d8817e4Smiod }
300*3d8817e4Smiod
301*3d8817e4Smiod /* Extract a 21 bit constant. */
302*3d8817e4Smiod
303*3d8817e4Smiod static int
extract_21(unsigned word)304*3d8817e4Smiod extract_21 (unsigned word)
305*3d8817e4Smiod {
306*3d8817e4Smiod int val;
307*3d8817e4Smiod
308*3d8817e4Smiod word &= MASK_21;
309*3d8817e4Smiod word <<= 11;
310*3d8817e4Smiod val = GET_FIELD (word, 20, 20);
311*3d8817e4Smiod val <<= 11;
312*3d8817e4Smiod val |= GET_FIELD (word, 9, 19);
313*3d8817e4Smiod val <<= 2;
314*3d8817e4Smiod val |= GET_FIELD (word, 5, 6);
315*3d8817e4Smiod val <<= 5;
316*3d8817e4Smiod val |= GET_FIELD (word, 0, 4);
317*3d8817e4Smiod val <<= 2;
318*3d8817e4Smiod val |= GET_FIELD (word, 7, 8);
319*3d8817e4Smiod return sign_extend (val, 21) << 11;
320*3d8817e4Smiod }
321*3d8817e4Smiod
322*3d8817e4Smiod /* Extract a 12 bit constant from branch instructions. */
323*3d8817e4Smiod
324*3d8817e4Smiod static int
extract_12(unsigned word)325*3d8817e4Smiod extract_12 (unsigned word)
326*3d8817e4Smiod {
327*3d8817e4Smiod return sign_extend (GET_FIELD (word, 19, 28)
328*3d8817e4Smiod | GET_FIELD (word, 29, 29) << 10
329*3d8817e4Smiod | (word & 0x1) << 11, 12) << 2;
330*3d8817e4Smiod }
331*3d8817e4Smiod
332*3d8817e4Smiod /* Extract a 17 bit constant from branch instructions, returning the
333*3d8817e4Smiod 19 bit signed value. */
334*3d8817e4Smiod
335*3d8817e4Smiod static int
extract_17(unsigned word)336*3d8817e4Smiod extract_17 (unsigned word)
337*3d8817e4Smiod {
338*3d8817e4Smiod return sign_extend (GET_FIELD (word, 19, 28)
339*3d8817e4Smiod | GET_FIELD (word, 29, 29) << 10
340*3d8817e4Smiod | GET_FIELD (word, 11, 15) << 11
341*3d8817e4Smiod | (word & 0x1) << 16, 17) << 2;
342*3d8817e4Smiod }
343*3d8817e4Smiod
344*3d8817e4Smiod static int
extract_22(unsigned word)345*3d8817e4Smiod extract_22 (unsigned word)
346*3d8817e4Smiod {
347*3d8817e4Smiod return sign_extend (GET_FIELD (word, 19, 28)
348*3d8817e4Smiod | GET_FIELD (word, 29, 29) << 10
349*3d8817e4Smiod | GET_FIELD (word, 11, 15) << 11
350*3d8817e4Smiod | GET_FIELD (word, 6, 10) << 16
351*3d8817e4Smiod | (word & 0x1) << 21, 22) << 2;
352*3d8817e4Smiod }
353*3d8817e4Smiod
354*3d8817e4Smiod /* Print one instruction. */
355*3d8817e4Smiod
356*3d8817e4Smiod int
print_insn_hppa(bfd_vma memaddr,disassemble_info * info)357*3d8817e4Smiod print_insn_hppa (bfd_vma memaddr, disassemble_info *info)
358*3d8817e4Smiod {
359*3d8817e4Smiod bfd_byte buffer[4];
360*3d8817e4Smiod unsigned int insn, i;
361*3d8817e4Smiod
362*3d8817e4Smiod {
363*3d8817e4Smiod int status =
364*3d8817e4Smiod (*info->read_memory_func) (memaddr, buffer, sizeof (buffer), info);
365*3d8817e4Smiod if (status != 0)
366*3d8817e4Smiod {
367*3d8817e4Smiod (*info->memory_error_func) (status, memaddr, info);
368*3d8817e4Smiod return -1;
369*3d8817e4Smiod }
370*3d8817e4Smiod }
371*3d8817e4Smiod
372*3d8817e4Smiod insn = bfd_getb32 (buffer);
373*3d8817e4Smiod
374*3d8817e4Smiod for (i = 0; i < NUMOPCODES; ++i)
375*3d8817e4Smiod {
376*3d8817e4Smiod const struct pa_opcode *opcode = &pa_opcodes[i];
377*3d8817e4Smiod
378*3d8817e4Smiod if ((insn & opcode->mask) == opcode->match)
379*3d8817e4Smiod {
380*3d8817e4Smiod const char *s;
381*3d8817e4Smiod #ifndef BFD64
382*3d8817e4Smiod if (opcode->arch == pa20w)
383*3d8817e4Smiod continue;
384*3d8817e4Smiod #endif
385*3d8817e4Smiod (*info->fprintf_func) (info->stream, "%s", opcode->name);
386*3d8817e4Smiod
387*3d8817e4Smiod if (!strchr ("cfCY?-+nHNZFIuv{", opcode->args[0]))
388*3d8817e4Smiod (*info->fprintf_func) (info->stream, " ");
389*3d8817e4Smiod for (s = opcode->args; *s != '\0'; ++s)
390*3d8817e4Smiod {
391*3d8817e4Smiod switch (*s)
392*3d8817e4Smiod {
393*3d8817e4Smiod case 'x':
394*3d8817e4Smiod fput_reg (GET_FIELD (insn, 11, 15), info);
395*3d8817e4Smiod break;
396*3d8817e4Smiod case 'a':
397*3d8817e4Smiod case 'b':
398*3d8817e4Smiod fput_reg (GET_FIELD (insn, 6, 10), info);
399*3d8817e4Smiod break;
400*3d8817e4Smiod case '^':
401*3d8817e4Smiod fput_creg (GET_FIELD (insn, 6, 10), info);
402*3d8817e4Smiod break;
403*3d8817e4Smiod case 't':
404*3d8817e4Smiod fput_reg (GET_FIELD (insn, 27, 31), info);
405*3d8817e4Smiod break;
406*3d8817e4Smiod
407*3d8817e4Smiod /* Handle floating point registers. */
408*3d8817e4Smiod case 'f':
409*3d8817e4Smiod switch (*++s)
410*3d8817e4Smiod {
411*3d8817e4Smiod case 't':
412*3d8817e4Smiod fput_fp_reg (GET_FIELD (insn, 27, 31), info);
413*3d8817e4Smiod break;
414*3d8817e4Smiod case 'T':
415*3d8817e4Smiod if (GET_FIELD (insn, 25, 25))
416*3d8817e4Smiod fput_fp_reg_r (GET_FIELD (insn, 27, 31), info);
417*3d8817e4Smiod else
418*3d8817e4Smiod fput_fp_reg (GET_FIELD (insn, 27, 31), info);
419*3d8817e4Smiod break;
420*3d8817e4Smiod case 'a':
421*3d8817e4Smiod if (GET_FIELD (insn, 25, 25))
422*3d8817e4Smiod fput_fp_reg_r (GET_FIELD (insn, 6, 10), info);
423*3d8817e4Smiod else
424*3d8817e4Smiod fput_fp_reg (GET_FIELD (insn, 6, 10), info);
425*3d8817e4Smiod break;
426*3d8817e4Smiod
427*3d8817e4Smiod /* 'fA' will not generate a space before the regsiter
428*3d8817e4Smiod name. Normally that is fine. Except that it
429*3d8817e4Smiod causes problems with xmpyu which has no FP format
430*3d8817e4Smiod completer. */
431*3d8817e4Smiod case 'X':
432*3d8817e4Smiod fputs_filtered (" ", info);
433*3d8817e4Smiod /* FALLTHRU */
434*3d8817e4Smiod
435*3d8817e4Smiod case 'A':
436*3d8817e4Smiod if (GET_FIELD (insn, 24, 24))
437*3d8817e4Smiod fput_fp_reg_r (GET_FIELD (insn, 6, 10), info);
438*3d8817e4Smiod else
439*3d8817e4Smiod fput_fp_reg (GET_FIELD (insn, 6, 10), info);
440*3d8817e4Smiod break;
441*3d8817e4Smiod case 'b':
442*3d8817e4Smiod if (GET_FIELD (insn, 25, 25))
443*3d8817e4Smiod fput_fp_reg_r (GET_FIELD (insn, 11, 15), info);
444*3d8817e4Smiod else
445*3d8817e4Smiod fput_fp_reg (GET_FIELD (insn, 11, 15), info);
446*3d8817e4Smiod break;
447*3d8817e4Smiod case 'B':
448*3d8817e4Smiod if (GET_FIELD (insn, 19, 19))
449*3d8817e4Smiod fput_fp_reg_r (GET_FIELD (insn, 11, 15), info);
450*3d8817e4Smiod else
451*3d8817e4Smiod fput_fp_reg (GET_FIELD (insn, 11, 15), info);
452*3d8817e4Smiod break;
453*3d8817e4Smiod case 'C':
454*3d8817e4Smiod {
455*3d8817e4Smiod int reg = GET_FIELD (insn, 21, 22);
456*3d8817e4Smiod reg |= GET_FIELD (insn, 16, 18) << 2;
457*3d8817e4Smiod if (GET_FIELD (insn, 23, 23) != 0)
458*3d8817e4Smiod fput_fp_reg_r (reg, info);
459*3d8817e4Smiod else
460*3d8817e4Smiod fput_fp_reg (reg, info);
461*3d8817e4Smiod break;
462*3d8817e4Smiod }
463*3d8817e4Smiod case 'i':
464*3d8817e4Smiod {
465*3d8817e4Smiod int reg = GET_FIELD (insn, 6, 10);
466*3d8817e4Smiod
467*3d8817e4Smiod reg |= (GET_FIELD (insn, 26, 26) << 4);
468*3d8817e4Smiod fput_fp_reg (reg, info);
469*3d8817e4Smiod break;
470*3d8817e4Smiod }
471*3d8817e4Smiod case 'j':
472*3d8817e4Smiod {
473*3d8817e4Smiod int reg = GET_FIELD (insn, 11, 15);
474*3d8817e4Smiod
475*3d8817e4Smiod reg |= (GET_FIELD (insn, 26, 26) << 4);
476*3d8817e4Smiod fput_fp_reg (reg, info);
477*3d8817e4Smiod break;
478*3d8817e4Smiod }
479*3d8817e4Smiod case 'k':
480*3d8817e4Smiod {
481*3d8817e4Smiod int reg = GET_FIELD (insn, 27, 31);
482*3d8817e4Smiod
483*3d8817e4Smiod reg |= (GET_FIELD (insn, 26, 26) << 4);
484*3d8817e4Smiod fput_fp_reg (reg, info);
485*3d8817e4Smiod break;
486*3d8817e4Smiod }
487*3d8817e4Smiod case 'l':
488*3d8817e4Smiod {
489*3d8817e4Smiod int reg = GET_FIELD (insn, 21, 25);
490*3d8817e4Smiod
491*3d8817e4Smiod reg |= (GET_FIELD (insn, 26, 26) << 4);
492*3d8817e4Smiod fput_fp_reg (reg, info);
493*3d8817e4Smiod break;
494*3d8817e4Smiod }
495*3d8817e4Smiod case 'm':
496*3d8817e4Smiod {
497*3d8817e4Smiod int reg = GET_FIELD (insn, 16, 20);
498*3d8817e4Smiod
499*3d8817e4Smiod reg |= (GET_FIELD (insn, 26, 26) << 4);
500*3d8817e4Smiod fput_fp_reg (reg, info);
501*3d8817e4Smiod break;
502*3d8817e4Smiod }
503*3d8817e4Smiod
504*3d8817e4Smiod /* 'fe' will not generate a space before the register
505*3d8817e4Smiod name. Normally that is fine. Except that it
506*3d8817e4Smiod causes problems with fstw fe,y(b) which has no FP
507*3d8817e4Smiod format completer. */
508*3d8817e4Smiod case 'E':
509*3d8817e4Smiod fputs_filtered (" ", info);
510*3d8817e4Smiod /* FALLTHRU */
511*3d8817e4Smiod
512*3d8817e4Smiod case 'e':
513*3d8817e4Smiod if (GET_FIELD (insn, 30, 30))
514*3d8817e4Smiod fput_fp_reg_r (GET_FIELD (insn, 11, 15), info);
515*3d8817e4Smiod else
516*3d8817e4Smiod fput_fp_reg (GET_FIELD (insn, 11, 15), info);
517*3d8817e4Smiod break;
518*3d8817e4Smiod case 'x':
519*3d8817e4Smiod fput_fp_reg (GET_FIELD (insn, 11, 15), info);
520*3d8817e4Smiod break;
521*3d8817e4Smiod }
522*3d8817e4Smiod break;
523*3d8817e4Smiod
524*3d8817e4Smiod case '5':
525*3d8817e4Smiod fput_const (extract_5_load (insn), info);
526*3d8817e4Smiod break;
527*3d8817e4Smiod case 's':
528*3d8817e4Smiod {
529*3d8817e4Smiod int space = GET_FIELD (insn, 16, 17);
530*3d8817e4Smiod /* Zero means implicit addressing, not use of sr0. */
531*3d8817e4Smiod if (space != 0)
532*3d8817e4Smiod (*info->fprintf_func) (info->stream, "sr%d", space);
533*3d8817e4Smiod }
534*3d8817e4Smiod break;
535*3d8817e4Smiod
536*3d8817e4Smiod case 'S':
537*3d8817e4Smiod (*info->fprintf_func) (info->stream, "sr%d",
538*3d8817e4Smiod extract_3 (insn));
539*3d8817e4Smiod break;
540*3d8817e4Smiod
541*3d8817e4Smiod /* Handle completers. */
542*3d8817e4Smiod case 'c':
543*3d8817e4Smiod switch (*++s)
544*3d8817e4Smiod {
545*3d8817e4Smiod case 'x':
546*3d8817e4Smiod (*info->fprintf_func)
547*3d8817e4Smiod (info->stream, "%s",
548*3d8817e4Smiod index_compl_names[GET_COMPL (insn)]);
549*3d8817e4Smiod break;
550*3d8817e4Smiod case 'X':
551*3d8817e4Smiod (*info->fprintf_func)
552*3d8817e4Smiod (info->stream, "%s ",
553*3d8817e4Smiod index_compl_names[GET_COMPL (insn)]);
554*3d8817e4Smiod break;
555*3d8817e4Smiod case 'm':
556*3d8817e4Smiod (*info->fprintf_func)
557*3d8817e4Smiod (info->stream, "%s",
558*3d8817e4Smiod short_ldst_compl_names[GET_COMPL (insn)]);
559*3d8817e4Smiod break;
560*3d8817e4Smiod case 'M':
561*3d8817e4Smiod (*info->fprintf_func)
562*3d8817e4Smiod (info->stream, "%s ",
563*3d8817e4Smiod short_ldst_compl_names[GET_COMPL (insn)]);
564*3d8817e4Smiod break;
565*3d8817e4Smiod case 'A':
566*3d8817e4Smiod (*info->fprintf_func)
567*3d8817e4Smiod (info->stream, "%s ",
568*3d8817e4Smiod short_bytes_compl_names[GET_COMPL (insn)]);
569*3d8817e4Smiod break;
570*3d8817e4Smiod case 's':
571*3d8817e4Smiod (*info->fprintf_func)
572*3d8817e4Smiod (info->stream, "%s",
573*3d8817e4Smiod short_bytes_compl_names[GET_COMPL (insn)]);
574*3d8817e4Smiod break;
575*3d8817e4Smiod case 'c':
576*3d8817e4Smiod case 'C':
577*3d8817e4Smiod switch (GET_FIELD (insn, 20, 21))
578*3d8817e4Smiod {
579*3d8817e4Smiod case 1:
580*3d8817e4Smiod (*info->fprintf_func) (info->stream, ",bc ");
581*3d8817e4Smiod break;
582*3d8817e4Smiod case 2:
583*3d8817e4Smiod (*info->fprintf_func) (info->stream, ",sl ");
584*3d8817e4Smiod break;
585*3d8817e4Smiod default:
586*3d8817e4Smiod (*info->fprintf_func) (info->stream, " ");
587*3d8817e4Smiod }
588*3d8817e4Smiod break;
589*3d8817e4Smiod case 'd':
590*3d8817e4Smiod switch (GET_FIELD (insn, 20, 21))
591*3d8817e4Smiod {
592*3d8817e4Smiod case 1:
593*3d8817e4Smiod (*info->fprintf_func) (info->stream, ",co ");
594*3d8817e4Smiod break;
595*3d8817e4Smiod default:
596*3d8817e4Smiod (*info->fprintf_func) (info->stream, " ");
597*3d8817e4Smiod }
598*3d8817e4Smiod break;
599*3d8817e4Smiod case 'o':
600*3d8817e4Smiod (*info->fprintf_func) (info->stream, ",o");
601*3d8817e4Smiod break;
602*3d8817e4Smiod case 'g':
603*3d8817e4Smiod (*info->fprintf_func) (info->stream, ",gate");
604*3d8817e4Smiod break;
605*3d8817e4Smiod case 'p':
606*3d8817e4Smiod (*info->fprintf_func) (info->stream, ",l,push");
607*3d8817e4Smiod break;
608*3d8817e4Smiod case 'P':
609*3d8817e4Smiod (*info->fprintf_func) (info->stream, ",pop");
610*3d8817e4Smiod break;
611*3d8817e4Smiod case 'l':
612*3d8817e4Smiod case 'L':
613*3d8817e4Smiod (*info->fprintf_func) (info->stream, ",l");
614*3d8817e4Smiod break;
615*3d8817e4Smiod case 'w':
616*3d8817e4Smiod (*info->fprintf_func)
617*3d8817e4Smiod (info->stream, "%s ",
618*3d8817e4Smiod read_write_names[GET_FIELD (insn, 25, 25)]);
619*3d8817e4Smiod break;
620*3d8817e4Smiod case 'W':
621*3d8817e4Smiod (*info->fprintf_func) (info->stream, ",w ");
622*3d8817e4Smiod break;
623*3d8817e4Smiod case 'r':
624*3d8817e4Smiod if (GET_FIELD (insn, 23, 26) == 5)
625*3d8817e4Smiod (*info->fprintf_func) (info->stream, ",r");
626*3d8817e4Smiod break;
627*3d8817e4Smiod case 'Z':
628*3d8817e4Smiod if (GET_FIELD (insn, 26, 26))
629*3d8817e4Smiod (*info->fprintf_func) (info->stream, ",m ");
630*3d8817e4Smiod else
631*3d8817e4Smiod (*info->fprintf_func) (info->stream, " ");
632*3d8817e4Smiod break;
633*3d8817e4Smiod case 'i':
634*3d8817e4Smiod if (GET_FIELD (insn, 25, 25))
635*3d8817e4Smiod (*info->fprintf_func) (info->stream, ",i");
636*3d8817e4Smiod break;
637*3d8817e4Smiod case 'z':
638*3d8817e4Smiod if (!GET_FIELD (insn, 21, 21))
639*3d8817e4Smiod (*info->fprintf_func) (info->stream, ",z");
640*3d8817e4Smiod break;
641*3d8817e4Smiod case 'a':
642*3d8817e4Smiod (*info->fprintf_func)
643*3d8817e4Smiod (info->stream, "%s",
644*3d8817e4Smiod add_compl_names[GET_FIELD (insn, 20, 21)]);
645*3d8817e4Smiod break;
646*3d8817e4Smiod case 'Y':
647*3d8817e4Smiod (*info->fprintf_func)
648*3d8817e4Smiod (info->stream, ",dc%s",
649*3d8817e4Smiod add_compl_names[GET_FIELD (insn, 20, 21)]);
650*3d8817e4Smiod break;
651*3d8817e4Smiod case 'y':
652*3d8817e4Smiod (*info->fprintf_func)
653*3d8817e4Smiod (info->stream, ",c%s",
654*3d8817e4Smiod add_compl_names[GET_FIELD (insn, 20, 21)]);
655*3d8817e4Smiod break;
656*3d8817e4Smiod case 'v':
657*3d8817e4Smiod if (GET_FIELD (insn, 20, 20))
658*3d8817e4Smiod (*info->fprintf_func) (info->stream, ",tsv");
659*3d8817e4Smiod break;
660*3d8817e4Smiod case 't':
661*3d8817e4Smiod (*info->fprintf_func) (info->stream, ",tc");
662*3d8817e4Smiod if (GET_FIELD (insn, 20, 20))
663*3d8817e4Smiod (*info->fprintf_func) (info->stream, ",tsv");
664*3d8817e4Smiod break;
665*3d8817e4Smiod case 'B':
666*3d8817e4Smiod (*info->fprintf_func) (info->stream, ",db");
667*3d8817e4Smiod if (GET_FIELD (insn, 20, 20))
668*3d8817e4Smiod (*info->fprintf_func) (info->stream, ",tsv");
669*3d8817e4Smiod break;
670*3d8817e4Smiod case 'b':
671*3d8817e4Smiod (*info->fprintf_func) (info->stream, ",b");
672*3d8817e4Smiod if (GET_FIELD (insn, 20, 20))
673*3d8817e4Smiod (*info->fprintf_func) (info->stream, ",tsv");
674*3d8817e4Smiod break;
675*3d8817e4Smiod case 'T':
676*3d8817e4Smiod if (GET_FIELD (insn, 25, 25))
677*3d8817e4Smiod (*info->fprintf_func) (info->stream, ",tc");
678*3d8817e4Smiod break;
679*3d8817e4Smiod case 'S':
680*3d8817e4Smiod /* EXTRD/W has a following condition. */
681*3d8817e4Smiod if (*(s + 1) == '?')
682*3d8817e4Smiod (*info->fprintf_func)
683*3d8817e4Smiod (info->stream, "%s",
684*3d8817e4Smiod signed_unsigned_names[GET_FIELD (insn, 21, 21)]);
685*3d8817e4Smiod else
686*3d8817e4Smiod (*info->fprintf_func)
687*3d8817e4Smiod (info->stream, "%s ",
688*3d8817e4Smiod signed_unsigned_names[GET_FIELD (insn, 21, 21)]);
689*3d8817e4Smiod break;
690*3d8817e4Smiod case 'h':
691*3d8817e4Smiod (*info->fprintf_func)
692*3d8817e4Smiod (info->stream, "%s",
693*3d8817e4Smiod mix_half_names[GET_FIELD (insn, 17, 17)]);
694*3d8817e4Smiod break;
695*3d8817e4Smiod case 'H':
696*3d8817e4Smiod (*info->fprintf_func)
697*3d8817e4Smiod (info->stream, "%s ",
698*3d8817e4Smiod saturation_names[GET_FIELD (insn, 24, 25)]);
699*3d8817e4Smiod break;
700*3d8817e4Smiod case '*':
701*3d8817e4Smiod (*info->fprintf_func)
702*3d8817e4Smiod (info->stream, ",%d%d%d%d ",
703*3d8817e4Smiod GET_FIELD (insn, 17, 18), GET_FIELD (insn, 20, 21),
704*3d8817e4Smiod GET_FIELD (insn, 22, 23), GET_FIELD (insn, 24, 25));
705*3d8817e4Smiod break;
706*3d8817e4Smiod
707*3d8817e4Smiod case 'q':
708*3d8817e4Smiod {
709*3d8817e4Smiod int m, a;
710*3d8817e4Smiod
711*3d8817e4Smiod m = GET_FIELD (insn, 28, 28);
712*3d8817e4Smiod a = GET_FIELD (insn, 29, 29);
713*3d8817e4Smiod
714*3d8817e4Smiod if (m && !a)
715*3d8817e4Smiod fputs_filtered (",ma ", info);
716*3d8817e4Smiod else if (m && a)
717*3d8817e4Smiod fputs_filtered (",mb ", info);
718*3d8817e4Smiod else
719*3d8817e4Smiod fputs_filtered (" ", info);
720*3d8817e4Smiod break;
721*3d8817e4Smiod }
722*3d8817e4Smiod
723*3d8817e4Smiod case 'J':
724*3d8817e4Smiod {
725*3d8817e4Smiod int opc = GET_FIELD (insn, 0, 5);
726*3d8817e4Smiod
727*3d8817e4Smiod if (opc == 0x16 || opc == 0x1e)
728*3d8817e4Smiod {
729*3d8817e4Smiod if (GET_FIELD (insn, 29, 29) == 0)
730*3d8817e4Smiod fputs_filtered (",ma ", info);
731*3d8817e4Smiod else
732*3d8817e4Smiod fputs_filtered (",mb ", info);
733*3d8817e4Smiod }
734*3d8817e4Smiod else
735*3d8817e4Smiod fputs_filtered (" ", info);
736*3d8817e4Smiod break;
737*3d8817e4Smiod }
738*3d8817e4Smiod
739*3d8817e4Smiod case 'e':
740*3d8817e4Smiod {
741*3d8817e4Smiod int opc = GET_FIELD (insn, 0, 5);
742*3d8817e4Smiod
743*3d8817e4Smiod if (opc == 0x13 || opc == 0x1b)
744*3d8817e4Smiod {
745*3d8817e4Smiod if (GET_FIELD (insn, 18, 18) == 1)
746*3d8817e4Smiod fputs_filtered (",mb ", info);
747*3d8817e4Smiod else
748*3d8817e4Smiod fputs_filtered (",ma ", info);
749*3d8817e4Smiod }
750*3d8817e4Smiod else if (opc == 0x17 || opc == 0x1f)
751*3d8817e4Smiod {
752*3d8817e4Smiod if (GET_FIELD (insn, 31, 31) == 1)
753*3d8817e4Smiod fputs_filtered (",ma ", info);
754*3d8817e4Smiod else
755*3d8817e4Smiod fputs_filtered (",mb ", info);
756*3d8817e4Smiod }
757*3d8817e4Smiod else
758*3d8817e4Smiod fputs_filtered (" ", info);
759*3d8817e4Smiod
760*3d8817e4Smiod break;
761*3d8817e4Smiod }
762*3d8817e4Smiod }
763*3d8817e4Smiod break;
764*3d8817e4Smiod
765*3d8817e4Smiod /* Handle conditions. */
766*3d8817e4Smiod case '?':
767*3d8817e4Smiod {
768*3d8817e4Smiod s++;
769*3d8817e4Smiod switch (*s)
770*3d8817e4Smiod {
771*3d8817e4Smiod case 'f':
772*3d8817e4Smiod (*info->fprintf_func)
773*3d8817e4Smiod (info->stream, "%s ",
774*3d8817e4Smiod float_comp_names[GET_FIELD (insn, 27, 31)]);
775*3d8817e4Smiod break;
776*3d8817e4Smiod
777*3d8817e4Smiod /* These four conditions are for the set of instructions
778*3d8817e4Smiod which distinguish true/false conditions by opcode
779*3d8817e4Smiod rather than by the 'f' bit (sigh): comb, comib,
780*3d8817e4Smiod addb, addib. */
781*3d8817e4Smiod case 't':
782*3d8817e4Smiod fputs_filtered
783*3d8817e4Smiod (compare_cond_names[GET_FIELD (insn, 16, 18)], info);
784*3d8817e4Smiod break;
785*3d8817e4Smiod case 'n':
786*3d8817e4Smiod fputs_filtered
787*3d8817e4Smiod (compare_cond_names[GET_FIELD (insn, 16, 18)
788*3d8817e4Smiod + GET_FIELD (insn, 4, 4) * 8],
789*3d8817e4Smiod info);
790*3d8817e4Smiod break;
791*3d8817e4Smiod case 'N':
792*3d8817e4Smiod fputs_filtered
793*3d8817e4Smiod (compare_cond_64_names[GET_FIELD (insn, 16, 18)
794*3d8817e4Smiod + GET_FIELD (insn, 2, 2) * 8],
795*3d8817e4Smiod info);
796*3d8817e4Smiod break;
797*3d8817e4Smiod case 'Q':
798*3d8817e4Smiod fputs_filtered
799*3d8817e4Smiod (cmpib_cond_64_names[GET_FIELD (insn, 16, 18)],
800*3d8817e4Smiod info);
801*3d8817e4Smiod break;
802*3d8817e4Smiod case '@':
803*3d8817e4Smiod fputs_filtered
804*3d8817e4Smiod (add_cond_names[GET_FIELD (insn, 16, 18)
805*3d8817e4Smiod + GET_FIELD (insn, 4, 4) * 8],
806*3d8817e4Smiod info);
807*3d8817e4Smiod break;
808*3d8817e4Smiod case 's':
809*3d8817e4Smiod (*info->fprintf_func)
810*3d8817e4Smiod (info->stream, "%s ",
811*3d8817e4Smiod compare_cond_names[GET_COND (insn)]);
812*3d8817e4Smiod break;
813*3d8817e4Smiod case 'S':
814*3d8817e4Smiod (*info->fprintf_func)
815*3d8817e4Smiod (info->stream, "%s ",
816*3d8817e4Smiod compare_cond_64_names[GET_COND (insn)]);
817*3d8817e4Smiod break;
818*3d8817e4Smiod case 'a':
819*3d8817e4Smiod (*info->fprintf_func)
820*3d8817e4Smiod (info->stream, "%s ",
821*3d8817e4Smiod add_cond_names[GET_COND (insn)]);
822*3d8817e4Smiod break;
823*3d8817e4Smiod case 'A':
824*3d8817e4Smiod (*info->fprintf_func)
825*3d8817e4Smiod (info->stream, "%s ",
826*3d8817e4Smiod add_cond_64_names[GET_COND (insn)]);
827*3d8817e4Smiod break;
828*3d8817e4Smiod case 'd':
829*3d8817e4Smiod (*info->fprintf_func)
830*3d8817e4Smiod (info->stream, "%s",
831*3d8817e4Smiod add_cond_names[GET_FIELD (insn, 16, 18)]);
832*3d8817e4Smiod break;
833*3d8817e4Smiod
834*3d8817e4Smiod case 'W':
835*3d8817e4Smiod (*info->fprintf_func)
836*3d8817e4Smiod (info->stream, "%s",
837*3d8817e4Smiod wide_add_cond_names[GET_FIELD (insn, 16, 18) +
838*3d8817e4Smiod GET_FIELD (insn, 4, 4) * 8]);
839*3d8817e4Smiod break;
840*3d8817e4Smiod
841*3d8817e4Smiod case 'l':
842*3d8817e4Smiod (*info->fprintf_func)
843*3d8817e4Smiod (info->stream, "%s ",
844*3d8817e4Smiod logical_cond_names[GET_COND (insn)]);
845*3d8817e4Smiod break;
846*3d8817e4Smiod case 'L':
847*3d8817e4Smiod (*info->fprintf_func)
848*3d8817e4Smiod (info->stream, "%s ",
849*3d8817e4Smiod logical_cond_64_names[GET_COND (insn)]);
850*3d8817e4Smiod break;
851*3d8817e4Smiod case 'u':
852*3d8817e4Smiod (*info->fprintf_func)
853*3d8817e4Smiod (info->stream, "%s ",
854*3d8817e4Smiod unit_cond_names[GET_COND (insn)]);
855*3d8817e4Smiod break;
856*3d8817e4Smiod case 'U':
857*3d8817e4Smiod (*info->fprintf_func)
858*3d8817e4Smiod (info->stream, "%s ",
859*3d8817e4Smiod unit_cond_64_names[GET_COND (insn)]);
860*3d8817e4Smiod break;
861*3d8817e4Smiod case 'y':
862*3d8817e4Smiod case 'x':
863*3d8817e4Smiod case 'b':
864*3d8817e4Smiod (*info->fprintf_func)
865*3d8817e4Smiod (info->stream, "%s",
866*3d8817e4Smiod shift_cond_names[GET_FIELD (insn, 16, 18)]);
867*3d8817e4Smiod
868*3d8817e4Smiod /* If the next character in args is 'n', it will handle
869*3d8817e4Smiod putting out the space. */
870*3d8817e4Smiod if (s[1] != 'n')
871*3d8817e4Smiod (*info->fprintf_func) (info->stream, " ");
872*3d8817e4Smiod break;
873*3d8817e4Smiod case 'X':
874*3d8817e4Smiod (*info->fprintf_func)
875*3d8817e4Smiod (info->stream, "%s ",
876*3d8817e4Smiod shift_cond_64_names[GET_FIELD (insn, 16, 18)]);
877*3d8817e4Smiod break;
878*3d8817e4Smiod case 'B':
879*3d8817e4Smiod (*info->fprintf_func)
880*3d8817e4Smiod (info->stream, "%s",
881*3d8817e4Smiod bb_cond_64_names[GET_FIELD (insn, 16, 16)]);
882*3d8817e4Smiod
883*3d8817e4Smiod /* If the next character in args is 'n', it will handle
884*3d8817e4Smiod putting out the space. */
885*3d8817e4Smiod if (s[1] != 'n')
886*3d8817e4Smiod (*info->fprintf_func) (info->stream, " ");
887*3d8817e4Smiod break;
888*3d8817e4Smiod }
889*3d8817e4Smiod break;
890*3d8817e4Smiod }
891*3d8817e4Smiod
892*3d8817e4Smiod case 'V':
893*3d8817e4Smiod fput_const (extract_5_store (insn), info);
894*3d8817e4Smiod break;
895*3d8817e4Smiod case 'r':
896*3d8817e4Smiod fput_const (extract_5r_store (insn), info);
897*3d8817e4Smiod break;
898*3d8817e4Smiod case 'R':
899*3d8817e4Smiod fput_const (extract_5R_store (insn), info);
900*3d8817e4Smiod break;
901*3d8817e4Smiod case 'U':
902*3d8817e4Smiod fput_const (extract_10U_store (insn), info);
903*3d8817e4Smiod break;
904*3d8817e4Smiod case 'B':
905*3d8817e4Smiod case 'Q':
906*3d8817e4Smiod fput_const (extract_5Q_store (insn), info);
907*3d8817e4Smiod break;
908*3d8817e4Smiod case 'i':
909*3d8817e4Smiod fput_const (extract_11 (insn), info);
910*3d8817e4Smiod break;
911*3d8817e4Smiod case 'j':
912*3d8817e4Smiod fput_const (extract_14 (insn), info);
913*3d8817e4Smiod break;
914*3d8817e4Smiod case 'k':
915*3d8817e4Smiod fputs_filtered ("L%", info);
916*3d8817e4Smiod fput_const (extract_21 (insn), info);
917*3d8817e4Smiod break;
918*3d8817e4Smiod case '<':
919*3d8817e4Smiod case 'l':
920*3d8817e4Smiod /* 16-bit long disp., PA2.0 wide only. */
921*3d8817e4Smiod fput_const (extract_16 (insn), info);
922*3d8817e4Smiod break;
923*3d8817e4Smiod case 'n':
924*3d8817e4Smiod if (insn & 0x2)
925*3d8817e4Smiod (*info->fprintf_func) (info->stream, ",n ");
926*3d8817e4Smiod else
927*3d8817e4Smiod (*info->fprintf_func) (info->stream, " ");
928*3d8817e4Smiod break;
929*3d8817e4Smiod case 'N':
930*3d8817e4Smiod if ((insn & 0x20) && s[1])
931*3d8817e4Smiod (*info->fprintf_func) (info->stream, ",n ");
932*3d8817e4Smiod else if (insn & 0x20)
933*3d8817e4Smiod (*info->fprintf_func) (info->stream, ",n");
934*3d8817e4Smiod else if (s[1])
935*3d8817e4Smiod (*info->fprintf_func) (info->stream, " ");
936*3d8817e4Smiod break;
937*3d8817e4Smiod case 'w':
938*3d8817e4Smiod (*info->print_address_func)
939*3d8817e4Smiod (memaddr + 8 + extract_12 (insn), info);
940*3d8817e4Smiod break;
941*3d8817e4Smiod case 'W':
942*3d8817e4Smiod /* 17 bit PC-relative branch. */
943*3d8817e4Smiod (*info->print_address_func)
944*3d8817e4Smiod ((memaddr + 8 + extract_17 (insn)), info);
945*3d8817e4Smiod break;
946*3d8817e4Smiod case 'z':
947*3d8817e4Smiod /* 17 bit displacement. This is an offset from a register
948*3d8817e4Smiod so it gets disasssembled as just a number, not any sort
949*3d8817e4Smiod of address. */
950*3d8817e4Smiod fput_const (extract_17 (insn), info);
951*3d8817e4Smiod break;
952*3d8817e4Smiod
953*3d8817e4Smiod case 'Z':
954*3d8817e4Smiod /* addil %r1 implicit output. */
955*3d8817e4Smiod fputs_filtered ("r1", info);
956*3d8817e4Smiod break;
957*3d8817e4Smiod
958*3d8817e4Smiod case 'Y':
959*3d8817e4Smiod /* be,l %sr0,%r31 implicit output. */
960*3d8817e4Smiod fputs_filtered ("sr0,r31", info);
961*3d8817e4Smiod break;
962*3d8817e4Smiod
963*3d8817e4Smiod case '@':
964*3d8817e4Smiod (*info->fprintf_func) (info->stream, "0");
965*3d8817e4Smiod break;
966*3d8817e4Smiod
967*3d8817e4Smiod case '.':
968*3d8817e4Smiod (*info->fprintf_func) (info->stream, "%d",
969*3d8817e4Smiod GET_FIELD (insn, 24, 25));
970*3d8817e4Smiod break;
971*3d8817e4Smiod case '*':
972*3d8817e4Smiod (*info->fprintf_func) (info->stream, "%d",
973*3d8817e4Smiod GET_FIELD (insn, 22, 25));
974*3d8817e4Smiod break;
975*3d8817e4Smiod case '!':
976*3d8817e4Smiod fputs_filtered ("sar", info);
977*3d8817e4Smiod break;
978*3d8817e4Smiod case 'p':
979*3d8817e4Smiod (*info->fprintf_func) (info->stream, "%d",
980*3d8817e4Smiod 31 - GET_FIELD (insn, 22, 26));
981*3d8817e4Smiod break;
982*3d8817e4Smiod case '~':
983*3d8817e4Smiod {
984*3d8817e4Smiod int num;
985*3d8817e4Smiod num = GET_FIELD (insn, 20, 20) << 5;
986*3d8817e4Smiod num |= GET_FIELD (insn, 22, 26);
987*3d8817e4Smiod (*info->fprintf_func) (info->stream, "%d", 63 - num);
988*3d8817e4Smiod break;
989*3d8817e4Smiod }
990*3d8817e4Smiod case 'P':
991*3d8817e4Smiod (*info->fprintf_func) (info->stream, "%d",
992*3d8817e4Smiod GET_FIELD (insn, 22, 26));
993*3d8817e4Smiod break;
994*3d8817e4Smiod case 'q':
995*3d8817e4Smiod {
996*3d8817e4Smiod int num;
997*3d8817e4Smiod num = GET_FIELD (insn, 20, 20) << 5;
998*3d8817e4Smiod num |= GET_FIELD (insn, 22, 26);
999*3d8817e4Smiod (*info->fprintf_func) (info->stream, "%d", num);
1000*3d8817e4Smiod break;
1001*3d8817e4Smiod }
1002*3d8817e4Smiod case 'T':
1003*3d8817e4Smiod (*info->fprintf_func) (info->stream, "%d",
1004*3d8817e4Smiod 32 - GET_FIELD (insn, 27, 31));
1005*3d8817e4Smiod break;
1006*3d8817e4Smiod case '%':
1007*3d8817e4Smiod {
1008*3d8817e4Smiod int num;
1009*3d8817e4Smiod num = (GET_FIELD (insn, 23, 23) + 1) * 32;
1010*3d8817e4Smiod num -= GET_FIELD (insn, 27, 31);
1011*3d8817e4Smiod (*info->fprintf_func) (info->stream, "%d", num);
1012*3d8817e4Smiod break;
1013*3d8817e4Smiod }
1014*3d8817e4Smiod case '|':
1015*3d8817e4Smiod {
1016*3d8817e4Smiod int num;
1017*3d8817e4Smiod num = (GET_FIELD (insn, 19, 19) + 1) * 32;
1018*3d8817e4Smiod num -= GET_FIELD (insn, 27, 31);
1019*3d8817e4Smiod (*info->fprintf_func) (info->stream, "%d", num);
1020*3d8817e4Smiod break;
1021*3d8817e4Smiod }
1022*3d8817e4Smiod case '$':
1023*3d8817e4Smiod fput_const (GET_FIELD (insn, 20, 28), info);
1024*3d8817e4Smiod break;
1025*3d8817e4Smiod case 'A':
1026*3d8817e4Smiod fput_const (GET_FIELD (insn, 6, 18), info);
1027*3d8817e4Smiod break;
1028*3d8817e4Smiod case 'D':
1029*3d8817e4Smiod fput_const (GET_FIELD (insn, 6, 31), info);
1030*3d8817e4Smiod break;
1031*3d8817e4Smiod case 'v':
1032*3d8817e4Smiod (*info->fprintf_func) (info->stream, ",%d",
1033*3d8817e4Smiod GET_FIELD (insn, 23, 25));
1034*3d8817e4Smiod break;
1035*3d8817e4Smiod case 'O':
1036*3d8817e4Smiod fput_const ((GET_FIELD (insn, 6,20) << 5 |
1037*3d8817e4Smiod GET_FIELD (insn, 27, 31)), info);
1038*3d8817e4Smiod break;
1039*3d8817e4Smiod case 'o':
1040*3d8817e4Smiod fput_const (GET_FIELD (insn, 6, 20), info);
1041*3d8817e4Smiod break;
1042*3d8817e4Smiod case '2':
1043*3d8817e4Smiod fput_const ((GET_FIELD (insn, 6, 22) << 5 |
1044*3d8817e4Smiod GET_FIELD (insn, 27, 31)), info);
1045*3d8817e4Smiod break;
1046*3d8817e4Smiod case '1':
1047*3d8817e4Smiod fput_const ((GET_FIELD (insn, 11, 20) << 5 |
1048*3d8817e4Smiod GET_FIELD (insn, 27, 31)), info);
1049*3d8817e4Smiod break;
1050*3d8817e4Smiod case '0':
1051*3d8817e4Smiod fput_const ((GET_FIELD (insn, 16, 20) << 5 |
1052*3d8817e4Smiod GET_FIELD (insn, 27, 31)), info);
1053*3d8817e4Smiod break;
1054*3d8817e4Smiod case 'u':
1055*3d8817e4Smiod (*info->fprintf_func) (info->stream, ",%d",
1056*3d8817e4Smiod GET_FIELD (insn, 23, 25));
1057*3d8817e4Smiod break;
1058*3d8817e4Smiod case 'F':
1059*3d8817e4Smiod /* If no destination completer and not before a completer
1060*3d8817e4Smiod for fcmp, need a space here. */
1061*3d8817e4Smiod if (s[1] == 'G' || s[1] == '?')
1062*3d8817e4Smiod fputs_filtered
1063*3d8817e4Smiod (float_format_names[GET_FIELD (insn, 19, 20)], info);
1064*3d8817e4Smiod else
1065*3d8817e4Smiod (*info->fprintf_func)
1066*3d8817e4Smiod (info->stream, "%s ",
1067*3d8817e4Smiod float_format_names[GET_FIELD (insn, 19, 20)]);
1068*3d8817e4Smiod break;
1069*3d8817e4Smiod case 'G':
1070*3d8817e4Smiod (*info->fprintf_func)
1071*3d8817e4Smiod (info->stream, "%s ",
1072*3d8817e4Smiod float_format_names[GET_FIELD (insn, 17, 18)]);
1073*3d8817e4Smiod break;
1074*3d8817e4Smiod case 'H':
1075*3d8817e4Smiod if (GET_FIELD (insn, 26, 26) == 1)
1076*3d8817e4Smiod (*info->fprintf_func) (info->stream, "%s ",
1077*3d8817e4Smiod float_format_names[0]);
1078*3d8817e4Smiod else
1079*3d8817e4Smiod (*info->fprintf_func) (info->stream, "%s ",
1080*3d8817e4Smiod float_format_names[1]);
1081*3d8817e4Smiod break;
1082*3d8817e4Smiod case 'I':
1083*3d8817e4Smiod /* If no destination completer and not before a completer
1084*3d8817e4Smiod for fcmp, need a space here. */
1085*3d8817e4Smiod if (s[1] == '?')
1086*3d8817e4Smiod fputs_filtered
1087*3d8817e4Smiod (float_format_names[GET_FIELD (insn, 20, 20)], info);
1088*3d8817e4Smiod else
1089*3d8817e4Smiod (*info->fprintf_func)
1090*3d8817e4Smiod (info->stream, "%s ",
1091*3d8817e4Smiod float_format_names[GET_FIELD (insn, 20, 20)]);
1092*3d8817e4Smiod break;
1093*3d8817e4Smiod
1094*3d8817e4Smiod case 'J':
1095*3d8817e4Smiod fput_const (extract_14 (insn), info);
1096*3d8817e4Smiod break;
1097*3d8817e4Smiod
1098*3d8817e4Smiod case '#':
1099*3d8817e4Smiod {
1100*3d8817e4Smiod int sign = GET_FIELD (insn, 31, 31);
1101*3d8817e4Smiod int imm10 = GET_FIELD (insn, 18, 27);
1102*3d8817e4Smiod int disp;
1103*3d8817e4Smiod
1104*3d8817e4Smiod if (sign)
1105*3d8817e4Smiod disp = (-1 << 10) | imm10;
1106*3d8817e4Smiod else
1107*3d8817e4Smiod disp = imm10;
1108*3d8817e4Smiod
1109*3d8817e4Smiod disp <<= 3;
1110*3d8817e4Smiod fput_const (disp, info);
1111*3d8817e4Smiod break;
1112*3d8817e4Smiod }
1113*3d8817e4Smiod case 'K':
1114*3d8817e4Smiod case 'd':
1115*3d8817e4Smiod {
1116*3d8817e4Smiod int sign = GET_FIELD (insn, 31, 31);
1117*3d8817e4Smiod int imm11 = GET_FIELD (insn, 18, 28);
1118*3d8817e4Smiod int disp;
1119*3d8817e4Smiod
1120*3d8817e4Smiod if (sign)
1121*3d8817e4Smiod disp = (-1 << 11) | imm11;
1122*3d8817e4Smiod else
1123*3d8817e4Smiod disp = imm11;
1124*3d8817e4Smiod
1125*3d8817e4Smiod disp <<= 2;
1126*3d8817e4Smiod fput_const (disp, info);
1127*3d8817e4Smiod break;
1128*3d8817e4Smiod }
1129*3d8817e4Smiod
1130*3d8817e4Smiod case '>':
1131*3d8817e4Smiod case 'y':
1132*3d8817e4Smiod {
1133*3d8817e4Smiod /* 16-bit long disp., PA2.0 wide only. */
1134*3d8817e4Smiod int disp = extract_16 (insn);
1135*3d8817e4Smiod disp &= ~3;
1136*3d8817e4Smiod fput_const (disp, info);
1137*3d8817e4Smiod break;
1138*3d8817e4Smiod }
1139*3d8817e4Smiod
1140*3d8817e4Smiod case '&':
1141*3d8817e4Smiod {
1142*3d8817e4Smiod /* 16-bit long disp., PA2.0 wide only. */
1143*3d8817e4Smiod int disp = extract_16 (insn);
1144*3d8817e4Smiod disp &= ~7;
1145*3d8817e4Smiod fput_const (disp, info);
1146*3d8817e4Smiod break;
1147*3d8817e4Smiod }
1148*3d8817e4Smiod
1149*3d8817e4Smiod case '_':
1150*3d8817e4Smiod break; /* Dealt with by '{' */
1151*3d8817e4Smiod
1152*3d8817e4Smiod case '{':
1153*3d8817e4Smiod {
1154*3d8817e4Smiod int sub = GET_FIELD (insn, 14, 16);
1155*3d8817e4Smiod int df = GET_FIELD (insn, 17, 18);
1156*3d8817e4Smiod int sf = GET_FIELD (insn, 19, 20);
1157*3d8817e4Smiod const char * const * source = float_format_names;
1158*3d8817e4Smiod const char * const * dest = float_format_names;
1159*3d8817e4Smiod char *t = "";
1160*3d8817e4Smiod
1161*3d8817e4Smiod if (sub == 4)
1162*3d8817e4Smiod {
1163*3d8817e4Smiod fputs_filtered (",UND ", info);
1164*3d8817e4Smiod break;
1165*3d8817e4Smiod }
1166*3d8817e4Smiod if ((sub & 3) == 3)
1167*3d8817e4Smiod t = ",t";
1168*3d8817e4Smiod if ((sub & 3) == 1)
1169*3d8817e4Smiod source = sub & 4 ? fcnv_ufixed_names : fcnv_fixed_names;
1170*3d8817e4Smiod if (sub & 2)
1171*3d8817e4Smiod dest = sub & 4 ? fcnv_ufixed_names : fcnv_fixed_names;
1172*3d8817e4Smiod
1173*3d8817e4Smiod (*info->fprintf_func) (info->stream, "%s%s%s ",
1174*3d8817e4Smiod t, source[sf], dest[df]);
1175*3d8817e4Smiod break;
1176*3d8817e4Smiod }
1177*3d8817e4Smiod
1178*3d8817e4Smiod case 'm':
1179*3d8817e4Smiod {
1180*3d8817e4Smiod int y = GET_FIELD (insn, 16, 18);
1181*3d8817e4Smiod
1182*3d8817e4Smiod if (y != 1)
1183*3d8817e4Smiod fput_const ((y ^ 1) - 1, info);
1184*3d8817e4Smiod }
1185*3d8817e4Smiod break;
1186*3d8817e4Smiod
1187*3d8817e4Smiod case 'h':
1188*3d8817e4Smiod {
1189*3d8817e4Smiod int cbit;
1190*3d8817e4Smiod
1191*3d8817e4Smiod cbit = GET_FIELD (insn, 16, 18);
1192*3d8817e4Smiod
1193*3d8817e4Smiod if (cbit > 0)
1194*3d8817e4Smiod (*info->fprintf_func) (info->stream, ",%d", cbit - 1);
1195*3d8817e4Smiod break;
1196*3d8817e4Smiod }
1197*3d8817e4Smiod
1198*3d8817e4Smiod case '=':
1199*3d8817e4Smiod {
1200*3d8817e4Smiod int cond = GET_FIELD (insn, 27, 31);
1201*3d8817e4Smiod
1202*3d8817e4Smiod switch (cond)
1203*3d8817e4Smiod {
1204*3d8817e4Smiod case 0: fputs_filtered (" ", info); break;
1205*3d8817e4Smiod case 1: fputs_filtered ("acc ", info); break;
1206*3d8817e4Smiod case 2: fputs_filtered ("rej ", info); break;
1207*3d8817e4Smiod case 5: fputs_filtered ("acc8 ", info); break;
1208*3d8817e4Smiod case 6: fputs_filtered ("rej8 ", info); break;
1209*3d8817e4Smiod case 9: fputs_filtered ("acc6 ", info); break;
1210*3d8817e4Smiod case 13: fputs_filtered ("acc4 ", info); break;
1211*3d8817e4Smiod case 17: fputs_filtered ("acc2 ", info); break;
1212*3d8817e4Smiod default: break;
1213*3d8817e4Smiod }
1214*3d8817e4Smiod break;
1215*3d8817e4Smiod }
1216*3d8817e4Smiod
1217*3d8817e4Smiod case 'X':
1218*3d8817e4Smiod (*info->print_address_func)
1219*3d8817e4Smiod (memaddr + 8 + extract_22 (insn), info);
1220*3d8817e4Smiod break;
1221*3d8817e4Smiod case 'L':
1222*3d8817e4Smiod fputs_filtered (",rp", info);
1223*3d8817e4Smiod break;
1224*3d8817e4Smiod default:
1225*3d8817e4Smiod (*info->fprintf_func) (info->stream, "%c", *s);
1226*3d8817e4Smiod break;
1227*3d8817e4Smiod }
1228*3d8817e4Smiod }
1229*3d8817e4Smiod return sizeof (insn);
1230*3d8817e4Smiod }
1231*3d8817e4Smiod }
1232*3d8817e4Smiod (*info->fprintf_func) (info->stream, "#%8x", insn);
1233*3d8817e4Smiod return sizeof (insn);
1234*3d8817e4Smiod }
1235