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