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