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