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