1 /* Disassemble ADI Blackfin Instructions.
2 Copyright (C) 2005-2017 Free Software Foundation, Inc.
4 This file is part of libopcodes.
6 This library is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation; either version 3, or (at your option)
11 It is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14 License for more details.
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
19 MA 02110-1301, USA. */
24 #include "opcode/bfin.h"
36 #define HOST_LONG_WORD_SIZE (sizeof (long) * 8)
37 #define XFIELD(w,p,s) (((w) & ((1 << (s)) - 1) << (p)) >> (p))
38 #define SIGNEXTEND(v, n) ((v << (HOST_LONG_WORD_SIZE - (n))) >> (HOST_LONG_WORD_SIZE - (n)))
39 #define MASKBITS(val, bits) (val & ((1 << bits) - 1))
41 #include "disassemble.h"
43 typedef unsigned int bu32
;
48 bfd_boolean comment
, parallel
;
53 c_0
, c_1
, c_4
, c_2
, c_uimm2
, c_uimm3
, c_imm3
, c_pcrel4
,
54 c_imm4
, c_uimm4s4
, c_uimm4s4d
, c_uimm4
, c_uimm4s2
, c_negimm5s4
, c_imm5
, c_imm5d
, c_uimm5
, c_imm6
,
55 c_imm7
, c_imm7d
, c_imm8
, c_uimm8
, c_pcrel8
, c_uimm8s4
, c_pcrel8s4
, c_lppcrel10
, c_pcrel10
,
56 c_pcrel12
, c_imm16s4
, c_luimm16
, c_imm16
, c_imm16d
, c_huimm16
, c_rimm16
, c_imm16s2
, c_uimm16s4
,
57 c_uimm16s4d
, c_uimm16
, c_pcrel24
, c_uimm32
, c_imm32
, c_huimm32
, c_huimm32e
,
74 } constant_formats
[] =
76 { "0", 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
77 { "1", 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
78 { "4", 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
79 { "2", 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
80 { "uimm2", 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
81 { "uimm3", 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
82 { "imm3", 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
83 { "pcrel4", 4, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0},
84 { "imm4", 4, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
85 { "uimm4s4", 4, 0, 0, 0, 2, 0, 0, 1, 0, 0, 0},
86 { "uimm4s4d", 4, 0, 0, 0, 2, 0, 0, 1, 1, 0, 0},
87 { "uimm4", 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
88 { "uimm4s2", 4, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0},
89 { "negimm5s4", 5, 0, 1, 0, 2, 0, 1, 0, 0, 0, 0},
90 { "imm5", 5, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
91 { "imm5d", 5, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0},
92 { "uimm5", 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
93 { "imm6", 6, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
94 { "imm7", 7, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
95 { "imm7d", 7, 0, 1, 0, 0, 0, 0, 0, 1, 3, 0},
96 { "imm8", 8, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
97 { "uimm8", 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
98 { "pcrel8", 8, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0},
99 { "uimm8s4", 8, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0},
100 { "pcrel8s4", 8, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0},
101 { "lppcrel10", 10, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0},
102 { "pcrel10", 10, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0},
103 { "pcrel12", 12, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0},
104 { "imm16s4", 16, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0},
105 { "luimm16", 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
106 { "imm16", 16, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
107 { "imm16d", 16, 0, 1, 0, 0, 0, 0, 0, 1, 3, 0},
108 { "huimm16", 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
109 { "rimm16", 16, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0},
110 { "imm16s2", 16, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0},
111 { "uimm16s4", 16, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0},
112 { "uimm16s4d", 16, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0},
113 { "uimm16", 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
114 { "pcrel24", 24, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0},
115 { "uimm32", 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
116 { "imm32", 32, 0, 1, 0, 0, 0, 0, 0, 1, 3, 0},
117 { "huimm32", 32, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
118 { "huimm32e", 32, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
122 fmtconst (const_forms_t cf
, TIword x
, bfd_vma pc
, disassemble_info
*outf
)
126 if (constant_formats
[cf
].reloc
)
128 bfd_vma ea
= (((constant_formats
[cf
].pcrel
? SIGNEXTEND (x
, constant_formats
[cf
].nbits
)
129 : x
) + constant_formats
[cf
].offset
) << constant_formats
[cf
].scale
);
130 if (constant_formats
[cf
].pcrel
)
133 /* truncate to 32-bits for proper symbol lookup/matching */
136 if (outf
->symbol_at_address_func (ea
, outf
) || !constant_formats
[cf
].exact
)
138 outf
->print_address_func (ea
, outf
);
143 sprintf (buf
, "%lx", (unsigned long) x
);
148 /* Negative constants have an implied sign bit. */
149 if (constant_formats
[cf
].negative
)
151 int nb
= constant_formats
[cf
].nbits
+ 1;
153 x
= x
| (1 << constant_formats
[cf
].nbits
);
154 x
= SIGNEXTEND (x
, nb
);
157 x
= constant_formats
[cf
].issigned
? SIGNEXTEND (x
, constant_formats
[cf
].nbits
) : x
;
159 if (constant_formats
[cf
].offset
)
160 x
+= constant_formats
[cf
].offset
;
162 if (constant_formats
[cf
].scale
)
163 x
<<= constant_formats
[cf
].scale
;
165 if (constant_formats
[cf
].decimal
)
166 sprintf (buf
, "%*li", constant_formats
[cf
].leading
, x
);
169 if (constant_formats
[cf
].issigned
&& x
< 0)
170 sprintf (buf
, "-0x%lx", (unsigned long)(- x
));
172 sprintf (buf
, "0x%lx", (unsigned long) x
);
179 fmtconst_val (const_forms_t cf
, unsigned int x
, unsigned int pc
)
181 if (0 && constant_formats
[cf
].reloc
)
183 bu32 ea
= (((constant_formats
[cf
].pcrel
184 ? SIGNEXTEND (x
, constant_formats
[cf
].nbits
)
185 : x
) + constant_formats
[cf
].offset
)
186 << constant_formats
[cf
].scale
);
187 if (constant_formats
[cf
].pcrel
)
193 /* Negative constants have an implied sign bit. */
194 if (constant_formats
[cf
].negative
)
196 int nb
= constant_formats
[cf
].nbits
+ 1;
197 x
= x
| (1 << constant_formats
[cf
].nbits
);
198 x
= SIGNEXTEND (x
, nb
);
200 else if (constant_formats
[cf
].issigned
)
201 x
= SIGNEXTEND (x
, constant_formats
[cf
].nbits
);
203 x
+= constant_formats
[cf
].offset
;
204 x
<<= constant_formats
[cf
].scale
;
209 enum machine_registers
211 REG_RL0
, REG_RL1
, REG_RL2
, REG_RL3
, REG_RL4
, REG_RL5
, REG_RL6
, REG_RL7
,
212 REG_RH0
, REG_RH1
, REG_RH2
, REG_RH3
, REG_RH4
, REG_RH5
, REG_RH6
, REG_RH7
,
213 REG_R0
, REG_R1
, REG_R2
, REG_R3
, REG_R4
, REG_R5
, REG_R6
, REG_R7
,
214 REG_R1_0
, REG_R3_2
, REG_R5_4
, REG_R7_6
, REG_P0
, REG_P1
, REG_P2
, REG_P3
,
215 REG_P4
, REG_P5
, REG_SP
, REG_FP
, REG_A0x
, REG_A1x
, REG_A0w
, REG_A1w
,
216 REG_A0
, REG_A1
, REG_I0
, REG_I1
, REG_I2
, REG_I3
, REG_M0
, REG_M1
,
217 REG_M2
, REG_M3
, REG_B0
, REG_B1
, REG_B2
, REG_B3
, REG_L0
, REG_L1
,
219 REG_AZ
, REG_AN
, REG_AC0
, REG_AC1
, REG_AV0
, REG_AV1
, REG_AV0S
, REG_AV1S
,
220 REG_AQ
, REG_V
, REG_VS
,
221 REG_sftreset
, REG_omode
, REG_excause
, REG_emucause
, REG_idle_req
, REG_hwerrcause
, REG_CC
, REG_LC0
,
222 REG_LC1
, REG_ASTAT
, REG_RETS
, REG_LT0
, REG_LB0
, REG_LT1
, REG_LB1
,
223 REG_CYCLES
, REG_CYCLES2
, REG_USP
, REG_SEQSTAT
, REG_SYSCFG
, REG_RETI
, REG_RETX
, REG_RETN
,
224 REG_RETE
, REG_EMUDAT
, REG_BR0
, REG_BR1
, REG_BR2
, REG_BR3
, REG_BR4
, REG_BR5
, REG_BR6
,
225 REG_BR7
, REG_PL0
, REG_PL1
, REG_PL2
, REG_PL3
, REG_PL4
, REG_PL5
, REG_SLP
, REG_FLP
,
226 REG_PH0
, REG_PH1
, REG_PH2
, REG_PH3
, REG_PH4
, REG_PH5
, REG_SHP
, REG_FHP
,
227 REG_IL0
, REG_IL1
, REG_IL2
, REG_IL3
, REG_ML0
, REG_ML1
, REG_ML2
, REG_ML3
,
228 REG_BL0
, REG_BL1
, REG_BL2
, REG_BL3
, REG_LL0
, REG_LL1
, REG_LL2
, REG_LL3
,
229 REG_IH0
, REG_IH1
, REG_IH2
, REG_IH3
, REG_MH0
, REG_MH1
, REG_MH2
, REG_MH3
,
230 REG_BH0
, REG_BH1
, REG_BH2
, REG_BH3
, REG_LH0
, REG_LH1
, REG_LH2
, REG_LH3
,
231 REG_AC0_COPY
, REG_V_COPY
, REG_RND_MOD
,
237 rc_dregs_lo
, rc_dregs_hi
, rc_dregs
, rc_dregs_pair
, rc_pregs
, rc_spfp
, rc_dregs_hilo
, rc_accum_ext
,
238 rc_accum_word
, rc_accum
, rc_iregs
, rc_mregs
, rc_bregs
, rc_lregs
, rc_dpregs
, rc_gregs
,
239 rc_regs
, rc_statbits
, rc_ignore_bits
, rc_ccstat
, rc_counters
, rc_dregs2_sysregs1
, rc_open
, rc_sysregs2
,
240 rc_sysregs3
, rc_allregs
,
244 static const char * const reg_names
[] =
246 "R0.L", "R1.L", "R2.L", "R3.L", "R4.L", "R5.L", "R6.L", "R7.L",
247 "R0.H", "R1.H", "R2.H", "R3.H", "R4.H", "R5.H", "R6.H", "R7.H",
248 "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7",
249 "R1:0", "R3:2", "R5:4", "R7:6", "P0", "P1", "P2", "P3",
250 "P4", "P5", "SP", "FP", "A0.X", "A1.X", "A0.W", "A1.W",
251 "A0", "A1", "I0", "I1", "I2", "I3", "M0", "M1",
252 "M2", "M3", "B0", "B1", "B2", "B3", "L0", "L1",
254 "AZ", "AN", "AC0", "AC1", "AV0", "AV1", "AV0S", "AV1S",
256 "sftreset", "omode", "excause", "emucause", "idle_req", "hwerrcause", "CC", "LC0",
257 "LC1", "ASTAT", "RETS", "LT0", "LB0", "LT1", "LB1",
258 "CYCLES", "CYCLES2", "USP", "SEQSTAT", "SYSCFG", "RETI", "RETX", "RETN",
260 "R0.B", "R1.B", "R2.B", "R3.B", "R4.B", "R5.B", "R6.B", "R7.B",
261 "P0.L", "P1.L", "P2.L", "P3.L", "P4.L", "P5.L", "SP.L", "FP.L",
262 "P0.H", "P1.H", "P2.H", "P3.H", "P4.H", "P5.H", "SP.H", "FP.H",
263 "I0.L", "I1.L", "I2.L", "I3.L", "M0.L", "M1.L", "M2.L", "M3.L",
264 "B0.L", "B1.L", "B2.L", "B3.L", "L0.L", "L1.L", "L2.L", "L3.L",
265 "I0.H", "I1.H", "I2.H", "I3.H", "M0.H", "M1.H", "M2.H", "M3.H",
266 "B0.H", "B1.H", "B2.H", "B3.H", "L0.H", "L1.H", "L2.H", "L3.H",
267 "AC0_COPY", "V_COPY", "RND_MOD",
272 #define REGNAME(x) ((x) < REG_LASTREG ? (reg_names[x]) : "...... Illegal register .......")
275 static const enum machine_registers decode_dregs_lo
[] =
277 REG_RL0
, REG_RL1
, REG_RL2
, REG_RL3
, REG_RL4
, REG_RL5
, REG_RL6
, REG_RL7
,
280 #define dregs_lo(x) REGNAME (decode_dregs_lo[(x) & 7])
283 static const enum machine_registers decode_dregs_hi
[] =
285 REG_RH0
, REG_RH1
, REG_RH2
, REG_RH3
, REG_RH4
, REG_RH5
, REG_RH6
, REG_RH7
,
288 #define dregs_hi(x) REGNAME (decode_dregs_hi[(x) & 7])
291 static const enum machine_registers decode_dregs
[] =
293 REG_R0
, REG_R1
, REG_R2
, REG_R3
, REG_R4
, REG_R5
, REG_R6
, REG_R7
,
296 #define dregs(x) REGNAME (decode_dregs[(x) & 7])
299 static const enum machine_registers decode_dregs_byte
[] =
301 REG_BR0
, REG_BR1
, REG_BR2
, REG_BR3
, REG_BR4
, REG_BR5
, REG_BR6
, REG_BR7
,
304 #define dregs_byte(x) REGNAME (decode_dregs_byte[(x) & 7])
307 static const enum machine_registers decode_pregs
[] =
309 REG_P0
, REG_P1
, REG_P2
, REG_P3
, REG_P4
, REG_P5
, REG_SP
, REG_FP
,
312 #define pregs(x) REGNAME (decode_pregs[(x) & 7])
313 #define spfp(x) REGNAME (decode_spfp[(x) & 1])
314 #define dregs_hilo(x, i) REGNAME (decode_dregs_hilo[((i) << 3) | (x)])
315 #define accum_ext(x) REGNAME (decode_accum_ext[(x) & 1])
316 #define accum_word(x) REGNAME (decode_accum_word[(x) & 1])
317 #define accum(x) REGNAME (decode_accum[(x) & 1])
320 static const enum machine_registers decode_iregs
[] =
322 REG_I0
, REG_I1
, REG_I2
, REG_I3
,
325 #define iregs(x) REGNAME (decode_iregs[(x) & 3])
328 static const enum machine_registers decode_mregs
[] =
330 REG_M0
, REG_M1
, REG_M2
, REG_M3
,
333 #define mregs(x) REGNAME (decode_mregs[(x) & 3])
334 #define bregs(x) REGNAME (decode_bregs[(x) & 3])
335 #define lregs(x) REGNAME (decode_lregs[(x) & 3])
338 static const enum machine_registers decode_dpregs
[] =
340 REG_R0
, REG_R1
, REG_R2
, REG_R3
, REG_R4
, REG_R5
, REG_R6
, REG_R7
,
341 REG_P0
, REG_P1
, REG_P2
, REG_P3
, REG_P4
, REG_P5
, REG_SP
, REG_FP
,
344 #define dpregs(x) REGNAME (decode_dpregs[(x) & 15])
347 static const enum machine_registers decode_gregs
[] =
349 REG_R0
, REG_R1
, REG_R2
, REG_R3
, REG_R4
, REG_R5
, REG_R6
, REG_R7
,
350 REG_P0
, REG_P1
, REG_P2
, REG_P3
, REG_P4
, REG_P5
, REG_SP
, REG_FP
,
353 #define gregs(x, i) REGNAME (decode_gregs[(((i) << 3) | (x)) & 15])
355 /* [dregs pregs (iregs mregs) (bregs lregs)]. */
356 static const enum machine_registers decode_regs
[] =
358 REG_R0
, REG_R1
, REG_R2
, REG_R3
, REG_R4
, REG_R5
, REG_R6
, REG_R7
,
359 REG_P0
, REG_P1
, REG_P2
, REG_P3
, REG_P4
, REG_P5
, REG_SP
, REG_FP
,
360 REG_I0
, REG_I1
, REG_I2
, REG_I3
, REG_M0
, REG_M1
, REG_M2
, REG_M3
,
361 REG_B0
, REG_B1
, REG_B2
, REG_B3
, REG_L0
, REG_L1
, REG_L2
, REG_L3
,
364 #define regs(x, i) REGNAME (decode_regs[(((i) << 3) | (x)) & 31])
366 /* [dregs pregs (iregs mregs) (bregs lregs) Low Half]. */
367 static const enum machine_registers decode_regs_lo
[] =
369 REG_RL0
, REG_RL1
, REG_RL2
, REG_RL3
, REG_RL4
, REG_RL5
, REG_RL6
, REG_RL7
,
370 REG_PL0
, REG_PL1
, REG_PL2
, REG_PL3
, REG_PL4
, REG_PL5
, REG_SLP
, REG_FLP
,
371 REG_IL0
, REG_IL1
, REG_IL2
, REG_IL3
, REG_ML0
, REG_ML1
, REG_ML2
, REG_ML3
,
372 REG_BL0
, REG_BL1
, REG_BL2
, REG_BL3
, REG_LL0
, REG_LL1
, REG_LL2
, REG_LL3
,
375 #define regs_lo(x, i) REGNAME (decode_regs_lo[(((i) << 3) | (x)) & 31])
377 /* [dregs pregs (iregs mregs) (bregs lregs) High Half]. */
378 static const enum machine_registers decode_regs_hi
[] =
380 REG_RH0
, REG_RH1
, REG_RH2
, REG_RH3
, REG_RH4
, REG_RH5
, REG_RH6
, REG_RH7
,
381 REG_PH0
, REG_PH1
, REG_PH2
, REG_PH3
, REG_PH4
, REG_PH5
, REG_SHP
, REG_FHP
,
382 REG_IH0
, REG_IH1
, REG_IH2
, REG_IH3
, REG_MH0
, REG_MH1
, REG_MH2
, REG_MH3
,
383 REG_BH0
, REG_BH1
, REG_BH2
, REG_BH3
, REG_LH0
, REG_LH1
, REG_LH2
, REG_LH3
,
386 #define regs_hi(x, i) REGNAME (decode_regs_hi[(((i) << 3) | (x)) & 31])
388 static const enum machine_registers decode_statbits
[] =
390 REG_AZ
, REG_AN
, REG_AC0_COPY
, REG_V_COPY
,
391 REG_LASTREG
, REG_LASTREG
, REG_AQ
, REG_LASTREG
,
392 REG_RND_MOD
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
,
393 REG_AC0
, REG_AC1
, REG_LASTREG
, REG_LASTREG
,
394 REG_AV0
, REG_AV0S
, REG_AV1
, REG_AV1S
,
395 REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
,
396 REG_V
, REG_VS
, REG_LASTREG
, REG_LASTREG
,
397 REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
,
400 #define statbits(x) REGNAME (decode_statbits[(x) & 31])
403 static const enum machine_registers decode_counters
[] =
408 #define counters(x) REGNAME (decode_counters[(x) & 1])
409 #define dregs2_sysregs1(x) REGNAME (decode_dregs2_sysregs1[(x) & 7])
411 /* [dregs pregs (iregs mregs) (bregs lregs)
412 dregs2_sysregs1 open sysregs2 sysregs3]. */
413 static const enum machine_registers decode_allregs
[] =
415 REG_R0
, REG_R1
, REG_R2
, REG_R3
, REG_R4
, REG_R5
, REG_R6
, REG_R7
,
416 REG_P0
, REG_P1
, REG_P2
, REG_P3
, REG_P4
, REG_P5
, REG_SP
, REG_FP
,
417 REG_I0
, REG_I1
, REG_I2
, REG_I3
, REG_M0
, REG_M1
, REG_M2
, REG_M3
,
418 REG_B0
, REG_B1
, REG_B2
, REG_B3
, REG_L0
, REG_L1
, REG_L2
, REG_L3
,
419 REG_A0x
, REG_A0w
, REG_A1x
, REG_A1w
, REG_LASTREG
, REG_LASTREG
, REG_ASTAT
, REG_RETS
,
420 REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
,
421 REG_LC0
, REG_LT0
, REG_LB0
, REG_LC1
, REG_LT1
, REG_LB1
, REG_CYCLES
, REG_CYCLES2
,
422 REG_USP
, REG_SEQSTAT
, REG_SYSCFG
, REG_RETI
, REG_RETX
, REG_RETN
, REG_RETE
, REG_EMUDAT
,
426 #define IS_DREG(g,r) ((g) == 0 && (r) < 8)
427 #define IS_PREG(g,r) ((g) == 1 && (r) < 8)
428 #define IS_AREG(g,r) ((g) == 4 && (r) >= 0 && (r) < 4)
429 #define IS_GENREG(g,r) ((((g) == 0 || (g) == 1) && (r) < 8) || IS_AREG (g, r))
430 #define IS_DAGREG(g,r) (((g) == 2 || (g) == 3) && (r) < 8)
431 #define IS_SYSREG(g,r) \
432 (((g) == 4 && ((r) == 6 || (r) == 7)) || (g) == 6 || (g) == 7)
433 #define IS_RESERVEDREG(g,r) \
434 (((r) > 7) || ((g) == 4 && ((r) == 4 || (r) == 5)) || (g) == 5)
436 #define allreg(r,g) (!IS_RESERVEDREG (g, r))
437 #define mostreg(r,g) (!(IS_DREG (g, r) || IS_PREG (g, r) || IS_RESERVEDREG (g, r)))
439 #define allregs(x, i) REGNAME (decode_allregs[((i) << 3) | (x)])
440 #define uimm16s4(x) fmtconst (c_uimm16s4, x, 0, outf)
441 #define uimm16s4d(x) fmtconst (c_uimm16s4d, x, 0, outf)
442 #define pcrel4(x) fmtconst (c_pcrel4, x, pc, outf)
443 #define pcrel8(x) fmtconst (c_pcrel8, x, pc, outf)
444 #define pcrel8s4(x) fmtconst (c_pcrel8s4, x, pc, outf)
445 #define pcrel10(x) fmtconst (c_pcrel10, x, pc, outf)
446 #define pcrel12(x) fmtconst (c_pcrel12, x, pc, outf)
447 #define negimm5s4(x) fmtconst (c_negimm5s4, x, 0, outf)
448 #define rimm16(x) fmtconst (c_rimm16, x, 0, outf)
449 #define huimm16(x) fmtconst (c_huimm16, x, 0, outf)
450 #define imm16(x) fmtconst (c_imm16, x, 0, outf)
451 #define imm16d(x) fmtconst (c_imm16d, x, 0, outf)
452 #define uimm2(x) fmtconst (c_uimm2, x, 0, outf)
453 #define uimm3(x) fmtconst (c_uimm3, x, 0, outf)
454 #define luimm16(x) fmtconst (c_luimm16, x, 0, outf)
455 #define uimm4(x) fmtconst (c_uimm4, x, 0, outf)
456 #define uimm5(x) fmtconst (c_uimm5, x, 0, outf)
457 #define imm16s2(x) fmtconst (c_imm16s2, x, 0, outf)
458 #define uimm8(x) fmtconst (c_uimm8, x, 0, outf)
459 #define imm16s4(x) fmtconst (c_imm16s4, x, 0, outf)
460 #define uimm4s2(x) fmtconst (c_uimm4s2, x, 0, outf)
461 #define uimm4s4(x) fmtconst (c_uimm4s4, x, 0, outf)
462 #define uimm4s4d(x) fmtconst (c_uimm4s4d, x, 0, outf)
463 #define lppcrel10(x) fmtconst (c_lppcrel10, x, pc, outf)
464 #define imm3(x) fmtconst (c_imm3, x, 0, outf)
465 #define imm4(x) fmtconst (c_imm4, x, 0, outf)
466 #define uimm8s4(x) fmtconst (c_uimm8s4, x, 0, outf)
467 #define imm5(x) fmtconst (c_imm5, x, 0, outf)
468 #define imm5d(x) fmtconst (c_imm5d, x, 0, outf)
469 #define imm6(x) fmtconst (c_imm6, x, 0, outf)
470 #define imm7(x) fmtconst (c_imm7, x, 0, outf)
471 #define imm7d(x) fmtconst (c_imm7d, x, 0, outf)
472 #define imm8(x) fmtconst (c_imm8, x, 0, outf)
473 #define pcrel24(x) fmtconst (c_pcrel24, x, pc, outf)
474 #define uimm16(x) fmtconst (c_uimm16, x, 0, outf)
475 #define uimm32(x) fmtconst (c_uimm32, x, 0, outf)
476 #define imm32(x) fmtconst (c_imm32, x, 0, outf)
477 #define huimm32(x) fmtconst (c_huimm32, x, 0, outf)
478 #define huimm32e(x) fmtconst (c_huimm32e, x, 0, outf)
479 #define imm7_val(x) fmtconst_val (c_imm7, x, 0)
480 #define imm16_val(x) fmtconst_val (c_uimm16, x, 0)
481 #define luimm16_val(x) fmtconst_val (c_luimm16, x, 0)
483 /* (arch.pm)arch_disassembler_functions. */
485 #define OUTS(p, txt) (p)->fprintf_func ((p)->stream, "%s", txt)
487 #define OUT(p, txt, ...) (p)->fprintf_func ((p)->stream, txt, ## __VA_ARGS__)
490 amod0 (int s0
, int x0
, disassemble_info
*outf
)
492 if (s0
== 1 && x0
== 0)
494 else if (s0
== 0 && x0
== 1)
495 OUTS (outf
, " (CO)");
496 else if (s0
== 1 && x0
== 1)
497 OUTS (outf
, " (SCO)");
501 amod1 (int s0
, int x0
, disassemble_info
*outf
)
503 if (s0
== 0 && x0
== 0)
504 OUTS (outf
, " (NS)");
505 else if (s0
== 1 && x0
== 0)
510 amod0amod2 (int s0
, int x0
, int aop0
, disassemble_info
*outf
)
512 if (s0
== 1 && x0
== 0 && aop0
== 0)
514 else if (s0
== 0 && x0
== 1 && aop0
== 0)
515 OUTS (outf
, " (CO)");
516 else if (s0
== 1 && x0
== 1 && aop0
== 0)
517 OUTS (outf
, " (SCO)");
518 else if (s0
== 0 && x0
== 0 && aop0
== 2)
519 OUTS (outf
, " (ASR)");
520 else if (s0
== 1 && x0
== 0 && aop0
== 2)
521 OUTS (outf
, " (S, ASR)");
522 else if (s0
== 0 && x0
== 1 && aop0
== 2)
523 OUTS (outf
, " (CO, ASR)");
524 else if (s0
== 1 && x0
== 1 && aop0
== 2)
525 OUTS (outf
, " (SCO, ASR)");
526 else if (s0
== 0 && x0
== 0 && aop0
== 3)
527 OUTS (outf
, " (ASL)");
528 else if (s0
== 1 && x0
== 0 && aop0
== 3)
529 OUTS (outf
, " (S, ASL)");
530 else if (s0
== 0 && x0
== 1 && aop0
== 3)
531 OUTS (outf
, " (CO, ASL)");
532 else if (s0
== 1 && x0
== 1 && aop0
== 3)
533 OUTS (outf
, " (SCO, ASL)");
537 searchmod (int r0
, disassemble_info
*outf
)
550 aligndir (int r0
, disassemble_info
*outf
)
557 decode_multfunc (int h0
, int h1
, int src0
, int src1
, disassemble_info
*outf
)
562 s0
= dregs_hi (src0
);
564 s0
= dregs_lo (src0
);
567 s1
= dregs_hi (src1
);
569 s1
= dregs_lo (src1
);
578 decode_macfunc (int which
, int op
, int h0
, int h1
, int src0
, int src1
, disassemble_info
*outf
)
581 const char *sop
= "<unknown op>";
596 case 0: sop
= " = "; break;
597 case 1: sop
= " += "; break;
598 case 2: sop
= " -= "; break;
604 decode_multfunc (h0
, h1
, src0
, src1
, outf
);
610 decode_optmode (int mod
, int MM
, disassemble_info
*outf
)
612 if (mod
== 0 && MM
== 0)
627 OUTS (outf
, "S2RND");
630 else if (mod
== M_W32
)
632 else if (mod
== M_FU
)
634 else if (mod
== M_TFU
)
636 else if (mod
== M_IS
)
638 else if (mod
== M_ISS2
)
640 else if (mod
== M_IH
)
642 else if (mod
== M_IU
)
650 static struct saved_state
652 bu32 dpregs
[16], iregs
[4], mregs
[4], bregs
[4], lregs
[4];
654 bu32 lt
[2], lc
[2], lb
[2];
658 #define DREG(x) (saved_state.dpregs[x])
659 #define GREG(x, i) DPREG ((x) | ((i) << 3))
660 #define DPREG(x) (saved_state.dpregs[x])
661 #define DREG(x) (saved_state.dpregs[x])
662 #define PREG(x) (saved_state.dpregs[(x) + 8])
663 #define SPREG PREG (6)
664 #define FPREG PREG (7)
665 #define IREG(x) (saved_state.iregs[x])
666 #define MREG(x) (saved_state.mregs[x])
667 #define BREG(x) (saved_state.bregs[x])
668 #define LREG(x) (saved_state.lregs[x])
669 #define AXREG(x) (saved_state.ax[x])
670 #define AWREG(x) (saved_state.aw[x])
671 #define LCREG(x) (saved_state.lc[x])
672 #define LTREG(x) (saved_state.lt[x])
673 #define LBREG(x) (saved_state.lb[x])
674 #define RETSREG (saved_state.rets)
677 get_allreg (int grp
, int reg
)
679 int fullreg
= (grp
<< 3) | reg
;
680 /* REG_R0, REG_R1, REG_R2, REG_R3, REG_R4, REG_R5, REG_R6, REG_R7,
681 REG_P0, REG_P1, REG_P2, REG_P3, REG_P4, REG_P5, REG_SP, REG_FP,
682 REG_I0, REG_I1, REG_I2, REG_I3, REG_M0, REG_M1, REG_M2, REG_M3,
683 REG_B0, REG_B1, REG_B2, REG_B3, REG_L0, REG_L1, REG_L2, REG_L3,
684 REG_A0x, REG_A0w, REG_A1x, REG_A1w, , , REG_ASTAT, REG_RETS,
686 REG_LC0, REG_LT0, REG_LB0, REG_LC1, REG_LT1, REG_LB1, REG_CYCLES,
688 REG_USP, REG_SEQSTAT, REG_SYSCFG, REG_RETI, REG_RETX, REG_RETN, REG_RETE,
690 switch (fullreg
>> 2)
692 case 0: case 1: return &DREG (reg
);
693 case 2: case 3: return &PREG (reg
);
694 case 4: return &IREG (reg
& 3);
695 case 5: return &MREG (reg
& 3);
696 case 6: return &BREG (reg
& 3);
697 case 7: return &LREG (reg
& 3);
701 case 32: return &AXREG (0);
702 case 33: return &AWREG (0);
703 case 34: return &AXREG (1);
704 case 35: return &AWREG (1);
705 case 39: return &RETSREG
;
706 case 48: return &LCREG (0);
707 case 49: return <REG (0);
708 case 50: return &LBREG (0);
709 case 51: return &LCREG (1);
710 case 52: return <REG (1);
711 case 53: return &LBREG (1);
718 decode_ProgCtrl_0 (TIword iw0
, disassemble_info
*outf
)
720 struct private *priv
= outf
->private_data
;
722 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
723 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |.prgfunc.......|.poprnd........|
724 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
725 int poprnd
= ((iw0
>> ProgCtrl_poprnd_bits
) & ProgCtrl_poprnd_mask
);
726 int prgfunc
= ((iw0
>> ProgCtrl_prgfunc_bits
) & ProgCtrl_prgfunc_mask
);
728 if (prgfunc
== 0 && poprnd
== 0)
730 else if (priv
->parallel
)
732 else if (prgfunc
== 1 && poprnd
== 0)
734 else if (prgfunc
== 1 && poprnd
== 1)
736 else if (prgfunc
== 1 && poprnd
== 2)
738 else if (prgfunc
== 1 && poprnd
== 3)
740 else if (prgfunc
== 1 && poprnd
== 4)
742 else if (prgfunc
== 2 && poprnd
== 0)
744 else if (prgfunc
== 2 && poprnd
== 3)
745 OUTS (outf
, "CSYNC");
746 else if (prgfunc
== 2 && poprnd
== 4)
747 OUTS (outf
, "SSYNC");
748 else if (prgfunc
== 2 && poprnd
== 5)
749 OUTS (outf
, "EMUEXCPT");
750 else if (prgfunc
== 3 && IS_DREG (0, poprnd
))
753 OUTS (outf
, dregs (poprnd
));
755 else if (prgfunc
== 4 && IS_DREG (0, poprnd
))
758 OUTS (outf
, dregs (poprnd
));
760 else if (prgfunc
== 5 && IS_PREG (1, poprnd
))
762 OUTS (outf
, "JUMP (");
763 OUTS (outf
, pregs (poprnd
));
766 else if (prgfunc
== 6 && IS_PREG (1, poprnd
))
768 OUTS (outf
, "CALL (");
769 OUTS (outf
, pregs (poprnd
));
772 else if (prgfunc
== 7 && IS_PREG (1, poprnd
))
774 OUTS (outf
, "CALL (PC + ");
775 OUTS (outf
, pregs (poprnd
));
778 else if (prgfunc
== 8 && IS_PREG (1, poprnd
))
780 OUTS (outf
, "JUMP (PC + ");
781 OUTS (outf
, pregs (poprnd
));
784 else if (prgfunc
== 9)
786 OUTS (outf
, "RAISE ");
787 OUTS (outf
, uimm4 (poprnd
));
789 else if (prgfunc
== 10)
791 OUTS (outf
, "EXCPT ");
792 OUTS (outf
, uimm4 (poprnd
));
794 else if (prgfunc
== 11 && IS_PREG (1, poprnd
) && poprnd
<= 5)
796 OUTS (outf
, "TESTSET (");
797 OUTS (outf
, pregs (poprnd
));
806 decode_CaCTRL_0 (TIword iw0
, disassemble_info
*outf
)
808 struct private *priv
= outf
->private_data
;
810 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
811 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 |.a.|.op....|.reg.......|
812 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
813 int a
= ((iw0
>> CaCTRL_a_bits
) & CaCTRL_a_mask
);
814 int op
= ((iw0
>> CaCTRL_op_bits
) & CaCTRL_op_mask
);
815 int reg
= ((iw0
>> CaCTRL_reg_bits
) & CaCTRL_reg_mask
);
820 if (a
== 0 && op
== 0)
822 OUTS (outf
, "PREFETCH[");
823 OUTS (outf
, pregs (reg
));
826 else if (a
== 0 && op
== 1)
828 OUTS (outf
, "FLUSHINV[");
829 OUTS (outf
, pregs (reg
));
832 else if (a
== 0 && op
== 2)
834 OUTS (outf
, "FLUSH[");
835 OUTS (outf
, pregs (reg
));
838 else if (a
== 0 && op
== 3)
840 OUTS (outf
, "IFLUSH[");
841 OUTS (outf
, pregs (reg
));
844 else if (a
== 1 && op
== 0)
846 OUTS (outf
, "PREFETCH[");
847 OUTS (outf
, pregs (reg
));
850 else if (a
== 1 && op
== 1)
852 OUTS (outf
, "FLUSHINV[");
853 OUTS (outf
, pregs (reg
));
856 else if (a
== 1 && op
== 2)
858 OUTS (outf
, "FLUSH[");
859 OUTS (outf
, pregs (reg
));
862 else if (a
== 1 && op
== 3)
864 OUTS (outf
, "IFLUSH[");
865 OUTS (outf
, pregs (reg
));
874 decode_PushPopReg_0 (TIword iw0
, disassemble_info
*outf
)
876 struct private *priv
= outf
->private_data
;
878 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
879 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |.W.|.grp.......|.reg.......|
880 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
881 int W
= ((iw0
>> PushPopReg_W_bits
) & PushPopReg_W_mask
);
882 int grp
= ((iw0
>> PushPopReg_grp_bits
) & PushPopReg_grp_mask
);
883 int reg
= ((iw0
>> PushPopReg_reg_bits
) & PushPopReg_reg_mask
);
888 if (W
== 0 && mostreg (reg
, grp
))
890 OUTS (outf
, allregs (reg
, grp
));
891 OUTS (outf
, " = [SP++]");
893 else if (W
== 1 && allreg (reg
, grp
) && !(grp
== 1 && reg
== 6))
895 OUTS (outf
, "[--SP] = ");
896 OUTS (outf
, allregs (reg
, grp
));
904 decode_PushPopMultiple_0 (TIword iw0
, disassemble_info
*outf
)
906 struct private *priv
= outf
->private_data
;
908 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
909 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |.d.|.p.|.W.|.dr........|.pr........|
910 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
911 int p
= ((iw0
>> PushPopMultiple_p_bits
) & PushPopMultiple_p_mask
);
912 int d
= ((iw0
>> PushPopMultiple_d_bits
) & PushPopMultiple_d_mask
);
913 int W
= ((iw0
>> PushPopMultiple_W_bits
) & PushPopMultiple_W_mask
);
914 int dr
= ((iw0
>> PushPopMultiple_dr_bits
) & PushPopMultiple_dr_mask
);
915 int pr
= ((iw0
>> PushPopMultiple_pr_bits
) & PushPopMultiple_pr_mask
);
923 if (W
== 1 && d
== 1 && p
== 1)
925 OUTS (outf
, "[--SP] = (R7:");
926 OUTS (outf
, imm5d (dr
));
927 OUTS (outf
, ", P5:");
928 OUTS (outf
, imm5d (pr
));
931 else if (W
== 1 && d
== 1 && p
== 0 && pr
== 0)
933 OUTS (outf
, "[--SP] = (R7:");
934 OUTS (outf
, imm5d (dr
));
937 else if (W
== 1 && d
== 0 && p
== 1 && dr
== 0)
939 OUTS (outf
, "[--SP] = (P5:");
940 OUTS (outf
, imm5d (pr
));
943 else if (W
== 0 && d
== 1 && p
== 1)
946 OUTS (outf
, imm5d (dr
));
947 OUTS (outf
, ", P5:");
948 OUTS (outf
, imm5d (pr
));
949 OUTS (outf
, ") = [SP++]");
951 else if (W
== 0 && d
== 1 && p
== 0 && pr
== 0)
954 OUTS (outf
, imm5d (dr
));
955 OUTS (outf
, ") = [SP++]");
957 else if (W
== 0 && d
== 0 && p
== 1 && dr
== 0)
960 OUTS (outf
, imm5d (pr
));
961 OUTS (outf
, ") = [SP++]");
969 decode_ccMV_0 (TIword iw0
, disassemble_info
*outf
)
971 struct private *priv
= outf
->private_data
;
973 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
974 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |.T.|.d.|.s.|.dst.......|.src.......|
975 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
976 int s
= ((iw0
>> CCmv_s_bits
) & CCmv_s_mask
);
977 int d
= ((iw0
>> CCmv_d_bits
) & CCmv_d_mask
);
978 int T
= ((iw0
>> CCmv_T_bits
) & CCmv_T_mask
);
979 int src
= ((iw0
>> CCmv_src_bits
) & CCmv_src_mask
);
980 int dst
= ((iw0
>> CCmv_dst_bits
) & CCmv_dst_mask
);
987 OUTS (outf
, "IF CC ");
988 OUTS (outf
, gregs (dst
, d
));
990 OUTS (outf
, gregs (src
, s
));
994 OUTS (outf
, "IF !CC ");
995 OUTS (outf
, gregs (dst
, d
));
997 OUTS (outf
, gregs (src
, s
));
1005 decode_CCflag_0 (TIword iw0
, disassemble_info
*outf
)
1007 struct private *priv
= outf
->private_data
;
1009 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1010 | 0 | 0 | 0 | 0 | 1 |.I.|.opc.......|.G.|.y.........|.x.........|
1011 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1012 int x
= ((iw0
>> CCflag_x_bits
) & CCflag_x_mask
);
1013 int y
= ((iw0
>> CCflag_y_bits
) & CCflag_y_mask
);
1014 int I
= ((iw0
>> CCflag_I_bits
) & CCflag_I_mask
);
1015 int G
= ((iw0
>> CCflag_G_bits
) & CCflag_G_mask
);
1016 int opc
= ((iw0
>> CCflag_opc_bits
) & CCflag_opc_mask
);
1021 if (opc
== 0 && I
== 0 && G
== 0)
1023 OUTS (outf
, "CC = ");
1024 OUTS (outf
, dregs (x
));
1025 OUTS (outf
, " == ");
1026 OUTS (outf
, dregs (y
));
1028 else if (opc
== 1 && I
== 0 && G
== 0)
1030 OUTS (outf
, "CC = ");
1031 OUTS (outf
, dregs (x
));
1033 OUTS (outf
, dregs (y
));
1035 else if (opc
== 2 && I
== 0 && G
== 0)
1037 OUTS (outf
, "CC = ");
1038 OUTS (outf
, dregs (x
));
1039 OUTS (outf
, " <= ");
1040 OUTS (outf
, dregs (y
));
1042 else if (opc
== 3 && I
== 0 && G
== 0)
1044 OUTS (outf
, "CC = ");
1045 OUTS (outf
, dregs (x
));
1047 OUTS (outf
, dregs (y
));
1048 OUTS (outf
, " (IU)");
1050 else if (opc
== 4 && I
== 0 && G
== 0)
1052 OUTS (outf
, "CC = ");
1053 OUTS (outf
, dregs (x
));
1054 OUTS (outf
, " <= ");
1055 OUTS (outf
, dregs (y
));
1056 OUTS (outf
, " (IU)");
1058 else if (opc
== 0 && I
== 1 && G
== 0)
1060 OUTS (outf
, "CC = ");
1061 OUTS (outf
, dregs (x
));
1062 OUTS (outf
, " == ");
1063 OUTS (outf
, imm3 (y
));
1065 else if (opc
== 1 && I
== 1 && G
== 0)
1067 OUTS (outf
, "CC = ");
1068 OUTS (outf
, dregs (x
));
1070 OUTS (outf
, imm3 (y
));
1072 else if (opc
== 2 && I
== 1 && G
== 0)
1074 OUTS (outf
, "CC = ");
1075 OUTS (outf
, dregs (x
));
1076 OUTS (outf
, " <= ");
1077 OUTS (outf
, imm3 (y
));
1079 else if (opc
== 3 && I
== 1 && G
== 0)
1081 OUTS (outf
, "CC = ");
1082 OUTS (outf
, dregs (x
));
1084 OUTS (outf
, uimm3 (y
));
1085 OUTS (outf
, " (IU)");
1087 else if (opc
== 4 && I
== 1 && G
== 0)
1089 OUTS (outf
, "CC = ");
1090 OUTS (outf
, dregs (x
));
1091 OUTS (outf
, " <= ");
1092 OUTS (outf
, uimm3 (y
));
1093 OUTS (outf
, " (IU)");
1095 else if (opc
== 0 && I
== 0 && G
== 1)
1097 OUTS (outf
, "CC = ");
1098 OUTS (outf
, pregs (x
));
1099 OUTS (outf
, " == ");
1100 OUTS (outf
, pregs (y
));
1102 else if (opc
== 1 && I
== 0 && G
== 1)
1104 OUTS (outf
, "CC = ");
1105 OUTS (outf
, pregs (x
));
1107 OUTS (outf
, pregs (y
));
1109 else if (opc
== 2 && I
== 0 && G
== 1)
1111 OUTS (outf
, "CC = ");
1112 OUTS (outf
, pregs (x
));
1113 OUTS (outf
, " <= ");
1114 OUTS (outf
, pregs (y
));
1116 else if (opc
== 3 && I
== 0 && G
== 1)
1118 OUTS (outf
, "CC = ");
1119 OUTS (outf
, pregs (x
));
1121 OUTS (outf
, pregs (y
));
1122 OUTS (outf
, " (IU)");
1124 else if (opc
== 4 && I
== 0 && G
== 1)
1126 OUTS (outf
, "CC = ");
1127 OUTS (outf
, pregs (x
));
1128 OUTS (outf
, " <= ");
1129 OUTS (outf
, pregs (y
));
1130 OUTS (outf
, " (IU)");
1132 else if (opc
== 0 && I
== 1 && G
== 1)
1134 OUTS (outf
, "CC = ");
1135 OUTS (outf
, pregs (x
));
1136 OUTS (outf
, " == ");
1137 OUTS (outf
, imm3 (y
));
1139 else if (opc
== 1 && I
== 1 && G
== 1)
1141 OUTS (outf
, "CC = ");
1142 OUTS (outf
, pregs (x
));
1144 OUTS (outf
, imm3 (y
));
1146 else if (opc
== 2 && I
== 1 && G
== 1)
1148 OUTS (outf
, "CC = ");
1149 OUTS (outf
, pregs (x
));
1150 OUTS (outf
, " <= ");
1151 OUTS (outf
, imm3 (y
));
1153 else if (opc
== 3 && I
== 1 && G
== 1)
1155 OUTS (outf
, "CC = ");
1156 OUTS (outf
, pregs (x
));
1158 OUTS (outf
, uimm3 (y
));
1159 OUTS (outf
, " (IU)");
1161 else if (opc
== 4 && I
== 1 && G
== 1)
1163 OUTS (outf
, "CC = ");
1164 OUTS (outf
, pregs (x
));
1165 OUTS (outf
, " <= ");
1166 OUTS (outf
, uimm3 (y
));
1167 OUTS (outf
, " (IU)");
1169 else if (opc
== 5 && I
== 0 && G
== 0 && x
== 0 && y
== 0)
1170 OUTS (outf
, "CC = A0 == A1");
1172 else if (opc
== 6 && I
== 0 && G
== 0 && x
== 0 && y
== 0)
1173 OUTS (outf
, "CC = A0 < A1");
1175 else if (opc
== 7 && I
== 0 && G
== 0 && x
== 0 && y
== 0)
1176 OUTS (outf
, "CC = A0 <= A1");
1184 decode_CC2dreg_0 (TIword iw0
, disassemble_info
*outf
)
1186 struct private *priv
= outf
->private_data
;
1188 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1189 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |.op....|.reg.......|
1190 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1191 int op
= ((iw0
>> CC2dreg_op_bits
) & CC2dreg_op_mask
);
1192 int reg
= ((iw0
>> CC2dreg_reg_bits
) & CC2dreg_reg_mask
);
1199 OUTS (outf
, dregs (reg
));
1200 OUTS (outf
, " = CC");
1204 OUTS (outf
, "CC = ");
1205 OUTS (outf
, dregs (reg
));
1207 else if (op
== 3 && reg
== 0)
1208 OUTS (outf
, "CC = !CC");
1216 decode_CC2stat_0 (TIword iw0
, disassemble_info
*outf
)
1218 struct private *priv
= outf
->private_data
;
1220 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1221 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |.D.|.op....|.cbit..............|
1222 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1223 int D
= ((iw0
>> CC2stat_D_bits
) & CC2stat_D_mask
);
1224 int op
= ((iw0
>> CC2stat_op_bits
) & CC2stat_op_mask
);
1225 int cbit
= ((iw0
>> CC2stat_cbit_bits
) & CC2stat_cbit_mask
);
1227 const char *bitname
= statbits (cbit
);
1228 const char * const op_names
[] = { "", "|", "&", "^" } ;
1233 if (decode_statbits
[cbit
] == REG_LASTREG
)
1235 /* All ASTAT bits except CC may be operated on in hardware, but may
1236 not have a dedicated insn, so still decode "valid" insns. */
1237 static char bitnames
[64];
1239 sprintf (bitnames
, "ASTAT[%i /* unused bit */]", cbit
);
1247 OUT (outf
, "CC %s= %s", op_names
[op
], bitname
);
1249 OUT (outf
, "%s %s= CC", bitname
, op_names
[op
]);
1255 decode_BRCC_0 (TIword iw0
, bfd_vma pc
, disassemble_info
*outf
)
1257 struct private *priv
= outf
->private_data
;
1259 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1260 | 0 | 0 | 0 | 1 |.T.|.B.|.offset................................|
1261 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1262 int B
= ((iw0
>> BRCC_B_bits
) & BRCC_B_mask
);
1263 int T
= ((iw0
>> BRCC_T_bits
) & BRCC_T_mask
);
1264 int offset
= ((iw0
>> BRCC_offset_bits
) & BRCC_offset_mask
);
1269 if (T
== 1 && B
== 1)
1271 OUTS (outf
, "IF CC JUMP 0x");
1272 OUTS (outf
, pcrel10 (offset
));
1273 OUTS (outf
, " (BP)");
1275 else if (T
== 0 && B
== 1)
1277 OUTS (outf
, "IF !CC JUMP 0x");
1278 OUTS (outf
, pcrel10 (offset
));
1279 OUTS (outf
, " (BP)");
1283 OUTS (outf
, "IF CC JUMP 0x");
1284 OUTS (outf
, pcrel10 (offset
));
1288 OUTS (outf
, "IF !CC JUMP 0x");
1289 OUTS (outf
, pcrel10 (offset
));
1298 decode_UJUMP_0 (TIword iw0
, bfd_vma pc
, disassemble_info
*outf
)
1300 struct private *priv
= outf
->private_data
;
1302 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1303 | 0 | 0 | 1 | 0 |.offset........................................|
1304 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1305 int offset
= ((iw0
>> UJump_offset_bits
) & UJump_offset_mask
);
1310 OUTS (outf
, "JUMP.S 0x");
1311 OUTS (outf
, pcrel12 (offset
));
1316 decode_REGMV_0 (TIword iw0
, disassemble_info
*outf
)
1319 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1320 | 0 | 0 | 1 | 1 |.gd........|.gs........|.dst.......|.src.......|
1321 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1322 int gs
= ((iw0
>> RegMv_gs_bits
) & RegMv_gs_mask
);
1323 int gd
= ((iw0
>> RegMv_gd_bits
) & RegMv_gd_mask
);
1324 int src
= ((iw0
>> RegMv_src_bits
) & RegMv_src_mask
);
1325 int dst
= ((iw0
>> RegMv_dst_bits
) & RegMv_dst_mask
);
1327 /* Reserved slots cannot be a src/dst. */
1328 if (IS_RESERVEDREG (gs
, src
) || IS_RESERVEDREG (gd
, dst
))
1331 /* Standard register moves */
1332 if ((gs
< 2) || /* Dregs/Pregs as source */
1333 (gd
< 2) || /* Dregs/Pregs as dest */
1334 (gs
== 4 && src
< 4) || /* Accumulators as source */
1335 (gd
== 4 && dst
< 4 && (gs
< 4)) || /* Accumulators as dest */
1336 (gs
== 7 && src
== 7 && !(gd
== 4 && dst
< 4)) || /* EMUDAT as src */
1337 (gd
== 7 && dst
== 7)) /* EMUDAT as dest */
1340 /* dareg = dareg (IMBL) */
1341 if (gs
< 4 && gd
< 4)
1344 /* USP can be src to sysregs, but not dagregs. */
1345 if ((gs
== 7 && src
== 0) && (gd
>= 4))
1348 /* USP can move between genregs (only check Accumulators). */
1349 if (((gs
== 7 && src
== 0) && (gd
== 4 && dst
< 4)) ||
1350 ((gd
== 7 && dst
== 0) && (gs
== 4 && src
< 4)))
1353 /* Still here ? Invalid reg pair. */
1358 OUTS (outf
, allregs (dst
, gd
));
1360 OUTS (outf
, allregs (src
, gs
));
1365 decode_ALU2op_0 (TIword iw0
, disassemble_info
*outf
)
1368 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1369 | 0 | 1 | 0 | 0 | 0 | 0 |.opc...........|.src.......|.dst.......|
1370 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1371 int src
= ((iw0
>> ALU2op_src_bits
) & ALU2op_src_mask
);
1372 int opc
= ((iw0
>> ALU2op_opc_bits
) & ALU2op_opc_mask
);
1373 int dst
= ((iw0
>> ALU2op_dst_bits
) & ALU2op_dst_mask
);
1377 OUTS (outf
, dregs (dst
));
1378 OUTS (outf
, " >>>= ");
1379 OUTS (outf
, dregs (src
));
1383 OUTS (outf
, dregs (dst
));
1384 OUTS (outf
, " >>= ");
1385 OUTS (outf
, dregs (src
));
1389 OUTS (outf
, dregs (dst
));
1390 OUTS (outf
, " <<= ");
1391 OUTS (outf
, dregs (src
));
1395 OUTS (outf
, dregs (dst
));
1396 OUTS (outf
, " *= ");
1397 OUTS (outf
, dregs (src
));
1401 OUTS (outf
, dregs (dst
));
1402 OUTS (outf
, " = (");
1403 OUTS (outf
, dregs (dst
));
1405 OUTS (outf
, dregs (src
));
1406 OUTS (outf
, ") << 0x1");
1410 OUTS (outf
, dregs (dst
));
1411 OUTS (outf
, " = (");
1412 OUTS (outf
, dregs (dst
));
1414 OUTS (outf
, dregs (src
));
1415 OUTS (outf
, ") << 0x2");
1419 OUTS (outf
, "DIVQ (");
1420 OUTS (outf
, dregs (dst
));
1422 OUTS (outf
, dregs (src
));
1427 OUTS (outf
, "DIVS (");
1428 OUTS (outf
, dregs (dst
));
1430 OUTS (outf
, dregs (src
));
1435 OUTS (outf
, dregs (dst
));
1437 OUTS (outf
, dregs_lo (src
));
1438 OUTS (outf
, " (X)");
1442 OUTS (outf
, dregs (dst
));
1444 OUTS (outf
, dregs_lo (src
));
1445 OUTS (outf
, " (Z)");
1449 OUTS (outf
, dregs (dst
));
1451 OUTS (outf
, dregs_byte (src
));
1452 OUTS (outf
, " (X)");
1456 OUTS (outf
, dregs (dst
));
1458 OUTS (outf
, dregs_byte (src
));
1459 OUTS (outf
, " (Z)");
1463 OUTS (outf
, dregs (dst
));
1464 OUTS (outf
, " = -");
1465 OUTS (outf
, dregs (src
));
1469 OUTS (outf
, dregs (dst
));
1470 OUTS (outf
, " =~ ");
1471 OUTS (outf
, dregs (src
));
1480 decode_PTR2op_0 (TIword iw0
, disassemble_info
*outf
)
1483 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1484 | 0 | 1 | 0 | 0 | 0 | 1 | 0 |.opc.......|.src.......|.dst.......|
1485 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1486 int src
= ((iw0
>> PTR2op_src_bits
) & PTR2op_dst_mask
);
1487 int opc
= ((iw0
>> PTR2op_opc_bits
) & PTR2op_opc_mask
);
1488 int dst
= ((iw0
>> PTR2op_dst_bits
) & PTR2op_dst_mask
);
1492 OUTS (outf
, pregs (dst
));
1493 OUTS (outf
, " -= ");
1494 OUTS (outf
, pregs (src
));
1498 OUTS (outf
, pregs (dst
));
1500 OUTS (outf
, pregs (src
));
1501 OUTS (outf
, " << 0x2");
1505 OUTS (outf
, pregs (dst
));
1507 OUTS (outf
, pregs (src
));
1508 OUTS (outf
, " >> 0x2");
1512 OUTS (outf
, pregs (dst
));
1514 OUTS (outf
, pregs (src
));
1515 OUTS (outf
, " >> 0x1");
1519 OUTS (outf
, pregs (dst
));
1520 OUTS (outf
, " += ");
1521 OUTS (outf
, pregs (src
));
1522 OUTS (outf
, " (BREV)");
1526 OUTS (outf
, pregs (dst
));
1527 OUTS (outf
, " = (");
1528 OUTS (outf
, pregs (dst
));
1530 OUTS (outf
, pregs (src
));
1531 OUTS (outf
, ") << 0x1");
1535 OUTS (outf
, pregs (dst
));
1536 OUTS (outf
, " = (");
1537 OUTS (outf
, pregs (dst
));
1539 OUTS (outf
, pregs (src
));
1540 OUTS (outf
, ") << 0x2");
1549 decode_LOGI2op_0 (TIword iw0
, disassemble_info
*outf
)
1551 struct private *priv
= outf
->private_data
;
1553 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1554 | 0 | 1 | 0 | 0 | 1 |.opc.......|.src...............|.dst.......|
1555 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1556 int src
= ((iw0
>> LOGI2op_src_bits
) & LOGI2op_src_mask
);
1557 int opc
= ((iw0
>> LOGI2op_opc_bits
) & LOGI2op_opc_mask
);
1558 int dst
= ((iw0
>> LOGI2op_dst_bits
) & LOGI2op_dst_mask
);
1565 OUTS (outf
, "CC = !BITTST (");
1566 OUTS (outf
, dregs (dst
));
1568 OUTS (outf
, uimm5 (src
));
1569 OUTS (outf
, ");\t\t/* bit");
1570 OUTS (outf
, imm7d (src
));
1572 priv
->comment
= TRUE
;
1576 OUTS (outf
, "CC = BITTST (");
1577 OUTS (outf
, dregs (dst
));
1579 OUTS (outf
, uimm5 (src
));
1580 OUTS (outf
, ");\t\t/* bit");
1581 OUTS (outf
, imm7d (src
));
1583 priv
->comment
= TRUE
;
1587 OUTS (outf
, "BITSET (");
1588 OUTS (outf
, dregs (dst
));
1590 OUTS (outf
, uimm5 (src
));
1591 OUTS (outf
, ");\t\t/* bit");
1592 OUTS (outf
, imm7d (src
));
1594 priv
->comment
= TRUE
;
1598 OUTS (outf
, "BITTGL (");
1599 OUTS (outf
, dregs (dst
));
1601 OUTS (outf
, uimm5 (src
));
1602 OUTS (outf
, ");\t\t/* bit");
1603 OUTS (outf
, imm7d (src
));
1605 priv
->comment
= TRUE
;
1609 OUTS (outf
, "BITCLR (");
1610 OUTS (outf
, dregs (dst
));
1612 OUTS (outf
, uimm5 (src
));
1613 OUTS (outf
, ");\t\t/* bit");
1614 OUTS (outf
, imm7d (src
));
1616 priv
->comment
= TRUE
;
1620 OUTS (outf
, dregs (dst
));
1621 OUTS (outf
, " >>>= ");
1622 OUTS (outf
, uimm5 (src
));
1626 OUTS (outf
, dregs (dst
));
1627 OUTS (outf
, " >>= ");
1628 OUTS (outf
, uimm5 (src
));
1632 OUTS (outf
, dregs (dst
));
1633 OUTS (outf
, " <<= ");
1634 OUTS (outf
, uimm5 (src
));
1643 decode_COMP3op_0 (TIword iw0
, disassemble_info
*outf
)
1646 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1647 | 0 | 1 | 0 | 1 |.opc.......|.dst.......|.src1......|.src0......|
1648 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1649 int opc
= ((iw0
>> COMP3op_opc_bits
) & COMP3op_opc_mask
);
1650 int dst
= ((iw0
>> COMP3op_dst_bits
) & COMP3op_dst_mask
);
1651 int src0
= ((iw0
>> COMP3op_src0_bits
) & COMP3op_src0_mask
);
1652 int src1
= ((iw0
>> COMP3op_src1_bits
) & COMP3op_src1_mask
);
1654 if (opc
== 5 && src1
== src0
)
1656 OUTS (outf
, pregs (dst
));
1658 OUTS (outf
, pregs (src0
));
1659 OUTS (outf
, " << 0x1");
1663 OUTS (outf
, dregs (dst
));
1665 OUTS (outf
, dregs (src0
));
1667 OUTS (outf
, dregs (src1
));
1671 OUTS (outf
, dregs (dst
));
1673 OUTS (outf
, dregs (src0
));
1675 OUTS (outf
, dregs (src1
));
1679 OUTS (outf
, dregs (dst
));
1681 OUTS (outf
, dregs (src0
));
1683 OUTS (outf
, dregs (src1
));
1687 OUTS (outf
, dregs (dst
));
1689 OUTS (outf
, dregs (src0
));
1691 OUTS (outf
, dregs (src1
));
1695 OUTS (outf
, pregs (dst
));
1697 OUTS (outf
, pregs (src0
));
1699 OUTS (outf
, pregs (src1
));
1703 OUTS (outf
, pregs (dst
));
1705 OUTS (outf
, pregs (src0
));
1706 OUTS (outf
, " + (");
1707 OUTS (outf
, pregs (src1
));
1708 OUTS (outf
, " << 0x1)");
1712 OUTS (outf
, pregs (dst
));
1714 OUTS (outf
, pregs (src0
));
1715 OUTS (outf
, " + (");
1716 OUTS (outf
, pregs (src1
));
1717 OUTS (outf
, " << 0x2)");
1721 OUTS (outf
, dregs (dst
));
1723 OUTS (outf
, dregs (src0
));
1725 OUTS (outf
, dregs (src1
));
1734 decode_COMPI2opD_0 (TIword iw0
, disassemble_info
*outf
)
1736 struct private *priv
= outf
->private_data
;
1738 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1739 | 0 | 1 | 1 | 0 | 0 |.op|..src......................|.dst.......|
1740 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1741 int op
= ((iw0
>> COMPI2opD_op_bits
) & COMPI2opD_op_mask
);
1742 int dst
= ((iw0
>> COMPI2opD_dst_bits
) & COMPI2opD_dst_mask
);
1743 int src
= ((iw0
>> COMPI2opD_src_bits
) & COMPI2opD_src_mask
);
1745 bu32
*pval
= get_allreg (0, dst
);
1750 /* Since we don't have 32-bit immediate loads, we allow the disassembler
1751 to combine them, so it prints out the right values.
1752 Here we keep track of the registers. */
1755 *pval
= imm7_val (src
);
1757 *pval
|= 0xFFFFFF80;
1764 OUTS (outf
, dregs (dst
));
1766 OUTS (outf
, imm7 (src
));
1767 OUTS (outf
, " (X);\t\t/*\t\t");
1768 OUTS (outf
, dregs (dst
));
1770 OUTS (outf
, uimm32 (*pval
));
1772 OUTS (outf
, imm32 (*pval
));
1773 OUTS (outf
, ") */");
1774 priv
->comment
= TRUE
;
1778 OUTS (outf
, dregs (dst
));
1779 OUTS (outf
, " += ");
1780 OUTS (outf
, imm7 (src
));
1781 OUTS (outf
, ";\t\t/* (");
1782 OUTS (outf
, imm7d (src
));
1783 OUTS (outf
, ") */");
1784 priv
->comment
= TRUE
;
1793 decode_COMPI2opP_0 (TIword iw0
, disassemble_info
*outf
)
1795 struct private *priv
= outf
->private_data
;
1797 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1798 | 0 | 1 | 1 | 0 | 1 |.op|.src.......................|.dst.......|
1799 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1800 int op
= ((iw0
>> COMPI2opP_op_bits
) & COMPI2opP_op_mask
);
1801 int src
= ((iw0
>> COMPI2opP_src_bits
) & COMPI2opP_src_mask
);
1802 int dst
= ((iw0
>> COMPI2opP_dst_bits
) & COMPI2opP_dst_mask
);
1804 bu32
*pval
= get_allreg (1, dst
);
1811 *pval
= imm7_val (src
);
1813 *pval
|= 0xFFFFFF80;
1820 OUTS (outf
, pregs (dst
));
1822 OUTS (outf
, imm7 (src
));
1823 OUTS (outf
, " (X);\t\t/*\t\t");
1824 OUTS (outf
, pregs (dst
));
1826 OUTS (outf
, uimm32 (*pval
));
1828 OUTS (outf
, imm32 (*pval
));
1829 OUTS (outf
, ") */");
1830 priv
->comment
= TRUE
;
1834 OUTS (outf
, pregs (dst
));
1835 OUTS (outf
, " += ");
1836 OUTS (outf
, imm7 (src
));
1837 OUTS (outf
, ";\t\t/* (");
1838 OUTS (outf
, imm7d (src
));
1839 OUTS (outf
, ") */");
1840 priv
->comment
= TRUE
;
1849 decode_LDSTpmod_0 (TIword iw0
, disassemble_info
*outf
)
1852 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1853 | 1 | 0 | 0 | 0 |.W.|.aop...|.reg.......|.idx.......|.ptr.......|
1854 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1855 int W
= ((iw0
>> LDSTpmod_W_bits
) & LDSTpmod_W_mask
);
1856 int aop
= ((iw0
>> LDSTpmod_aop_bits
) & LDSTpmod_aop_mask
);
1857 int idx
= ((iw0
>> LDSTpmod_idx_bits
) & LDSTpmod_idx_mask
);
1858 int ptr
= ((iw0
>> LDSTpmod_ptr_bits
) & LDSTpmod_ptr_mask
);
1859 int reg
= ((iw0
>> LDSTpmod_reg_bits
) & LDSTpmod_reg_mask
);
1861 if (aop
== 1 && W
== 0 && idx
== ptr
)
1863 OUTS (outf
, dregs_lo (reg
));
1864 OUTS (outf
, " = W[");
1865 OUTS (outf
, pregs (ptr
));
1868 else if (aop
== 2 && W
== 0 && idx
== ptr
)
1870 OUTS (outf
, dregs_hi (reg
));
1871 OUTS (outf
, " = W[");
1872 OUTS (outf
, pregs (ptr
));
1875 else if (aop
== 1 && W
== 1 && idx
== ptr
)
1878 OUTS (outf
, pregs (ptr
));
1879 OUTS (outf
, "] = ");
1880 OUTS (outf
, dregs_lo (reg
));
1882 else if (aop
== 2 && W
== 1 && idx
== ptr
)
1885 OUTS (outf
, pregs (ptr
));
1886 OUTS (outf
, "] = ");
1887 OUTS (outf
, dregs_hi (reg
));
1889 else if (aop
== 0 && W
== 0)
1891 OUTS (outf
, dregs (reg
));
1892 OUTS (outf
, " = [");
1893 OUTS (outf
, pregs (ptr
));
1894 OUTS (outf
, " ++ ");
1895 OUTS (outf
, pregs (idx
));
1898 else if (aop
== 1 && W
== 0)
1900 OUTS (outf
, dregs_lo (reg
));
1901 OUTS (outf
, " = W[");
1902 OUTS (outf
, pregs (ptr
));
1903 OUTS (outf
, " ++ ");
1904 OUTS (outf
, pregs (idx
));
1907 else if (aop
== 2 && W
== 0)
1909 OUTS (outf
, dregs_hi (reg
));
1910 OUTS (outf
, " = W[");
1911 OUTS (outf
, pregs (ptr
));
1912 OUTS (outf
, " ++ ");
1913 OUTS (outf
, pregs (idx
));
1916 else if (aop
== 3 && W
== 0)
1918 OUTS (outf
, dregs (reg
));
1919 OUTS (outf
, " = W[");
1920 OUTS (outf
, pregs (ptr
));
1921 OUTS (outf
, " ++ ");
1922 OUTS (outf
, pregs (idx
));
1923 OUTS (outf
, "] (Z)");
1925 else if (aop
== 3 && W
== 1)
1927 OUTS (outf
, dregs (reg
));
1928 OUTS (outf
, " = W[");
1929 OUTS (outf
, pregs (ptr
));
1930 OUTS (outf
, " ++ ");
1931 OUTS (outf
, pregs (idx
));
1932 OUTS (outf
, "] (X)");
1934 else if (aop
== 0 && W
== 1)
1937 OUTS (outf
, pregs (ptr
));
1938 OUTS (outf
, " ++ ");
1939 OUTS (outf
, pregs (idx
));
1940 OUTS (outf
, "] = ");
1941 OUTS (outf
, dregs (reg
));
1943 else if (aop
== 1 && W
== 1)
1946 OUTS (outf
, pregs (ptr
));
1947 OUTS (outf
, " ++ ");
1948 OUTS (outf
, pregs (idx
));
1949 OUTS (outf
, "] = ");
1950 OUTS (outf
, dregs_lo (reg
));
1952 else if (aop
== 2 && W
== 1)
1955 OUTS (outf
, pregs (ptr
));
1956 OUTS (outf
, " ++ ");
1957 OUTS (outf
, pregs (idx
));
1958 OUTS (outf
, "] = ");
1959 OUTS (outf
, dregs_hi (reg
));
1968 decode_dagMODim_0 (TIword iw0
, disassemble_info
*outf
)
1971 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1972 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 0 |.br| 1 | 1 |.op|.m.....|.i.....|
1973 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1974 int i
= ((iw0
>> DagMODim_i_bits
) & DagMODim_i_mask
);
1975 int m
= ((iw0
>> DagMODim_m_bits
) & DagMODim_m_mask
);
1976 int br
= ((iw0
>> DagMODim_br_bits
) & DagMODim_br_mask
);
1977 int op
= ((iw0
>> DagMODim_op_bits
) & DagMODim_op_mask
);
1979 if (op
== 0 && br
== 1)
1981 OUTS (outf
, iregs (i
));
1982 OUTS (outf
, " += ");
1983 OUTS (outf
, mregs (m
));
1984 OUTS (outf
, " (BREV)");
1988 OUTS (outf
, iregs (i
));
1989 OUTS (outf
, " += ");
1990 OUTS (outf
, mregs (m
));
1992 else if (op
== 1 && br
== 0)
1994 OUTS (outf
, iregs (i
));
1995 OUTS (outf
, " -= ");
1996 OUTS (outf
, mregs (m
));
2005 decode_dagMODik_0 (TIword iw0
, disassemble_info
*outf
)
2007 struct private *priv
= outf
->private_data
;
2009 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2010 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 0 |.op....|.i.....|
2011 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2012 int i
= ((iw0
>> DagMODik_i_bits
) & DagMODik_i_mask
);
2013 int op
= ((iw0
>> DagMODik_op_bits
) & DagMODik_op_mask
);
2017 OUTS (outf
, iregs (i
));
2018 OUTS (outf
, " += 0x2");
2022 OUTS (outf
, iregs (i
));
2023 OUTS (outf
, " -= 0x2");
2027 OUTS (outf
, iregs (i
));
2028 OUTS (outf
, " += 0x4");
2032 OUTS (outf
, iregs (i
));
2033 OUTS (outf
, " -= 0x4");
2038 if (!priv
->parallel
)
2040 OUTS (outf
, ";\t\t/* ( ");
2041 if (op
== 0 || op
== 1)
2043 else if (op
== 2 || op
== 3)
2045 OUTS (outf
, ") */");
2046 priv
->comment
= TRUE
;
2053 decode_dspLDST_0 (TIword iw0
, disassemble_info
*outf
)
2056 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2057 | 1 | 0 | 0 | 1 | 1 | 1 |.W.|.aop...|.m.....|.i.....|.reg.......|
2058 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2059 int i
= ((iw0
>> DspLDST_i_bits
) & DspLDST_i_mask
);
2060 int m
= ((iw0
>> DspLDST_m_bits
) & DspLDST_m_mask
);
2061 int W
= ((iw0
>> DspLDST_W_bits
) & DspLDST_W_mask
);
2062 int aop
= ((iw0
>> DspLDST_aop_bits
) & DspLDST_aop_mask
);
2063 int reg
= ((iw0
>> DspLDST_reg_bits
) & DspLDST_reg_mask
);
2065 if (aop
== 0 && W
== 0 && m
== 0)
2067 OUTS (outf
, dregs (reg
));
2068 OUTS (outf
, " = [");
2069 OUTS (outf
, iregs (i
));
2072 else if (aop
== 0 && W
== 0 && m
== 1)
2074 OUTS (outf
, dregs_lo (reg
));
2075 OUTS (outf
, " = W[");
2076 OUTS (outf
, iregs (i
));
2079 else if (aop
== 0 && W
== 0 && m
== 2)
2081 OUTS (outf
, dregs_hi (reg
));
2082 OUTS (outf
, " = W[");
2083 OUTS (outf
, iregs (i
));
2086 else if (aop
== 1 && W
== 0 && m
== 0)
2088 OUTS (outf
, dregs (reg
));
2089 OUTS (outf
, " = [");
2090 OUTS (outf
, iregs (i
));
2093 else if (aop
== 1 && W
== 0 && m
== 1)
2095 OUTS (outf
, dregs_lo (reg
));
2096 OUTS (outf
, " = W[");
2097 OUTS (outf
, iregs (i
));
2100 else if (aop
== 1 && W
== 0 && m
== 2)
2102 OUTS (outf
, dregs_hi (reg
));
2103 OUTS (outf
, " = W[");
2104 OUTS (outf
, iregs (i
));
2107 else if (aop
== 2 && W
== 0 && m
== 0)
2109 OUTS (outf
, dregs (reg
));
2110 OUTS (outf
, " = [");
2111 OUTS (outf
, iregs (i
));
2114 else if (aop
== 2 && W
== 0 && m
== 1)
2116 OUTS (outf
, dregs_lo (reg
));
2117 OUTS (outf
, " = W[");
2118 OUTS (outf
, iregs (i
));
2121 else if (aop
== 2 && W
== 0 && m
== 2)
2123 OUTS (outf
, dregs_hi (reg
));
2124 OUTS (outf
, " = W[");
2125 OUTS (outf
, iregs (i
));
2128 else if (aop
== 0 && W
== 1 && m
== 0)
2131 OUTS (outf
, iregs (i
));
2132 OUTS (outf
, "++] = ");
2133 OUTS (outf
, dregs (reg
));
2135 else if (aop
== 0 && W
== 1 && m
== 1)
2138 OUTS (outf
, iregs (i
));
2139 OUTS (outf
, "++] = ");
2140 OUTS (outf
, dregs_lo (reg
));
2142 else if (aop
== 0 && W
== 1 && m
== 2)
2145 OUTS (outf
, iregs (i
));
2146 OUTS (outf
, "++] = ");
2147 OUTS (outf
, dregs_hi (reg
));
2149 else if (aop
== 1 && W
== 1 && m
== 0)
2152 OUTS (outf
, iregs (i
));
2153 OUTS (outf
, "--] = ");
2154 OUTS (outf
, dregs (reg
));
2156 else if (aop
== 1 && W
== 1 && m
== 1)
2159 OUTS (outf
, iregs (i
));
2160 OUTS (outf
, "--] = ");
2161 OUTS (outf
, dregs_lo (reg
));
2163 else if (aop
== 1 && W
== 1 && m
== 2)
2166 OUTS (outf
, iregs (i
));
2167 OUTS (outf
, "--] = ");
2168 OUTS (outf
, dregs_hi (reg
));
2170 else if (aop
== 2 && W
== 1 && m
== 0)
2173 OUTS (outf
, iregs (i
));
2174 OUTS (outf
, "] = ");
2175 OUTS (outf
, dregs (reg
));
2177 else if (aop
== 2 && W
== 1 && m
== 1)
2180 OUTS (outf
, iregs (i
));
2181 OUTS (outf
, "] = ");
2182 OUTS (outf
, dregs_lo (reg
));
2184 else if (aop
== 2 && W
== 1 && m
== 2)
2187 OUTS (outf
, iregs (i
));
2188 OUTS (outf
, "] = ");
2189 OUTS (outf
, dregs_hi (reg
));
2191 else if (aop
== 3 && W
== 0)
2193 OUTS (outf
, dregs (reg
));
2194 OUTS (outf
, " = [");
2195 OUTS (outf
, iregs (i
));
2196 OUTS (outf
, " ++ ");
2197 OUTS (outf
, mregs (m
));
2200 else if (aop
== 3 && W
== 1)
2203 OUTS (outf
, iregs (i
));
2204 OUTS (outf
, " ++ ");
2205 OUTS (outf
, mregs (m
));
2206 OUTS (outf
, "] = ");
2207 OUTS (outf
, dregs (reg
));
2216 decode_LDST_0 (TIword iw0
, disassemble_info
*outf
)
2219 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2220 | 1 | 0 | 0 | 1 |.sz....|.W.|.aop...|.Z.|.ptr.......|.reg.......|
2221 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2222 int Z
= ((iw0
>> LDST_Z_bits
) & LDST_Z_mask
);
2223 int W
= ((iw0
>> LDST_W_bits
) & LDST_W_mask
);
2224 int sz
= ((iw0
>> LDST_sz_bits
) & LDST_sz_mask
);
2225 int aop
= ((iw0
>> LDST_aop_bits
) & LDST_aop_mask
);
2226 int reg
= ((iw0
>> LDST_reg_bits
) & LDST_reg_mask
);
2227 int ptr
= ((iw0
>> LDST_ptr_bits
) & LDST_ptr_mask
);
2229 if (aop
== 0 && sz
== 0 && Z
== 0 && W
== 0)
2231 OUTS (outf
, dregs (reg
));
2232 OUTS (outf
, " = [");
2233 OUTS (outf
, pregs (ptr
));
2236 else if (aop
== 0 && sz
== 0 && Z
== 1 && W
== 0 && reg
!= ptr
)
2238 OUTS (outf
, pregs (reg
));
2239 OUTS (outf
, " = [");
2240 OUTS (outf
, pregs (ptr
));
2243 else if (aop
== 0 && sz
== 1 && Z
== 0 && W
== 0)
2245 OUTS (outf
, dregs (reg
));
2246 OUTS (outf
, " = W[");
2247 OUTS (outf
, pregs (ptr
));
2248 OUTS (outf
, "++] (Z)");
2250 else if (aop
== 0 && sz
== 1 && Z
== 1 && W
== 0)
2252 OUTS (outf
, dregs (reg
));
2253 OUTS (outf
, " = W[");
2254 OUTS (outf
, pregs (ptr
));
2255 OUTS (outf
, "++] (X)");
2257 else if (aop
== 0 && sz
== 2 && Z
== 0 && W
== 0)
2259 OUTS (outf
, dregs (reg
));
2260 OUTS (outf
, " = B[");
2261 OUTS (outf
, pregs (ptr
));
2262 OUTS (outf
, "++] (Z)");
2264 else if (aop
== 0 && sz
== 2 && Z
== 1 && W
== 0)
2266 OUTS (outf
, dregs (reg
));
2267 OUTS (outf
, " = B[");
2268 OUTS (outf
, pregs (ptr
));
2269 OUTS (outf
, "++] (X)");
2271 else if (aop
== 1 && sz
== 0 && Z
== 0 && W
== 0)
2273 OUTS (outf
, dregs (reg
));
2274 OUTS (outf
, " = [");
2275 OUTS (outf
, pregs (ptr
));
2278 else if (aop
== 1 && sz
== 0 && Z
== 1 && W
== 0 && reg
!= ptr
)
2280 OUTS (outf
, pregs (reg
));
2281 OUTS (outf
, " = [");
2282 OUTS (outf
, pregs (ptr
));
2285 else if (aop
== 1 && sz
== 1 && Z
== 0 && W
== 0)
2287 OUTS (outf
, dregs (reg
));
2288 OUTS (outf
, " = W[");
2289 OUTS (outf
, pregs (ptr
));
2290 OUTS (outf
, "--] (Z)");
2292 else if (aop
== 1 && sz
== 1 && Z
== 1 && W
== 0)
2294 OUTS (outf
, dregs (reg
));
2295 OUTS (outf
, " = W[");
2296 OUTS (outf
, pregs (ptr
));
2297 OUTS (outf
, "--] (X)");
2299 else if (aop
== 1 && sz
== 2 && Z
== 0 && W
== 0)
2301 OUTS (outf
, dregs (reg
));
2302 OUTS (outf
, " = B[");
2303 OUTS (outf
, pregs (ptr
));
2304 OUTS (outf
, "--] (Z)");
2306 else if (aop
== 1 && sz
== 2 && Z
== 1 && W
== 0)
2308 OUTS (outf
, dregs (reg
));
2309 OUTS (outf
, " = B[");
2310 OUTS (outf
, pregs (ptr
));
2311 OUTS (outf
, "--] (X)");
2313 else if (aop
== 2 && sz
== 0 && Z
== 0 && W
== 0)
2315 OUTS (outf
, dregs (reg
));
2316 OUTS (outf
, " = [");
2317 OUTS (outf
, pregs (ptr
));
2320 else if (aop
== 2 && sz
== 0 && Z
== 1 && W
== 0)
2322 OUTS (outf
, pregs (reg
));
2323 OUTS (outf
, " = [");
2324 OUTS (outf
, pregs (ptr
));
2327 else if (aop
== 2 && sz
== 1 && Z
== 0 && W
== 0)
2329 OUTS (outf
, dregs (reg
));
2330 OUTS (outf
, " = W[");
2331 OUTS (outf
, pregs (ptr
));
2332 OUTS (outf
, "] (Z)");
2334 else if (aop
== 2 && sz
== 1 && Z
== 1 && W
== 0)
2336 OUTS (outf
, dregs (reg
));
2337 OUTS (outf
, " = W[");
2338 OUTS (outf
, pregs (ptr
));
2339 OUTS (outf
, "] (X)");
2341 else if (aop
== 2 && sz
== 2 && Z
== 0 && W
== 0)
2343 OUTS (outf
, dregs (reg
));
2344 OUTS (outf
, " = B[");
2345 OUTS (outf
, pregs (ptr
));
2346 OUTS (outf
, "] (Z)");
2348 else if (aop
== 2 && sz
== 2 && Z
== 1 && W
== 0)
2350 OUTS (outf
, dregs (reg
));
2351 OUTS (outf
, " = B[");
2352 OUTS (outf
, pregs (ptr
));
2353 OUTS (outf
, "] (X)");
2355 else if (aop
== 0 && sz
== 0 && Z
== 0 && W
== 1)
2358 OUTS (outf
, pregs (ptr
));
2359 OUTS (outf
, "++] = ");
2360 OUTS (outf
, dregs (reg
));
2362 else if (aop
== 0 && sz
== 0 && Z
== 1 && W
== 1)
2365 OUTS (outf
, pregs (ptr
));
2366 OUTS (outf
, "++] = ");
2367 OUTS (outf
, pregs (reg
));
2369 else if (aop
== 0 && sz
== 1 && Z
== 0 && W
== 1)
2372 OUTS (outf
, pregs (ptr
));
2373 OUTS (outf
, "++] = ");
2374 OUTS (outf
, dregs (reg
));
2376 else if (aop
== 0 && sz
== 2 && Z
== 0 && W
== 1)
2379 OUTS (outf
, pregs (ptr
));
2380 OUTS (outf
, "++] = ");
2381 OUTS (outf
, dregs (reg
));
2383 else if (aop
== 1 && sz
== 0 && Z
== 0 && W
== 1)
2386 OUTS (outf
, pregs (ptr
));
2387 OUTS (outf
, "--] = ");
2388 OUTS (outf
, dregs (reg
));
2390 else if (aop
== 1 && sz
== 0 && Z
== 1 && W
== 1)
2393 OUTS (outf
, pregs (ptr
));
2394 OUTS (outf
, "--] = ");
2395 OUTS (outf
, pregs (reg
));
2397 else if (aop
== 1 && sz
== 1 && Z
== 0 && W
== 1)
2400 OUTS (outf
, pregs (ptr
));
2401 OUTS (outf
, "--] = ");
2402 OUTS (outf
, dregs (reg
));
2404 else if (aop
== 1 && sz
== 2 && Z
== 0 && W
== 1)
2407 OUTS (outf
, pregs (ptr
));
2408 OUTS (outf
, "--] = ");
2409 OUTS (outf
, dregs (reg
));
2411 else if (aop
== 2 && sz
== 0 && Z
== 0 && W
== 1)
2414 OUTS (outf
, pregs (ptr
));
2415 OUTS (outf
, "] = ");
2416 OUTS (outf
, dregs (reg
));
2418 else if (aop
== 2 && sz
== 0 && Z
== 1 && W
== 1)
2421 OUTS (outf
, pregs (ptr
));
2422 OUTS (outf
, "] = ");
2423 OUTS (outf
, pregs (reg
));
2425 else if (aop
== 2 && sz
== 1 && Z
== 0 && W
== 1)
2428 OUTS (outf
, pregs (ptr
));
2429 OUTS (outf
, "] = ");
2430 OUTS (outf
, dregs (reg
));
2432 else if (aop
== 2 && sz
== 2 && Z
== 0 && W
== 1)
2435 OUTS (outf
, pregs (ptr
));
2436 OUTS (outf
, "] = ");
2437 OUTS (outf
, dregs (reg
));
2446 decode_LDSTiiFP_0 (TIword iw0
, disassemble_info
*outf
)
2449 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2450 | 1 | 0 | 1 | 1 | 1 | 0 |.W.|.offset............|.reg...........|
2451 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2452 int reg
= ((iw0
>> LDSTiiFP_reg_bits
) & LDSTiiFP_reg_mask
);
2453 int offset
= ((iw0
>> LDSTiiFP_offset_bits
) & LDSTiiFP_offset_mask
);
2454 int W
= ((iw0
>> LDSTiiFP_W_bits
) & LDSTiiFP_W_mask
);
2458 OUTS (outf
, dpregs (reg
));
2459 OUTS (outf
, " = [FP ");
2460 OUTS (outf
, negimm5s4 (offset
));
2465 OUTS (outf
, "[FP ");
2466 OUTS (outf
, negimm5s4 (offset
));
2467 OUTS (outf
, "] = ");
2468 OUTS (outf
, dpregs (reg
));
2477 decode_LDSTii_0 (TIword iw0
, disassemble_info
*outf
)
2480 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2481 | 1 | 0 | 1 |.W.|.op....|.offset........|.ptr.......|.reg.......|
2482 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2483 int reg
= ((iw0
>> LDSTii_reg_bit
) & LDSTii_reg_mask
);
2484 int ptr
= ((iw0
>> LDSTii_ptr_bit
) & LDSTii_ptr_mask
);
2485 int offset
= ((iw0
>> LDSTii_offset_bit
) & LDSTii_offset_mask
);
2486 int op
= ((iw0
>> LDSTii_op_bit
) & LDSTii_op_mask
);
2487 int W
= ((iw0
>> LDSTii_W_bit
) & LDSTii_W_mask
);
2489 if (W
== 0 && op
== 0)
2491 OUTS (outf
, dregs (reg
));
2492 OUTS (outf
, " = [");
2493 OUTS (outf
, pregs (ptr
));
2495 OUTS (outf
, uimm4s4 (offset
));
2498 else if (W
== 0 && op
== 1)
2500 OUTS (outf
, dregs (reg
));
2501 OUTS (outf
, " = W[");
2502 OUTS (outf
, pregs (ptr
));
2504 OUTS (outf
, uimm4s2 (offset
));
2505 OUTS (outf
, "] (Z)");
2507 else if (W
== 0 && op
== 2)
2509 OUTS (outf
, dregs (reg
));
2510 OUTS (outf
, " = W[");
2511 OUTS (outf
, pregs (ptr
));
2513 OUTS (outf
, uimm4s2 (offset
));
2514 OUTS (outf
, "] (X)");
2516 else if (W
== 0 && op
== 3)
2518 OUTS (outf
, pregs (reg
));
2519 OUTS (outf
, " = [");
2520 OUTS (outf
, pregs (ptr
));
2522 OUTS (outf
, uimm4s4 (offset
));
2525 else if (W
== 1 && op
== 0)
2528 OUTS (outf
, pregs (ptr
));
2530 OUTS (outf
, uimm4s4 (offset
));
2531 OUTS (outf
, "] = ");
2532 OUTS (outf
, dregs (reg
));
2534 else if (W
== 1 && op
== 1)
2537 OUTS (outf
, pregs (ptr
));
2539 OUTS (outf
, uimm4s2 (offset
));
2540 OUTS (outf
, "] = ");
2541 OUTS (outf
, dregs (reg
));
2543 else if (W
== 1 && op
== 3)
2546 OUTS (outf
, pregs (ptr
));
2548 OUTS (outf
, uimm4s4 (offset
));
2549 OUTS (outf
, "] = ");
2550 OUTS (outf
, pregs (reg
));
2559 decode_LoopSetup_0 (TIword iw0
, TIword iw1
, bfd_vma pc
, disassemble_info
*outf
)
2561 struct private *priv
= outf
->private_data
;
2563 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2564 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 |.rop...|.c.|.soffset.......|
2565 |.reg...........| - | - |.eoffset...............................|
2566 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2567 int c
= ((iw0
>> (LoopSetup_c_bits
- 16)) & LoopSetup_c_mask
);
2568 int reg
= ((iw1
>> LoopSetup_reg_bits
) & LoopSetup_reg_mask
);
2569 int rop
= ((iw0
>> (LoopSetup_rop_bits
- 16)) & LoopSetup_rop_mask
);
2570 int soffset
= ((iw0
>> (LoopSetup_soffset_bits
- 16)) & LoopSetup_soffset_mask
);
2571 int eoffset
= ((iw1
>> LoopSetup_eoffset_bits
) & LoopSetup_eoffset_mask
);
2581 OUTS (outf
, "LSETUP");
2583 OUTS (outf
, pcrel4 (soffset
));
2584 OUTS (outf
, ", 0x");
2585 OUTS (outf
, lppcrel10 (eoffset
));
2587 OUTS (outf
, counters (c
));
2591 OUTS (outf
, "LSETUP");
2593 OUTS (outf
, pcrel4 (soffset
));
2594 OUTS (outf
, ", 0x");
2595 OUTS (outf
, lppcrel10 (eoffset
));
2597 OUTS (outf
, counters (c
));
2599 OUTS (outf
, pregs (reg
));
2603 OUTS (outf
, "LSETUP");
2605 OUTS (outf
, pcrel4 (soffset
));
2606 OUTS (outf
, ", 0x");
2607 OUTS (outf
, lppcrel10 (eoffset
));
2609 OUTS (outf
, counters (c
));
2611 OUTS (outf
, pregs (reg
));
2612 OUTS (outf
, " >> 0x1");
2621 decode_LDIMMhalf_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
2623 struct private *priv
= outf
->private_data
;
2625 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2626 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 1 |.Z.|.H.|.S.|.grp...|.reg.......|
2627 |.hword.........................................................|
2628 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2629 int H
= ((iw0
>> (LDIMMhalf_H_bits
- 16)) & LDIMMhalf_H_mask
);
2630 int Z
= ((iw0
>> (LDIMMhalf_Z_bits
- 16)) & LDIMMhalf_Z_mask
);
2631 int S
= ((iw0
>> (LDIMMhalf_S_bits
- 16)) & LDIMMhalf_S_mask
);
2632 int reg
= ((iw0
>> (LDIMMhalf_reg_bits
- 16)) & LDIMMhalf_reg_mask
);
2633 int grp
= ((iw0
>> (LDIMMhalf_grp_bits
- 16)) & LDIMMhalf_grp_mask
);
2634 int hword
= ((iw1
>> LDIMMhalf_hword_bits
) & LDIMMhalf_hword_mask
);
2636 bu32
*pval
= get_allreg (grp
, reg
);
2641 /* Since we don't have 32-bit immediate loads, we allow the disassembler
2642 to combine them, so it prints out the right values.
2643 Here we keep track of the registers. */
2644 if (H
== 0 && S
== 1 && Z
== 0)
2646 /* regs = imm16 (x) */
2647 *pval
= imm16_val (hword
);
2649 *pval
|= 0xFFFF0000;
2653 else if (H
== 0 && S
== 0 && Z
== 1)
2655 /* regs = luimm16 (Z) */
2656 *pval
= luimm16_val (hword
);
2659 else if (H
== 0 && S
== 0 && Z
== 0)
2661 /* regs_lo = luimm16 */
2662 *pval
&= 0xFFFF0000;
2663 *pval
|= luimm16_val (hword
);
2665 else if (H
== 1 && S
== 0 && Z
== 0)
2667 /* regs_hi = huimm16 */
2669 *pval
|= luimm16_val (hword
) << 16;
2672 /* Here we do the disassembly */
2673 if (grp
== 0 && H
== 0 && S
== 0 && Z
== 0)
2675 OUTS (outf
, dregs_lo (reg
));
2677 OUTS (outf
, uimm16 (hword
));
2679 else if (grp
== 0 && H
== 1 && S
== 0 && Z
== 0)
2681 OUTS (outf
, dregs_hi (reg
));
2683 OUTS (outf
, uimm16 (hword
));
2685 else if (grp
== 0 && H
== 0 && S
== 1 && Z
== 0)
2687 OUTS (outf
, dregs (reg
));
2689 OUTS (outf
, imm16 (hword
));
2690 OUTS (outf
, " (X)");
2692 else if (H
== 0 && S
== 1 && Z
== 0)
2694 OUTS (outf
, regs (reg
, grp
));
2696 OUTS (outf
, imm16 (hword
));
2697 OUTS (outf
, " (X)");
2699 else if (H
== 0 && S
== 0 && Z
== 1)
2701 OUTS (outf
, regs (reg
, grp
));
2703 OUTS (outf
, uimm16 (hword
));
2704 OUTS (outf
, " (Z)");
2706 else if (H
== 0 && S
== 0 && Z
== 0)
2708 OUTS (outf
, regs_lo (reg
, grp
));
2710 OUTS (outf
, uimm16 (hword
));
2712 else if (H
== 1 && S
== 0 && Z
== 0)
2714 OUTS (outf
, regs_hi (reg
, grp
));
2716 OUTS (outf
, uimm16 (hword
));
2721 /* And we print out the 32-bit value if it is a pointer. */
2722 if (S
== 0 && Z
== 0)
2724 OUTS (outf
, ";\t\t/* (");
2725 OUTS (outf
, imm16d (hword
));
2728 /* If it is an MMR, don't print the symbol. */
2729 if (*pval
< 0xFFC00000 && grp
== 1)
2731 OUTS (outf
, regs (reg
, grp
));
2733 OUTS (outf
, huimm32e (*pval
));
2737 OUTS (outf
, regs (reg
, grp
));
2739 OUTS (outf
, huimm32e (*pval
));
2741 OUTS (outf
, imm32 (*pval
));
2746 priv
->comment
= TRUE
;
2748 if (S
== 1 || Z
== 1)
2750 OUTS (outf
, ";\t\t/*\t\t");
2751 OUTS (outf
, regs (reg
, grp
));
2753 OUTS (outf
, huimm32e (*pval
));
2755 OUTS (outf
, imm32 (*pval
));
2756 OUTS (outf
, ") */");
2757 priv
->comment
= TRUE
;
2763 decode_CALLa_0 (TIword iw0
, TIword iw1
, bfd_vma pc
, disassemble_info
*outf
)
2765 struct private *priv
= outf
->private_data
;
2767 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2768 | 1 | 1 | 1 | 0 | 0 | 0 | 1 |.S.|.msw...........................|
2769 |.lsw...........................................................|
2770 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2771 int S
= ((iw0
>> (CALLa_S_bits
- 16)) & CALLa_S_mask
);
2772 int lsw
= ((iw1
>> 0) & 0xffff);
2773 int msw
= ((iw0
>> 0) & 0xff);
2779 OUTS (outf
, "CALL 0x");
2781 OUTS (outf
, "JUMP.L 0x");
2785 OUTS (outf
, pcrel24 (((msw
) << 16) | (lsw
)));
2790 decode_LDSTidxI_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
2793 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2794 | 1 | 1 | 1 | 0 | 0 | 1 |.W.|.Z.|.sz....|.ptr.......|.reg.......|
2795 |.offset........................................................|
2796 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2797 int Z
= ((iw0
>> (LDSTidxI_Z_bits
- 16)) & LDSTidxI_Z_mask
);
2798 int W
= ((iw0
>> (LDSTidxI_W_bits
- 16)) & LDSTidxI_W_mask
);
2799 int sz
= ((iw0
>> (LDSTidxI_sz_bits
- 16)) & LDSTidxI_sz_mask
);
2800 int reg
= ((iw0
>> (LDSTidxI_reg_bits
- 16)) & LDSTidxI_reg_mask
);
2801 int ptr
= ((iw0
>> (LDSTidxI_ptr_bits
- 16)) & LDSTidxI_ptr_mask
);
2802 int offset
= ((iw1
>> LDSTidxI_offset_bits
) & LDSTidxI_offset_mask
);
2804 if (W
== 0 && sz
== 0 && Z
== 0)
2806 OUTS (outf
, dregs (reg
));
2807 OUTS (outf
, " = [");
2808 OUTS (outf
, pregs (ptr
));
2810 OUTS (outf
, imm16s4 (offset
));
2813 else if (W
== 0 && sz
== 0 && Z
== 1)
2815 OUTS (outf
, pregs (reg
));
2816 OUTS (outf
, " = [");
2817 OUTS (outf
, pregs (ptr
));
2819 OUTS (outf
, imm16s4 (offset
));
2822 else if (W
== 0 && sz
== 1 && Z
== 0)
2824 OUTS (outf
, dregs (reg
));
2825 OUTS (outf
, " = W[");
2826 OUTS (outf
, pregs (ptr
));
2828 OUTS (outf
, imm16s2 (offset
));
2829 OUTS (outf
, "] (Z)");
2831 else if (W
== 0 && sz
== 1 && Z
== 1)
2833 OUTS (outf
, dregs (reg
));
2834 OUTS (outf
, " = W[");
2835 OUTS (outf
, pregs (ptr
));
2837 OUTS (outf
, imm16s2 (offset
));
2838 OUTS (outf
, "] (X)");
2840 else if (W
== 0 && sz
== 2 && Z
== 0)
2842 OUTS (outf
, dregs (reg
));
2843 OUTS (outf
, " = B[");
2844 OUTS (outf
, pregs (ptr
));
2846 OUTS (outf
, imm16 (offset
));
2847 OUTS (outf
, "] (Z)");
2849 else if (W
== 0 && sz
== 2 && Z
== 1)
2851 OUTS (outf
, dregs (reg
));
2852 OUTS (outf
, " = B[");
2853 OUTS (outf
, pregs (ptr
));
2855 OUTS (outf
, imm16 (offset
));
2856 OUTS (outf
, "] (X)");
2858 else if (W
== 1 && sz
== 0 && Z
== 0)
2861 OUTS (outf
, pregs (ptr
));
2863 OUTS (outf
, imm16s4 (offset
));
2864 OUTS (outf
, "] = ");
2865 OUTS (outf
, dregs (reg
));
2867 else if (W
== 1 && sz
== 0 && Z
== 1)
2870 OUTS (outf
, pregs (ptr
));
2872 OUTS (outf
, imm16s4 (offset
));
2873 OUTS (outf
, "] = ");
2874 OUTS (outf
, pregs (reg
));
2876 else if (W
== 1 && sz
== 1 && Z
== 0)
2879 OUTS (outf
, pregs (ptr
));
2881 OUTS (outf
, imm16s2 (offset
));
2882 OUTS (outf
, "] = ");
2883 OUTS (outf
, dregs (reg
));
2885 else if (W
== 1 && sz
== 2 && Z
== 0)
2888 OUTS (outf
, pregs (ptr
));
2890 OUTS (outf
, imm16 (offset
));
2891 OUTS (outf
, "] = ");
2892 OUTS (outf
, dregs (reg
));
2901 decode_linkage_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
2903 struct private *priv
= outf
->private_data
;
2905 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2906 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |.R.|
2907 |.framesize.....................................................|
2908 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2909 int R
= ((iw0
>> (Linkage_R_bits
- 16)) & Linkage_R_mask
);
2910 int framesize
= ((iw1
>> Linkage_framesize_bits
) & Linkage_framesize_mask
);
2917 OUTS (outf
, "LINK ");
2918 OUTS (outf
, uimm16s4 (framesize
));
2919 OUTS (outf
, ";\t\t/* (");
2920 OUTS (outf
, uimm16s4d (framesize
));
2921 OUTS (outf
, ") */");
2922 priv
->comment
= TRUE
;
2925 OUTS (outf
, "UNLINK");
2933 decode_dsp32mac_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
2936 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2937 | 1 | 1 | 0 | 0 |.M.| 0 | 0 |.mmod..........|.MM|.P.|.w1|.op1...|
2938 |.h01|.h11|.w0|.op0...|.h00|.h10|.dst.......|.src0......|.src1..|
2939 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2940 int op1
= ((iw0
>> (DSP32Mac_op1_bits
- 16)) & DSP32Mac_op1_mask
);
2941 int w1
= ((iw0
>> (DSP32Mac_w1_bits
- 16)) & DSP32Mac_w1_mask
);
2942 int P
= ((iw0
>> (DSP32Mac_p_bits
- 16)) & DSP32Mac_p_mask
);
2943 int MM
= ((iw0
>> (DSP32Mac_MM_bits
- 16)) & DSP32Mac_MM_mask
);
2944 int mmod
= ((iw0
>> (DSP32Mac_mmod_bits
- 16)) & DSP32Mac_mmod_mask
);
2945 int w0
= ((iw1
>> DSP32Mac_w0_bits
) & DSP32Mac_w0_mask
);
2946 int src0
= ((iw1
>> DSP32Mac_src0_bits
) & DSP32Mac_src0_mask
);
2947 int src1
= ((iw1
>> DSP32Mac_src1_bits
) & DSP32Mac_src1_mask
);
2948 int dst
= ((iw1
>> DSP32Mac_dst_bits
) & DSP32Mac_dst_mask
);
2949 int h10
= ((iw1
>> DSP32Mac_h10_bits
) & DSP32Mac_h10_mask
);
2950 int h00
= ((iw1
>> DSP32Mac_h00_bits
) & DSP32Mac_h00_mask
);
2951 int op0
= ((iw1
>> DSP32Mac_op0_bits
) & DSP32Mac_op0_mask
);
2952 int h11
= ((iw1
>> DSP32Mac_h11_bits
) & DSP32Mac_h11_mask
);
2953 int h01
= ((iw1
>> DSP32Mac_h01_bits
) & DSP32Mac_h01_mask
);
2955 if (w0
== 0 && w1
== 0 && op1
== 3 && op0
== 3)
2961 if ((w1
|| w0
) && mmod
== M_W32
)
2964 if (((1 << mmod
) & (P
? 0x131b : 0x1b5f)) == 0)
2967 if (w1
== 1 || op1
!= 3)
2970 OUTS (outf
, P
? dregs (dst
+ 1) : dregs_hi (dst
));
2973 OUTS (outf
, " = A1");
2977 OUTS (outf
, " = (");
2978 decode_macfunc (1, op1
, h01
, h11
, src0
, src1
, outf
);
2983 if (w0
== 1 || op0
!= 3)
2986 OUTS (outf
, " (M)");
2991 if (w0
== 1 || op0
!= 3)
2993 /* Clear MM option since it only matters for MAC1, and if we made
2994 it this far, we've already shown it or we want to ignore it. */
2998 OUTS (outf
, P
? dregs (dst
) : dregs_lo (dst
));
3001 OUTS (outf
, " = A0");
3005 OUTS (outf
, " = (");
3006 decode_macfunc (0, op0
, h00
, h10
, src0
, src1
, outf
);
3012 decode_optmode (mmod
, MM
, outf
);
3018 decode_dsp32mult_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
3021 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
3022 | 1 | 1 | 0 | 0 |.M.| 0 | 1 |.mmod..........|.MM|.P.|.w1|.op1...|
3023 |.h01|.h11|.w0|.op0...|.h00|.h10|.dst.......|.src0......|.src1..|
3024 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
3025 int w1
= ((iw0
>> (DSP32Mac_w1_bits
- 16)) & DSP32Mac_w1_mask
);
3026 int P
= ((iw0
>> (DSP32Mac_p_bits
- 16)) & DSP32Mac_p_mask
);
3027 int MM
= ((iw0
>> (DSP32Mac_MM_bits
- 16)) & DSP32Mac_MM_mask
);
3028 int mmod
= ((iw0
>> (DSP32Mac_mmod_bits
- 16)) & DSP32Mac_mmod_mask
);
3029 int w0
= ((iw1
>> DSP32Mac_w0_bits
) & DSP32Mac_w0_mask
);
3030 int src0
= ((iw1
>> DSP32Mac_src0_bits
) & DSP32Mac_src0_mask
);
3031 int src1
= ((iw1
>> DSP32Mac_src1_bits
) & DSP32Mac_src1_mask
);
3032 int dst
= ((iw1
>> DSP32Mac_dst_bits
) & DSP32Mac_dst_mask
);
3033 int h10
= ((iw1
>> DSP32Mac_h10_bits
) & DSP32Mac_h10_mask
);
3034 int h00
= ((iw1
>> DSP32Mac_h00_bits
) & DSP32Mac_h00_mask
);
3035 int h11
= ((iw1
>> DSP32Mac_h11_bits
) & DSP32Mac_h11_mask
);
3036 int h01
= ((iw1
>> DSP32Mac_h01_bits
) & DSP32Mac_h01_mask
);
3038 if (w1
== 0 && w0
== 0)
3041 if (((1 << mmod
) & (P
? 0x313 : 0x1b57)) == 0)
3046 OUTS (outf
, P
? dregs (dst
+ 1) : dregs_hi (dst
));
3048 decode_multfunc (h01
, h11
, src0
, src1
, outf
);
3053 OUTS (outf
, " (M)");
3061 OUTS (outf
, P
? dregs (dst
) : dregs_lo (dst
));
3063 decode_multfunc (h00
, h10
, src0
, src1
, outf
);
3066 decode_optmode (mmod
, MM
, outf
);
3071 decode_dsp32alu_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
3074 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
3075 | 1 | 1 | 0 | 0 |.M.| 1 | 0 | - | - | - |.HL|.aopcde............|
3076 |.aop...|.s.|.x.|.dst0......|.dst1......|.src0......|.src1......|
3077 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
3078 int s
= ((iw1
>> DSP32Alu_s_bits
) & DSP32Alu_s_mask
);
3079 int x
= ((iw1
>> DSP32Alu_x_bits
) & DSP32Alu_x_mask
);
3080 int aop
= ((iw1
>> DSP32Alu_aop_bits
) & DSP32Alu_aop_mask
);
3081 int src0
= ((iw1
>> DSP32Alu_src0_bits
) & DSP32Alu_src0_mask
);
3082 int src1
= ((iw1
>> DSP32Alu_src1_bits
) & DSP32Alu_src1_mask
);
3083 int dst0
= ((iw1
>> DSP32Alu_dst0_bits
) & DSP32Alu_dst0_mask
);
3084 int dst1
= ((iw1
>> DSP32Alu_dst1_bits
) & DSP32Alu_dst1_mask
);
3085 int HL
= ((iw0
>> (DSP32Alu_HL_bits
- 16)) & DSP32Alu_HL_mask
);
3086 int aopcde
= ((iw0
>> (DSP32Alu_aopcde_bits
- 16)) & DSP32Alu_aopcde_mask
);
3088 if (aop
== 0 && aopcde
== 9 && HL
== 0 && s
== 0)
3090 OUTS (outf
, "A0.L = ");
3091 OUTS (outf
, dregs_lo (src0
));
3093 else if (aop
== 2 && aopcde
== 9 && HL
== 1 && s
== 0)
3095 OUTS (outf
, "A1.H = ");
3096 OUTS (outf
, dregs_hi (src0
));
3098 else if (aop
== 2 && aopcde
== 9 && HL
== 0 && s
== 0)
3100 OUTS (outf
, "A1.L = ");
3101 OUTS (outf
, dregs_lo (src0
));
3103 else if (aop
== 0 && aopcde
== 9 && HL
== 1 && s
== 0)
3105 OUTS (outf
, "A0.H = ");
3106 OUTS (outf
, dregs_hi (src0
));
3108 else if (x
== 1 && HL
== 1 && aop
== 3 && aopcde
== 5)
3110 OUTS (outf
, dregs_hi (dst0
));
3112 OUTS (outf
, dregs (src0
));
3114 OUTS (outf
, dregs (src1
));
3115 OUTS (outf
, " (RND20)");
3117 else if (x
== 1 && HL
== 1 && aop
== 2 && aopcde
== 5)
3119 OUTS (outf
, dregs_hi (dst0
));
3121 OUTS (outf
, dregs (src0
));
3123 OUTS (outf
, dregs (src1
));
3124 OUTS (outf
, " (RND20)");
3126 else if (x
== 0 && HL
== 0 && aop
== 1 && aopcde
== 5)
3128 OUTS (outf
, dregs_lo (dst0
));
3130 OUTS (outf
, dregs (src0
));
3132 OUTS (outf
, dregs (src1
));
3133 OUTS (outf
, " (RND12)");
3135 else if (x
== 0 && HL
== 0 && aop
== 0 && aopcde
== 5)
3137 OUTS (outf
, dregs_lo (dst0
));
3139 OUTS (outf
, dregs (src0
));
3141 OUTS (outf
, dregs (src1
));
3142 OUTS (outf
, " (RND12)");
3144 else if (x
== 1 && HL
== 0 && aop
== 3 && aopcde
== 5)
3146 OUTS (outf
, dregs_lo (dst0
));
3148 OUTS (outf
, dregs (src0
));
3150 OUTS (outf
, dregs (src1
));
3151 OUTS (outf
, " (RND20)");
3153 else if (x
== 0 && HL
== 1 && aop
== 0 && aopcde
== 5)
3155 OUTS (outf
, dregs_hi (dst0
));
3157 OUTS (outf
, dregs (src0
));
3159 OUTS (outf
, dregs (src1
));
3160 OUTS (outf
, " (RND12)");
3162 else if (x
== 1 && HL
== 0 && aop
== 2 && aopcde
== 5)
3164 OUTS (outf
, dregs_lo (dst0
));
3166 OUTS (outf
, dregs (src0
));
3168 OUTS (outf
, dregs (src1
));
3169 OUTS (outf
, " (RND20)");
3171 else if (x
== 0 && HL
== 1 && aop
== 1 && aopcde
== 5)
3173 OUTS (outf
, dregs_hi (dst0
));
3175 OUTS (outf
, dregs (src0
));
3177 OUTS (outf
, dregs (src1
));
3178 OUTS (outf
, " (RND12)");
3180 else if (HL
== 1 && aop
== 0 && aopcde
== 2)
3182 OUTS (outf
, dregs_hi (dst0
));
3184 OUTS (outf
, dregs_lo (src0
));
3186 OUTS (outf
, dregs_lo (src1
));
3189 else if (HL
== 1 && aop
== 1 && aopcde
== 2)
3191 OUTS (outf
, dregs_hi (dst0
));
3193 OUTS (outf
, dregs_lo (src0
));
3195 OUTS (outf
, dregs_hi (src1
));
3198 else if (HL
== 1 && aop
== 2 && aopcde
== 2)
3200 OUTS (outf
, dregs_hi (dst0
));
3202 OUTS (outf
, dregs_hi (src0
));
3204 OUTS (outf
, dregs_lo (src1
));
3207 else if (HL
== 1 && aop
== 3 && aopcde
== 2)
3209 OUTS (outf
, dregs_hi (dst0
));
3211 OUTS (outf
, dregs_hi (src0
));
3213 OUTS (outf
, dregs_hi (src1
));
3216 else if (HL
== 0 && aop
== 0 && aopcde
== 3)
3218 OUTS (outf
, dregs_lo (dst0
));
3220 OUTS (outf
, dregs_lo (src0
));
3222 OUTS (outf
, dregs_lo (src1
));
3225 else if (HL
== 0 && aop
== 1 && aopcde
== 3)
3227 OUTS (outf
, dregs_lo (dst0
));
3229 OUTS (outf
, dregs_lo (src0
));
3231 OUTS (outf
, dregs_hi (src1
));
3234 else if (HL
== 0 && aop
== 3 && aopcde
== 2)
3236 OUTS (outf
, dregs_lo (dst0
));
3238 OUTS (outf
, dregs_hi (src0
));
3240 OUTS (outf
, dregs_hi (src1
));
3243 else if (HL
== 1 && aop
== 0 && aopcde
== 3)
3245 OUTS (outf
, dregs_hi (dst0
));
3247 OUTS (outf
, dregs_lo (src0
));
3249 OUTS (outf
, dregs_lo (src1
));
3252 else if (HL
== 1 && aop
== 1 && aopcde
== 3)
3254 OUTS (outf
, dregs_hi (dst0
));
3256 OUTS (outf
, dregs_lo (src0
));
3258 OUTS (outf
, dregs_hi (src1
));
3261 else if (HL
== 1 && aop
== 2 && aopcde
== 3)
3263 OUTS (outf
, dregs_hi (dst0
));
3265 OUTS (outf
, dregs_hi (src0
));
3267 OUTS (outf
, dregs_lo (src1
));
3270 else if (HL
== 1 && aop
== 3 && aopcde
== 3)
3272 OUTS (outf
, dregs_hi (dst0
));
3274 OUTS (outf
, dregs_hi (src0
));
3276 OUTS (outf
, dregs_hi (src1
));
3279 else if (HL
== 0 && aop
== 2 && aopcde
== 2)
3281 OUTS (outf
, dregs_lo (dst0
));
3283 OUTS (outf
, dregs_hi (src0
));
3285 OUTS (outf
, dregs_lo (src1
));
3288 else if (HL
== 0 && aop
== 1 && aopcde
== 2)
3290 OUTS (outf
, dregs_lo (dst0
));
3292 OUTS (outf
, dregs_lo (src0
));
3294 OUTS (outf
, dregs_hi (src1
));
3297 else if (HL
== 0 && aop
== 2 && aopcde
== 3)
3299 OUTS (outf
, dregs_lo (dst0
));
3301 OUTS (outf
, dregs_hi (src0
));
3303 OUTS (outf
, dregs_lo (src1
));
3306 else if (HL
== 0 && aop
== 3 && aopcde
== 3)
3308 OUTS (outf
, dregs_lo (dst0
));
3310 OUTS (outf
, dregs_hi (src0
));
3312 OUTS (outf
, dregs_hi (src1
));
3315 else if (HL
== 0 && aop
== 0 && aopcde
== 2)
3317 OUTS (outf
, dregs_lo (dst0
));
3319 OUTS (outf
, dregs_lo (src0
));
3321 OUTS (outf
, dregs_lo (src1
));
3324 else if (aop
== 0 && aopcde
== 9 && s
== 1)
3326 OUTS (outf
, "A0 = ");
3327 OUTS (outf
, dregs (src0
));
3329 else if (aop
== 3 && aopcde
== 11 && s
== 0)
3330 OUTS (outf
, "A0 -= A1");
3332 else if (aop
== 3 && aopcde
== 11 && s
== 1)
3333 OUTS (outf
, "A0 -= A1 (W32)");
3335 else if (aop
== 1 && aopcde
== 22 && HL
== 1)
3337 OUTS (outf
, dregs (dst0
));
3338 OUTS (outf
, " = BYTEOP2P (");
3339 OUTS (outf
, dregs (src0
+ 1));
3341 OUTS (outf
, imm5d (src0
));
3343 OUTS (outf
, dregs (src1
+ 1));
3345 OUTS (outf
, imm5d (src1
));
3346 OUTS (outf
, ") (TH");
3348 OUTS (outf
, ", R)");
3352 else if (aop
== 1 && aopcde
== 22 && HL
== 0)
3354 OUTS (outf
, dregs (dst0
));
3355 OUTS (outf
, " = BYTEOP2P (");
3356 OUTS (outf
, dregs (src0
+ 1));
3358 OUTS (outf
, imm5d (src0
));
3360 OUTS (outf
, dregs (src1
+ 1));
3362 OUTS (outf
, imm5d (src1
));
3363 OUTS (outf
, ") (TL");
3365 OUTS (outf
, ", R)");
3369 else if (aop
== 0 && aopcde
== 22 && HL
== 1)
3371 OUTS (outf
, dregs (dst0
));
3372 OUTS (outf
, " = BYTEOP2P (");
3373 OUTS (outf
, dregs (src0
+ 1));
3375 OUTS (outf
, imm5d (src0
));
3377 OUTS (outf
, dregs (src1
+ 1));
3379 OUTS (outf
, imm5d (src1
));
3380 OUTS (outf
, ") (RNDH");
3382 OUTS (outf
, ", R)");
3386 else if (aop
== 0 && aopcde
== 22 && HL
== 0)
3388 OUTS (outf
, dregs (dst0
));
3389 OUTS (outf
, " = BYTEOP2P (");
3390 OUTS (outf
, dregs (src0
+ 1));
3392 OUTS (outf
, imm5d (src0
));
3394 OUTS (outf
, dregs (src1
+ 1));
3396 OUTS (outf
, imm5d (src1
));
3397 OUTS (outf
, ") (RNDL");
3399 OUTS (outf
, ", R)");
3403 else if (aop
== 0 && s
== 0 && aopcde
== 8)
3404 OUTS (outf
, "A0 = 0");
3406 else if (aop
== 0 && s
== 1 && aopcde
== 8)
3407 OUTS (outf
, "A0 = A0 (S)");
3409 else if (aop
== 1 && s
== 0 && aopcde
== 8)
3410 OUTS (outf
, "A1 = 0");
3412 else if (aop
== 1 && s
== 1 && aopcde
== 8)
3413 OUTS (outf
, "A1 = A1 (S)");
3415 else if (aop
== 2 && s
== 0 && aopcde
== 8)
3416 OUTS (outf
, "A1 = A0 = 0");
3418 else if (aop
== 2 && s
== 1 && aopcde
== 8)
3419 OUTS (outf
, "A1 = A1 (S), A0 = A0 (S)");
3421 else if (aop
== 3 && s
== 0 && aopcde
== 8)
3422 OUTS (outf
, "A0 = A1");
3424 else if (aop
== 3 && s
== 1 && aopcde
== 8)
3425 OUTS (outf
, "A1 = A0");
3427 else if (aop
== 1 && aopcde
== 9 && s
== 0)
3429 OUTS (outf
, "A0.X = ");
3430 OUTS (outf
, dregs_lo (src0
));
3432 else if (aop
== 1 && HL
== 0 && aopcde
== 11)
3434 OUTS (outf
, dregs_lo (dst0
));
3435 OUTS (outf
, " = (A0 += A1)");
3437 else if (aop
== 3 && HL
== 0 && aopcde
== 16)
3438 OUTS (outf
, "A1 = ABS A1, A0 = ABS A0");
3440 else if (aop
== 0 && aopcde
== 23 && HL
== 1)
3442 OUTS (outf
, dregs (dst0
));
3443 OUTS (outf
, " = BYTEOP3P (");
3444 OUTS (outf
, dregs (src0
+ 1));
3446 OUTS (outf
, imm5d (src0
));
3448 OUTS (outf
, dregs (src1
+ 1));
3450 OUTS (outf
, imm5d (src1
));
3451 OUTS (outf
, ") (HI");
3453 OUTS (outf
, ", R)");
3457 else if (aop
== 3 && aopcde
== 9 && s
== 0)
3459 OUTS (outf
, "A1.X = ");
3460 OUTS (outf
, dregs_lo (src0
));
3462 else if (aop
== 1 && HL
== 1 && aopcde
== 16)
3463 OUTS (outf
, "A1 = ABS A1");
3465 else if (aop
== 0 && HL
== 1 && aopcde
== 16)
3466 OUTS (outf
, "A1 = ABS A0");
3468 else if (aop
== 2 && aopcde
== 9 && s
== 1)
3470 OUTS (outf
, "A1 = ");
3471 OUTS (outf
, dregs (src0
));
3473 else if (HL
== 0 && aop
== 3 && aopcde
== 12)
3475 OUTS (outf
, dregs_lo (dst0
));
3477 OUTS (outf
, dregs (src0
));
3478 OUTS (outf
, " (RND)");
3480 else if (aop
== 1 && HL
== 0 && aopcde
== 16)
3481 OUTS (outf
, "A0 = ABS A1");
3483 else if (aop
== 0 && HL
== 0 && aopcde
== 16)
3484 OUTS (outf
, "A0 = ABS A0");
3486 else if (aop
== 3 && HL
== 0 && aopcde
== 15)
3488 OUTS (outf
, dregs (dst0
));
3489 OUTS (outf
, " = -");
3490 OUTS (outf
, dregs (src0
));
3491 OUTS (outf
, " (V)");
3493 else if (aop
== 3 && s
== 1 && HL
== 0 && aopcde
== 7)
3495 OUTS (outf
, dregs (dst0
));
3496 OUTS (outf
, " = -");
3497 OUTS (outf
, dregs (src0
));
3498 OUTS (outf
, " (S)");
3500 else if (aop
== 3 && s
== 0 && HL
== 0 && aopcde
== 7)
3502 OUTS (outf
, dregs (dst0
));
3503 OUTS (outf
, " = -");
3504 OUTS (outf
, dregs (src0
));
3505 OUTS (outf
, " (NS)");
3507 else if (aop
== 1 && HL
== 1 && aopcde
== 11)
3509 OUTS (outf
, dregs_hi (dst0
));
3510 OUTS (outf
, " = (A0 += A1)");
3512 else if (aop
== 2 && aopcde
== 11 && s
== 0)
3513 OUTS (outf
, "A0 += A1");
3515 else if (aop
== 2 && aopcde
== 11 && s
== 1)
3516 OUTS (outf
, "A0 += A1 (W32)");
3518 else if (aop
== 3 && HL
== 0 && aopcde
== 14)
3519 OUTS (outf
, "A1 = -A1, A0 = -A0");
3521 else if (HL
== 1 && aop
== 3 && aopcde
== 12)
3523 OUTS (outf
, dregs_hi (dst0
));
3525 OUTS (outf
, dregs (src0
));
3526 OUTS (outf
, " (RND)");
3528 else if (aop
== 0 && aopcde
== 23 && HL
== 0)
3530 OUTS (outf
, dregs (dst0
));
3531 OUTS (outf
, " = BYTEOP3P (");
3532 OUTS (outf
, dregs (src0
+ 1));
3534 OUTS (outf
, imm5d (src0
));
3536 OUTS (outf
, dregs (src1
+ 1));
3538 OUTS (outf
, imm5d (src1
));
3539 OUTS (outf
, ") (LO");
3541 OUTS (outf
, ", R)");
3545 else if (aop
== 0 && HL
== 0 && aopcde
== 14)
3546 OUTS (outf
, "A0 = -A0");
3548 else if (aop
== 1 && HL
== 0 && aopcde
== 14)
3549 OUTS (outf
, "A0 = -A1");
3551 else if (aop
== 0 && HL
== 1 && aopcde
== 14)
3552 OUTS (outf
, "A1 = -A0");
3554 else if (aop
== 1 && HL
== 1 && aopcde
== 14)
3555 OUTS (outf
, "A1 = -A1");
3557 else if (aop
== 0 && aopcde
== 12)
3559 OUTS (outf
, dregs_hi (dst0
));
3561 OUTS (outf
, dregs_lo (dst0
));
3562 OUTS (outf
, " = SIGN (");
3563 OUTS (outf
, dregs_hi (src0
));
3564 OUTS (outf
, ") * ");
3565 OUTS (outf
, dregs_hi (src1
));
3566 OUTS (outf
, " + SIGN (");
3567 OUTS (outf
, dregs_lo (src0
));
3568 OUTS (outf
, ") * ");
3569 OUTS (outf
, dregs_lo (src1
));
3571 else if (aop
== 2 && aopcde
== 0)
3573 OUTS (outf
, dregs (dst0
));
3575 OUTS (outf
, dregs (src0
));
3576 OUTS (outf
, " -|+ ");
3577 OUTS (outf
, dregs (src1
));
3580 else if (aop
== 1 && aopcde
== 12)
3582 OUTS (outf
, dregs (dst1
));
3583 OUTS (outf
, " = A1.L + A1.H, ");
3584 OUTS (outf
, dregs (dst0
));
3585 OUTS (outf
, " = A0.L + A0.H");
3587 else if (aop
== 2 && aopcde
== 4)
3589 OUTS (outf
, dregs (dst1
));
3591 OUTS (outf
, dregs (src0
));
3593 OUTS (outf
, dregs (src1
));
3595 OUTS (outf
, dregs (dst0
));
3597 OUTS (outf
, dregs (src0
));
3599 OUTS (outf
, dregs (src1
));
3602 else if (HL
== 0 && aopcde
== 1)
3604 OUTS (outf
, dregs (dst1
));
3606 OUTS (outf
, dregs (src0
));
3607 OUTS (outf
, " +|+ ");
3608 OUTS (outf
, dregs (src1
));
3610 OUTS (outf
, dregs (dst0
));
3612 OUTS (outf
, dregs (src0
));
3613 OUTS (outf
, " -|- ");
3614 OUTS (outf
, dregs (src1
));
3615 amod0amod2 (s
, x
, aop
, outf
);
3617 else if (aop
== 0 && aopcde
== 11)
3619 OUTS (outf
, dregs (dst0
));
3620 OUTS (outf
, " = (A0 += A1)");
3622 else if (aop
== 0 && aopcde
== 10)
3624 OUTS (outf
, dregs_lo (dst0
));
3625 OUTS (outf
, " = A0.X");
3627 else if (aop
== 1 && aopcde
== 10)
3629 OUTS (outf
, dregs_lo (dst0
));
3630 OUTS (outf
, " = A1.X");
3632 else if (aop
== 1 && aopcde
== 0)
3634 OUTS (outf
, dregs (dst0
));
3636 OUTS (outf
, dregs (src0
));
3637 OUTS (outf
, " +|- ");
3638 OUTS (outf
, dregs (src1
));
3641 else if (aop
== 3 && aopcde
== 0)
3643 OUTS (outf
, dregs (dst0
));
3645 OUTS (outf
, dregs (src0
));
3646 OUTS (outf
, " -|- ");
3647 OUTS (outf
, dregs (src1
));
3650 else if (aop
== 1 && aopcde
== 4)
3652 OUTS (outf
, dregs (dst0
));
3654 OUTS (outf
, dregs (src0
));
3656 OUTS (outf
, dregs (src1
));
3659 else if (aop
== 0 && aopcde
== 17)
3661 OUTS (outf
, dregs (dst1
));
3662 OUTS (outf
, " = A1 + A0, ");
3663 OUTS (outf
, dregs (dst0
));
3664 OUTS (outf
, " = A1 - A0");
3667 else if (aop
== 1 && aopcde
== 17)
3669 OUTS (outf
, dregs (dst1
));
3670 OUTS (outf
, " = A0 + A1, ");
3671 OUTS (outf
, dregs (dst0
));
3672 OUTS (outf
, " = A0 - A1");
3675 else if (aop
== 0 && aopcde
== 18)
3677 OUTS (outf
, "SAA (");
3678 OUTS (outf
, dregs (src0
+ 1));
3680 OUTS (outf
, imm5d (src0
));
3682 OUTS (outf
, dregs (src1
+ 1));
3684 OUTS (outf
, imm5d (src1
));
3688 else if (aop
== 3 && aopcde
== 18)
3689 OUTS (outf
, "DISALGNEXCPT");
3691 else if (aop
== 0 && aopcde
== 20)
3693 OUTS (outf
, dregs (dst0
));
3694 OUTS (outf
, " = BYTEOP1P (");
3695 OUTS (outf
, dregs (src0
+ 1));
3697 OUTS (outf
, imm5d (src0
));
3699 OUTS (outf
, dregs (src1
+ 1));
3701 OUTS (outf
, imm5d (src1
));
3705 else if (aop
== 1 && aopcde
== 20)
3707 OUTS (outf
, dregs (dst0
));
3708 OUTS (outf
, " = BYTEOP1P (");
3709 OUTS (outf
, dregs (src0
+ 1));
3711 OUTS (outf
, imm5d (src0
));
3713 OUTS (outf
, dregs (src1
+ 1));
3715 OUTS (outf
, imm5d (src1
));
3716 OUTS (outf
, ") (T");
3718 OUTS (outf
, ", R)");
3722 else if (aop
== 0 && aopcde
== 21)
3725 OUTS (outf
, dregs (dst1
));
3727 OUTS (outf
, dregs (dst0
));
3728 OUTS (outf
, ") = BYTEOP16P (");
3729 OUTS (outf
, dregs (src0
+ 1));
3731 OUTS (outf
, imm5d (src0
));
3733 OUTS (outf
, dregs (src1
+ 1));
3735 OUTS (outf
, imm5d (src1
));
3739 else if (aop
== 1 && aopcde
== 21)
3742 OUTS (outf
, dregs (dst1
));
3744 OUTS (outf
, dregs (dst0
));
3745 OUTS (outf
, ") = BYTEOP16M (");
3746 OUTS (outf
, dregs (src0
+ 1));
3748 OUTS (outf
, imm5d (src0
));
3750 OUTS (outf
, dregs (src1
+ 1));
3752 OUTS (outf
, imm5d (src1
));
3756 else if (aop
== 2 && aopcde
== 7)
3758 OUTS (outf
, dregs (dst0
));
3759 OUTS (outf
, " = ABS ");
3760 OUTS (outf
, dregs (src0
));
3762 else if (aop
== 1 && aopcde
== 7)
3764 OUTS (outf
, dregs (dst0
));
3765 OUTS (outf
, " = MIN (");
3766 OUTS (outf
, dregs (src0
));
3768 OUTS (outf
, dregs (src1
));
3771 else if (aop
== 0 && aopcde
== 7)
3773 OUTS (outf
, dregs (dst0
));
3774 OUTS (outf
, " = MAX (");
3775 OUTS (outf
, dregs (src0
));
3777 OUTS (outf
, dregs (src1
));
3780 else if (aop
== 2 && aopcde
== 6)
3782 OUTS (outf
, dregs (dst0
));
3783 OUTS (outf
, " = ABS ");
3784 OUTS (outf
, dregs (src0
));
3785 OUTS (outf
, " (V)");
3787 else if (aop
== 1 && aopcde
== 6)
3789 OUTS (outf
, dregs (dst0
));
3790 OUTS (outf
, " = MIN (");
3791 OUTS (outf
, dregs (src0
));
3793 OUTS (outf
, dregs (src1
));
3794 OUTS (outf
, ") (V)");
3796 else if (aop
== 0 && aopcde
== 6)
3798 OUTS (outf
, dregs (dst0
));
3799 OUTS (outf
, " = MAX (");
3800 OUTS (outf
, dregs (src0
));
3802 OUTS (outf
, dregs (src1
));
3803 OUTS (outf
, ") (V)");
3805 else if (HL
== 1 && aopcde
== 1)
3807 OUTS (outf
, dregs (dst1
));
3809 OUTS (outf
, dregs (src0
));
3810 OUTS (outf
, " +|- ");
3811 OUTS (outf
, dregs (src1
));
3813 OUTS (outf
, dregs (dst0
));
3815 OUTS (outf
, dregs (src0
));
3816 OUTS (outf
, " -|+ ");
3817 OUTS (outf
, dregs (src1
));
3818 amod0amod2 (s
, x
, aop
, outf
);
3820 else if (aop
== 0 && aopcde
== 4)
3822 OUTS (outf
, dregs (dst0
));
3824 OUTS (outf
, dregs (src0
));
3826 OUTS (outf
, dregs (src1
));
3829 else if (aop
== 0 && aopcde
== 0)
3831 OUTS (outf
, dregs (dst0
));
3833 OUTS (outf
, dregs (src0
));
3834 OUTS (outf
, " +|+ ");
3835 OUTS (outf
, dregs (src1
));
3838 else if (aop
== 0 && aopcde
== 24)
3840 OUTS (outf
, dregs (dst0
));
3841 OUTS (outf
, " = BYTEPACK (");
3842 OUTS (outf
, dregs (src0
));
3844 OUTS (outf
, dregs (src1
));
3847 else if (aop
== 1 && aopcde
== 24)
3850 OUTS (outf
, dregs (dst1
));
3852 OUTS (outf
, dregs (dst0
));
3853 OUTS (outf
, ") = BYTEUNPACK ");
3854 OUTS (outf
, dregs (src0
+ 1));
3856 OUTS (outf
, imm5d (src0
));
3859 else if (aopcde
== 13)
3862 OUTS (outf
, dregs (dst1
));
3864 OUTS (outf
, dregs (dst0
));
3865 OUTS (outf
, ") = SEARCH ");
3866 OUTS (outf
, dregs (src0
));
3868 searchmod (aop
, outf
);
3878 decode_dsp32shift_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
3881 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
3882 | 1 | 1 | 0 | 0 |.M.| 1 | 1 | 0 | 0 | - | - |.sopcde............|
3883 |.sop...|.HLs...|.dst0......| - | - | - |.src0......|.src1......|
3884 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
3885 int HLs
= ((iw1
>> DSP32Shift_HLs_bits
) & DSP32Shift_HLs_mask
);
3886 int sop
= ((iw1
>> DSP32Shift_sop_bits
) & DSP32Shift_sop_mask
);
3887 int src0
= ((iw1
>> DSP32Shift_src0_bits
) & DSP32Shift_src0_mask
);
3888 int src1
= ((iw1
>> DSP32Shift_src1_bits
) & DSP32Shift_src1_mask
);
3889 int dst0
= ((iw1
>> DSP32Shift_dst0_bits
) & DSP32Shift_dst0_mask
);
3890 int sopcde
= ((iw0
>> (DSP32Shift_sopcde_bits
- 16)) & DSP32Shift_sopcde_mask
);
3891 const char *acc01
= (HLs
& 1) == 0 ? "A0" : "A1";
3893 if (HLs
== 0 && sop
== 0 && sopcde
== 0)
3895 OUTS (outf
, dregs_lo (dst0
));
3896 OUTS (outf
, " = ASHIFT ");
3897 OUTS (outf
, dregs_lo (src1
));
3898 OUTS (outf
, " BY ");
3899 OUTS (outf
, dregs_lo (src0
));
3901 else if (HLs
== 1 && sop
== 0 && sopcde
== 0)
3903 OUTS (outf
, dregs_lo (dst0
));
3904 OUTS (outf
, " = ASHIFT ");
3905 OUTS (outf
, dregs_hi (src1
));
3906 OUTS (outf
, " BY ");
3907 OUTS (outf
, dregs_lo (src0
));
3909 else if (HLs
== 2 && sop
== 0 && sopcde
== 0)
3911 OUTS (outf
, dregs_hi (dst0
));
3912 OUTS (outf
, " = ASHIFT ");
3913 OUTS (outf
, dregs_lo (src1
));
3914 OUTS (outf
, " BY ");
3915 OUTS (outf
, dregs_lo (src0
));
3917 else if (HLs
== 3 && sop
== 0 && sopcde
== 0)
3919 OUTS (outf
, dregs_hi (dst0
));
3920 OUTS (outf
, " = ASHIFT ");
3921 OUTS (outf
, dregs_hi (src1
));
3922 OUTS (outf
, " BY ");
3923 OUTS (outf
, dregs_lo (src0
));
3925 else if (HLs
== 0 && sop
== 1 && sopcde
== 0)
3927 OUTS (outf
, dregs_lo (dst0
));
3928 OUTS (outf
, " = ASHIFT ");
3929 OUTS (outf
, dregs_lo (src1
));
3930 OUTS (outf
, " BY ");
3931 OUTS (outf
, dregs_lo (src0
));
3932 OUTS (outf
, " (S)");
3934 else if (HLs
== 1 && sop
== 1 && sopcde
== 0)
3936 OUTS (outf
, dregs_lo (dst0
));
3937 OUTS (outf
, " = ASHIFT ");
3938 OUTS (outf
, dregs_hi (src1
));
3939 OUTS (outf
, " BY ");
3940 OUTS (outf
, dregs_lo (src0
));
3941 OUTS (outf
, " (S)");
3943 else if (HLs
== 2 && sop
== 1 && sopcde
== 0)
3945 OUTS (outf
, dregs_hi (dst0
));
3946 OUTS (outf
, " = ASHIFT ");
3947 OUTS (outf
, dregs_lo (src1
));
3948 OUTS (outf
, " BY ");
3949 OUTS (outf
, dregs_lo (src0
));
3950 OUTS (outf
, " (S)");
3952 else if (HLs
== 3 && sop
== 1 && sopcde
== 0)
3954 OUTS (outf
, dregs_hi (dst0
));
3955 OUTS (outf
, " = ASHIFT ");
3956 OUTS (outf
, dregs_hi (src1
));
3957 OUTS (outf
, " BY ");
3958 OUTS (outf
, dregs_lo (src0
));
3959 OUTS (outf
, " (S)");
3961 else if (sop
== 2 && sopcde
== 0)
3963 OUTS (outf
, (HLs
& 2) == 0 ? dregs_lo (dst0
) : dregs_hi (dst0
));
3964 OUTS (outf
, " = LSHIFT ");
3965 OUTS (outf
, (HLs
& 1) == 0 ? dregs_lo (src1
) : dregs_hi (src1
));
3966 OUTS (outf
, " BY ");
3967 OUTS (outf
, dregs_lo (src0
));
3969 else if (sop
== 0 && sopcde
== 3)
3972 OUTS (outf
, " = ASHIFT ");
3974 OUTS (outf
, " BY ");
3975 OUTS (outf
, dregs_lo (src0
));
3977 else if (sop
== 1 && sopcde
== 3)
3980 OUTS (outf
, " = LSHIFT ");
3982 OUTS (outf
, " BY ");
3983 OUTS (outf
, dregs_lo (src0
));
3985 else if (sop
== 2 && sopcde
== 3)
3988 OUTS (outf
, " = ROT ");
3990 OUTS (outf
, " BY ");
3991 OUTS (outf
, dregs_lo (src0
));
3993 else if (sop
== 3 && sopcde
== 3)
3995 OUTS (outf
, dregs (dst0
));
3996 OUTS (outf
, " = ROT ");
3997 OUTS (outf
, dregs (src1
));
3998 OUTS (outf
, " BY ");
3999 OUTS (outf
, dregs_lo (src0
));
4001 else if (sop
== 1 && sopcde
== 1)
4003 OUTS (outf
, dregs (dst0
));
4004 OUTS (outf
, " = ASHIFT ");
4005 OUTS (outf
, dregs (src1
));
4006 OUTS (outf
, " BY ");
4007 OUTS (outf
, dregs_lo (src0
));
4008 OUTS (outf
, " (V, S)");
4010 else if (sop
== 0 && sopcde
== 1)
4012 OUTS (outf
, dregs (dst0
));
4013 OUTS (outf
, " = ASHIFT ");
4014 OUTS (outf
, dregs (src1
));
4015 OUTS (outf
, " BY ");
4016 OUTS (outf
, dregs_lo (src0
));
4017 OUTS (outf
, " (V)");
4019 else if (sop
== 0 && sopcde
== 2)
4021 OUTS (outf
, dregs (dst0
));
4022 OUTS (outf
, " = ASHIFT ");
4023 OUTS (outf
, dregs (src1
));
4024 OUTS (outf
, " BY ");
4025 OUTS (outf
, dregs_lo (src0
));
4027 else if (sop
== 1 && sopcde
== 2)
4029 OUTS (outf
, dregs (dst0
));
4030 OUTS (outf
, " = ASHIFT ");
4031 OUTS (outf
, dregs (src1
));
4032 OUTS (outf
, " BY ");
4033 OUTS (outf
, dregs_lo (src0
));
4034 OUTS (outf
, " (S)");
4036 else if (sop
== 2 && sopcde
== 2)
4038 OUTS (outf
, dregs (dst0
));
4039 OUTS (outf
, " = LSHIFT ");
4040 OUTS (outf
, dregs (src1
));
4041 OUTS (outf
, " BY ");
4042 OUTS (outf
, dregs_lo (src0
));
4044 else if (sop
== 3 && sopcde
== 2)
4046 OUTS (outf
, dregs (dst0
));
4047 OUTS (outf
, " = ROT ");
4048 OUTS (outf
, dregs (src1
));
4049 OUTS (outf
, " BY ");
4050 OUTS (outf
, dregs_lo (src0
));
4052 else if (sop
== 2 && sopcde
== 1)
4054 OUTS (outf
, dregs (dst0
));
4055 OUTS (outf
, " = LSHIFT ");
4056 OUTS (outf
, dregs (src1
));
4057 OUTS (outf
, " BY ");
4058 OUTS (outf
, dregs_lo (src0
));
4059 OUTS (outf
, " (V)");
4061 else if (sop
== 0 && sopcde
== 4)
4063 OUTS (outf
, dregs (dst0
));
4064 OUTS (outf
, " = PACK (");
4065 OUTS (outf
, dregs_lo (src1
));
4067 OUTS (outf
, dregs_lo (src0
));
4070 else if (sop
== 1 && sopcde
== 4)
4072 OUTS (outf
, dregs (dst0
));
4073 OUTS (outf
, " = PACK (");
4074 OUTS (outf
, dregs_lo (src1
));
4076 OUTS (outf
, dregs_hi (src0
));
4079 else if (sop
== 2 && sopcde
== 4)
4081 OUTS (outf
, dregs (dst0
));
4082 OUTS (outf
, " = PACK (");
4083 OUTS (outf
, dregs_hi (src1
));
4085 OUTS (outf
, dregs_lo (src0
));
4088 else if (sop
== 3 && sopcde
== 4)
4090 OUTS (outf
, dregs (dst0
));
4091 OUTS (outf
, " = PACK (");
4092 OUTS (outf
, dregs_hi (src1
));
4094 OUTS (outf
, dregs_hi (src0
));
4097 else if (sop
== 0 && sopcde
== 5)
4099 OUTS (outf
, dregs_lo (dst0
));
4100 OUTS (outf
, " = SIGNBITS ");
4101 OUTS (outf
, dregs (src1
));
4103 else if (sop
== 1 && sopcde
== 5)
4105 OUTS (outf
, dregs_lo (dst0
));
4106 OUTS (outf
, " = SIGNBITS ");
4107 OUTS (outf
, dregs_lo (src1
));
4109 else if (sop
== 2 && sopcde
== 5)
4111 OUTS (outf
, dregs_lo (dst0
));
4112 OUTS (outf
, " = SIGNBITS ");
4113 OUTS (outf
, dregs_hi (src1
));
4115 else if (sop
== 0 && sopcde
== 6)
4117 OUTS (outf
, dregs_lo (dst0
));
4118 OUTS (outf
, " = SIGNBITS A0");
4120 else if (sop
== 1 && sopcde
== 6)
4122 OUTS (outf
, dregs_lo (dst0
));
4123 OUTS (outf
, " = SIGNBITS A1");
4125 else if (sop
== 3 && sopcde
== 6)
4127 OUTS (outf
, dregs_lo (dst0
));
4128 OUTS (outf
, " = ONES ");
4129 OUTS (outf
, dregs (src1
));
4131 else if (sop
== 0 && sopcde
== 7)
4133 OUTS (outf
, dregs_lo (dst0
));
4134 OUTS (outf
, " = EXPADJ (");
4135 OUTS (outf
, dregs (src1
));
4137 OUTS (outf
, dregs_lo (src0
));
4140 else if (sop
== 1 && sopcde
== 7)
4142 OUTS (outf
, dregs_lo (dst0
));
4143 OUTS (outf
, " = EXPADJ (");
4144 OUTS (outf
, dregs (src1
));
4146 OUTS (outf
, dregs_lo (src0
));
4147 OUTS (outf
, ") (V)");
4149 else if (sop
== 2 && sopcde
== 7)
4151 OUTS (outf
, dregs_lo (dst0
));
4152 OUTS (outf
, " = EXPADJ (");
4153 OUTS (outf
, dregs_lo (src1
));
4155 OUTS (outf
, dregs_lo (src0
));
4158 else if (sop
== 3 && sopcde
== 7)
4160 OUTS (outf
, dregs_lo (dst0
));
4161 OUTS (outf
, " = EXPADJ (");
4162 OUTS (outf
, dregs_hi (src1
));
4164 OUTS (outf
, dregs_lo (src0
));
4167 else if (sop
== 0 && sopcde
== 8)
4169 OUTS (outf
, "BITMUX (");
4170 OUTS (outf
, dregs (src0
));
4172 OUTS (outf
, dregs (src1
));
4173 OUTS (outf
, ", A0) (ASR)");
4175 else if (sop
== 1 && sopcde
== 8)
4177 OUTS (outf
, "BITMUX (");
4178 OUTS (outf
, dregs (src0
));
4180 OUTS (outf
, dregs (src1
));
4181 OUTS (outf
, ", A0) (ASL)");
4183 else if (sop
== 0 && sopcde
== 9)
4185 OUTS (outf
, dregs_lo (dst0
));
4186 OUTS (outf
, " = VIT_MAX (");
4187 OUTS (outf
, dregs (src1
));
4188 OUTS (outf
, ") (ASL)");
4190 else if (sop
== 1 && sopcde
== 9)
4192 OUTS (outf
, dregs_lo (dst0
));
4193 OUTS (outf
, " = VIT_MAX (");
4194 OUTS (outf
, dregs (src1
));
4195 OUTS (outf
, ") (ASR)");
4197 else if (sop
== 2 && sopcde
== 9)
4199 OUTS (outf
, dregs (dst0
));
4200 OUTS (outf
, " = VIT_MAX (");
4201 OUTS (outf
, dregs (src1
));
4203 OUTS (outf
, dregs (src0
));
4204 OUTS (outf
, ") (ASL)");
4206 else if (sop
== 3 && sopcde
== 9)
4208 OUTS (outf
, dregs (dst0
));
4209 OUTS (outf
, " = VIT_MAX (");
4210 OUTS (outf
, dregs (src1
));
4212 OUTS (outf
, dregs (src0
));
4213 OUTS (outf
, ") (ASR)");
4215 else if (sop
== 0 && sopcde
== 10)
4217 OUTS (outf
, dregs (dst0
));
4218 OUTS (outf
, " = EXTRACT (");
4219 OUTS (outf
, dregs (src1
));
4221 OUTS (outf
, dregs_lo (src0
));
4222 OUTS (outf
, ") (Z)");
4224 else if (sop
== 1 && sopcde
== 10)
4226 OUTS (outf
, dregs (dst0
));
4227 OUTS (outf
, " = EXTRACT (");
4228 OUTS (outf
, dregs (src1
));
4230 OUTS (outf
, dregs_lo (src0
));
4231 OUTS (outf
, ") (X)");
4233 else if (sop
== 2 && sopcde
== 10)
4235 OUTS (outf
, dregs (dst0
));
4236 OUTS (outf
, " = DEPOSIT (");
4237 OUTS (outf
, dregs (src1
));
4239 OUTS (outf
, dregs (src0
));
4242 else if (sop
== 3 && sopcde
== 10)
4244 OUTS (outf
, dregs (dst0
));
4245 OUTS (outf
, " = DEPOSIT (");
4246 OUTS (outf
, dregs (src1
));
4248 OUTS (outf
, dregs (src0
));
4249 OUTS (outf
, ") (X)");
4251 else if (sop
== 0 && sopcde
== 11)
4253 OUTS (outf
, dregs_lo (dst0
));
4254 OUTS (outf
, " = CC = BXORSHIFT (A0, ");
4255 OUTS (outf
, dregs (src0
));
4258 else if (sop
== 1 && sopcde
== 11)
4260 OUTS (outf
, dregs_lo (dst0
));
4261 OUTS (outf
, " = CC = BXOR (A0, ");
4262 OUTS (outf
, dregs (src0
));
4265 else if (sop
== 0 && sopcde
== 12)
4266 OUTS (outf
, "A0 = BXORSHIFT (A0, A1, CC)");
4268 else if (sop
== 1 && sopcde
== 12)
4270 OUTS (outf
, dregs_lo (dst0
));
4271 OUTS (outf
, " = CC = BXOR (A0, A1, CC)");
4273 else if (sop
== 0 && sopcde
== 13)
4275 OUTS (outf
, dregs (dst0
));
4276 OUTS (outf
, " = ALIGN8 (");
4277 OUTS (outf
, dregs (src1
));
4279 OUTS (outf
, dregs (src0
));
4282 else if (sop
== 1 && sopcde
== 13)
4284 OUTS (outf
, dregs (dst0
));
4285 OUTS (outf
, " = ALIGN16 (");
4286 OUTS (outf
, dregs (src1
));
4288 OUTS (outf
, dregs (src0
));
4291 else if (sop
== 2 && sopcde
== 13)
4293 OUTS (outf
, dregs (dst0
));
4294 OUTS (outf
, " = ALIGN24 (");
4295 OUTS (outf
, dregs (src1
));
4297 OUTS (outf
, dregs (src0
));
4307 decode_dsp32shiftimm_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
4310 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
4311 | 1 | 1 | 0 | 0 |.M.| 1 | 1 | 0 | 1 | - | - |.sopcde............|
4312 |.sop...|.HLs...|.dst0......|.immag.................|.src1......|
4313 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4314 int src1
= ((iw1
>> DSP32ShiftImm_src1_bits
) & DSP32ShiftImm_src1_mask
);
4315 int sop
= ((iw1
>> DSP32ShiftImm_sop_bits
) & DSP32ShiftImm_sop_mask
);
4316 int bit8
= ((iw1
>> 8) & 0x1);
4317 int immag
= ((iw1
>> DSP32ShiftImm_immag_bits
) & DSP32ShiftImm_immag_mask
);
4318 int newimmag
= (-(iw1
>> DSP32ShiftImm_immag_bits
) & DSP32ShiftImm_immag_mask
);
4319 int dst0
= ((iw1
>> DSP32ShiftImm_dst0_bits
) & DSP32ShiftImm_dst0_mask
);
4320 int sopcde
= ((iw0
>> (DSP32ShiftImm_sopcde_bits
- 16)) & DSP32ShiftImm_sopcde_mask
);
4321 int HLs
= ((iw1
>> DSP32ShiftImm_HLs_bits
) & DSP32ShiftImm_HLs_mask
);
4323 if (sop
== 0 && sopcde
== 0)
4325 OUTS (outf
, (HLs
& 2) ? dregs_hi (dst0
) : dregs_lo (dst0
));
4327 OUTS (outf
, (HLs
& 1) ? dregs_hi (src1
) : dregs_lo (src1
));
4328 OUTS (outf
, " >>> ");
4329 OUTS (outf
, uimm4 (newimmag
));
4331 else if (sop
== 1 && sopcde
== 0 && bit8
== 0)
4333 OUTS (outf
, (HLs
& 2) ? dregs_hi (dst0
) : dregs_lo (dst0
));
4335 OUTS (outf
, (HLs
& 1) ? dregs_hi (src1
) : dregs_lo (src1
));
4336 OUTS (outf
, " << ");
4337 OUTS (outf
, uimm4 (immag
));
4338 OUTS (outf
, " (S)");
4340 else if (sop
== 1 && sopcde
== 0 && bit8
== 1)
4342 OUTS (outf
, (HLs
& 2) ? dregs_hi (dst0
) : dregs_lo (dst0
));
4344 OUTS (outf
, (HLs
& 1) ? dregs_hi (src1
) : dregs_lo (src1
));
4345 OUTS (outf
, " >>> ");
4346 OUTS (outf
, uimm4 (newimmag
));
4347 OUTS (outf
, " (S)");
4349 else if (sop
== 2 && sopcde
== 0 && bit8
== 0)
4351 OUTS (outf
, (HLs
& 2) ? dregs_hi (dst0
) : dregs_lo (dst0
));
4353 OUTS (outf
, (HLs
& 1) ? dregs_hi (src1
) : dregs_lo (src1
));
4354 OUTS (outf
, " << ");
4355 OUTS (outf
, uimm4 (immag
));
4357 else if (sop
== 2 && sopcde
== 0 && bit8
== 1)
4359 OUTS (outf
, (HLs
& 2) ? dregs_hi (dst0
) : dregs_lo (dst0
));
4361 OUTS (outf
, (HLs
& 1) ? dregs_hi (src1
) : dregs_lo (src1
));
4362 OUTS (outf
, " >> ");
4363 OUTS (outf
, uimm4 (newimmag
));
4365 else if (sop
== 2 && sopcde
== 3 && HLs
== 1)
4367 OUTS (outf
, "A1 = ROT A1 BY ");
4368 OUTS (outf
, imm6 (immag
));
4370 else if (sop
== 0 && sopcde
== 3 && HLs
== 0 && bit8
== 0)
4372 OUTS (outf
, "A0 = A0 << ");
4373 OUTS (outf
, uimm5 (immag
));
4375 else if (sop
== 0 && sopcde
== 3 && HLs
== 0 && bit8
== 1)
4377 OUTS (outf
, "A0 = A0 >>> ");
4378 OUTS (outf
, uimm5 (newimmag
));
4380 else if (sop
== 0 && sopcde
== 3 && HLs
== 1 && bit8
== 0)
4382 OUTS (outf
, "A1 = A1 << ");
4383 OUTS (outf
, uimm5 (immag
));
4385 else if (sop
== 0 && sopcde
== 3 && HLs
== 1 && bit8
== 1)
4387 OUTS (outf
, "A1 = A1 >>> ");
4388 OUTS (outf
, uimm5 (newimmag
));
4390 else if (sop
== 1 && sopcde
== 3 && HLs
== 0)
4392 OUTS (outf
, "A0 = A0 >> ");
4393 OUTS (outf
, uimm5 (newimmag
));
4395 else if (sop
== 1 && sopcde
== 3 && HLs
== 1)
4397 OUTS (outf
, "A1 = A1 >> ");
4398 OUTS (outf
, uimm5 (newimmag
));
4400 else if (sop
== 2 && sopcde
== 3 && HLs
== 0)
4402 OUTS (outf
, "A0 = ROT A0 BY ");
4403 OUTS (outf
, imm6 (immag
));
4405 else if (sop
== 1 && sopcde
== 1 && bit8
== 0)
4407 OUTS (outf
, dregs (dst0
));
4409 OUTS (outf
, dregs (src1
));
4410 OUTS (outf
, " << ");
4411 OUTS (outf
, uimm5 (immag
));
4412 OUTS (outf
, " (V, S)");
4414 else if (sop
== 1 && sopcde
== 1 && bit8
== 1)
4416 OUTS (outf
, dregs (dst0
));
4418 OUTS (outf
, dregs (src1
));
4419 OUTS (outf
, " >>> ");
4420 OUTS (outf
, imm5 (-immag
));
4421 OUTS (outf
, " (V, S)");
4423 else if (sop
== 2 && sopcde
== 1 && bit8
== 1)
4425 OUTS (outf
, dregs (dst0
));
4427 OUTS (outf
, dregs (src1
));
4428 OUTS (outf
, " >> ");
4429 OUTS (outf
, uimm5 (newimmag
));
4430 OUTS (outf
, " (V)");
4432 else if (sop
== 2 && sopcde
== 1 && bit8
== 0)
4434 OUTS (outf
, dregs (dst0
));
4436 OUTS (outf
, dregs (src1
));
4437 OUTS (outf
, " << ");
4438 OUTS (outf
, imm5 (immag
));
4439 OUTS (outf
, " (V)");
4441 else if (sop
== 0 && sopcde
== 1)
4443 OUTS (outf
, dregs (dst0
));
4445 OUTS (outf
, dregs (src1
));
4446 OUTS (outf
, " >>> ");
4447 OUTS (outf
, uimm5 (newimmag
));
4448 OUTS (outf
, " (V)");
4450 else if (sop
== 1 && sopcde
== 2)
4452 OUTS (outf
, dregs (dst0
));
4454 OUTS (outf
, dregs (src1
));
4455 OUTS (outf
, " << ");
4456 OUTS (outf
, uimm5 (immag
));
4457 OUTS (outf
, " (S)");
4459 else if (sop
== 2 && sopcde
== 2 && bit8
== 1)
4461 OUTS (outf
, dregs (dst0
));
4463 OUTS (outf
, dregs (src1
));
4464 OUTS (outf
, " >> ");
4465 OUTS (outf
, uimm5 (newimmag
));
4467 else if (sop
== 2 && sopcde
== 2 && bit8
== 0)
4469 OUTS (outf
, dregs (dst0
));
4471 OUTS (outf
, dregs (src1
));
4472 OUTS (outf
, " << ");
4473 OUTS (outf
, uimm5 (immag
));
4475 else if (sop
== 3 && sopcde
== 2)
4477 OUTS (outf
, dregs (dst0
));
4478 OUTS (outf
, " = ROT ");
4479 OUTS (outf
, dregs (src1
));
4480 OUTS (outf
, " BY ");
4481 OUTS (outf
, imm6 (immag
));
4483 else if (sop
== 0 && sopcde
== 2)
4485 OUTS (outf
, dregs (dst0
));
4487 OUTS (outf
, dregs (src1
));
4488 OUTS (outf
, " >>> ");
4489 OUTS (outf
, uimm5 (newimmag
));
4498 decode_pseudoDEBUG_0 (TIword iw0
, disassemble_info
*outf
)
4500 struct private *priv
= outf
->private_data
;
4502 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
4503 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 |.fn....|.grp.......|.reg.......|
4504 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4505 int fn
= ((iw0
>> PseudoDbg_fn_bits
) & PseudoDbg_fn_mask
);
4506 int grp
= ((iw0
>> PseudoDbg_grp_bits
) & PseudoDbg_grp_mask
);
4507 int reg
= ((iw0
>> PseudoDbg_reg_bits
) & PseudoDbg_reg_mask
);
4512 if (reg
== 0 && fn
== 3)
4513 OUTS (outf
, "DBG A0");
4515 else if (reg
== 1 && fn
== 3)
4516 OUTS (outf
, "DBG A1");
4518 else if (reg
== 3 && fn
== 3)
4519 OUTS (outf
, "ABORT");
4521 else if (reg
== 4 && fn
== 3)
4524 else if (reg
== 5 && fn
== 3)
4525 OUTS (outf
, "DBGHALT");
4527 else if (reg
== 6 && fn
== 3)
4529 OUTS (outf
, "DBGCMPLX (");
4530 OUTS (outf
, dregs (grp
));
4533 else if (reg
== 7 && fn
== 3)
4536 else if (grp
== 0 && fn
== 2)
4538 OUTS (outf
, "OUTC ");
4539 OUTS (outf
, dregs (reg
));
4543 OUTS (outf
, "DBG ");
4544 OUTS (outf
, allregs (reg
, grp
));
4548 OUTS (outf
, "PRNT ");
4549 OUTS (outf
, allregs (reg
, grp
));
4558 decode_pseudoOChar_0 (TIword iw0
, disassemble_info
*outf
)
4560 struct private *priv
= outf
->private_data
;
4562 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
4563 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 1 |.ch............................|
4564 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4565 int ch
= ((iw0
>> PseudoChr_ch_bits
) & PseudoChr_ch_mask
);
4570 OUTS (outf
, "OUTC ");
4571 OUTS (outf
, uimm8 (ch
));
4577 decode_pseudodbg_assert_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
4579 struct private *priv
= outf
->private_data
;
4581 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
4582 | 1 | 1 | 1 | 1 | 0 | - | - | - | dbgop |.grp.......|.regtest...|
4583 |.expected......................................................|
4584 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4585 int expected
= ((iw1
>> PseudoDbg_Assert_expected_bits
) & PseudoDbg_Assert_expected_mask
);
4586 int dbgop
= ((iw0
>> (PseudoDbg_Assert_dbgop_bits
- 16)) & PseudoDbg_Assert_dbgop_mask
);
4587 int grp
= ((iw0
>> (PseudoDbg_Assert_grp_bits
- 16)) & PseudoDbg_Assert_grp_mask
);
4588 int regtest
= ((iw0
>> (PseudoDbg_Assert_regtest_bits
- 16)) & PseudoDbg_Assert_regtest_mask
);
4595 OUTS (outf
, "DBGA (");
4596 OUTS (outf
, regs_lo (regtest
, grp
));
4598 OUTS (outf
, uimm16 (expected
));
4601 else if (dbgop
== 1)
4603 OUTS (outf
, "DBGA (");
4604 OUTS (outf
, regs_hi (regtest
, grp
));
4606 OUTS (outf
, uimm16 (expected
));
4609 else if (dbgop
== 2)
4611 OUTS (outf
, "DBGAL (");
4612 OUTS (outf
, allregs (regtest
, grp
));
4614 OUTS (outf
, uimm16 (expected
));
4617 else if (dbgop
== 3)
4619 OUTS (outf
, "DBGAH (");
4620 OUTS (outf
, allregs (regtest
, grp
));
4622 OUTS (outf
, uimm16 (expected
));
4631 ifetch (bfd_vma pc
, disassemble_info
*outf
, TIword
*iw
)
4636 status
= (*outf
->read_memory_func
) (pc
, buf
, 2, outf
);
4639 (*outf
->memory_error_func
) (status
, pc
, outf
);
4643 *iw
= bfd_getl16 (buf
);
4648 _print_insn_bfin (bfd_vma pc
, disassemble_info
*outf
)
4650 struct private *priv
= outf
->private_data
;
4655 /* The PC must be 16-bit aligned. */
4658 OUTS (outf
, "ILLEGAL (UNALIGNED)");
4659 /* For people dumping data, just re-align the return value. */
4663 if (ifetch (pc
, outf
, &iw0
))
4667 if (((iw0
& 0xc000) == 0xc000) && ((iw0
& 0xff00) != 0xf800))
4670 if (ifetch (pc
+ 2, outf
, &iw1
))
4677 if ((iw0
& 0xf7ff) == 0xc003 && iw1
== 0x1800)
4681 OUTS (outf
, "ILLEGAL");
4684 OUTS (outf
, "MNOP");
4687 else if ((iw0
& 0xff00) == 0x0000)
4688 rv
= decode_ProgCtrl_0 (iw0
, outf
);
4689 else if ((iw0
& 0xffc0) == 0x0240)
4690 rv
= decode_CaCTRL_0 (iw0
, outf
);
4691 else if ((iw0
& 0xff80) == 0x0100)
4692 rv
= decode_PushPopReg_0 (iw0
, outf
);
4693 else if ((iw0
& 0xfe00) == 0x0400)
4694 rv
= decode_PushPopMultiple_0 (iw0
, outf
);
4695 else if ((iw0
& 0xfe00) == 0x0600)
4696 rv
= decode_ccMV_0 (iw0
, outf
);
4697 else if ((iw0
& 0xf800) == 0x0800)
4698 rv
= decode_CCflag_0 (iw0
, outf
);
4699 else if ((iw0
& 0xffe0) == 0x0200)
4700 rv
= decode_CC2dreg_0 (iw0
, outf
);
4701 else if ((iw0
& 0xff00) == 0x0300)
4702 rv
= decode_CC2stat_0 (iw0
, outf
);
4703 else if ((iw0
& 0xf000) == 0x1000)
4704 rv
= decode_BRCC_0 (iw0
, pc
, outf
);
4705 else if ((iw0
& 0xf000) == 0x2000)
4706 rv
= decode_UJUMP_0 (iw0
, pc
, outf
);
4707 else if ((iw0
& 0xf000) == 0x3000)
4708 rv
= decode_REGMV_0 (iw0
, outf
);
4709 else if ((iw0
& 0xfc00) == 0x4000)
4710 rv
= decode_ALU2op_0 (iw0
, outf
);
4711 else if ((iw0
& 0xfe00) == 0x4400)
4712 rv
= decode_PTR2op_0 (iw0
, outf
);
4713 else if ((iw0
& 0xf800) == 0x4800)
4714 rv
= decode_LOGI2op_0 (iw0
, outf
);
4715 else if ((iw0
& 0xf000) == 0x5000)
4716 rv
= decode_COMP3op_0 (iw0
, outf
);
4717 else if ((iw0
& 0xf800) == 0x6000)
4718 rv
= decode_COMPI2opD_0 (iw0
, outf
);
4719 else if ((iw0
& 0xf800) == 0x6800)
4720 rv
= decode_COMPI2opP_0 (iw0
, outf
);
4721 else if ((iw0
& 0xf000) == 0x8000)
4722 rv
= decode_LDSTpmod_0 (iw0
, outf
);
4723 else if ((iw0
& 0xff60) == 0x9e60)
4724 rv
= decode_dagMODim_0 (iw0
, outf
);
4725 else if ((iw0
& 0xfff0) == 0x9f60)
4726 rv
= decode_dagMODik_0 (iw0
, outf
);
4727 else if ((iw0
& 0xfc00) == 0x9c00)
4728 rv
= decode_dspLDST_0 (iw0
, outf
);
4729 else if ((iw0
& 0xf000) == 0x9000)
4730 rv
= decode_LDST_0 (iw0
, outf
);
4731 else if ((iw0
& 0xfc00) == 0xb800)
4732 rv
= decode_LDSTiiFP_0 (iw0
, outf
);
4733 else if ((iw0
& 0xe000) == 0xA000)
4734 rv
= decode_LDSTii_0 (iw0
, outf
);
4735 else if ((iw0
& 0xff80) == 0xe080 && (iw1
& 0x0C00) == 0x0000)
4736 rv
= decode_LoopSetup_0 (iw0
, iw1
, pc
, outf
);
4737 else if ((iw0
& 0xff00) == 0xe100 && (iw1
& 0x0000) == 0x0000)
4738 rv
= decode_LDIMMhalf_0 (iw0
, iw1
, outf
);
4739 else if ((iw0
& 0xfe00) == 0xe200 && (iw1
& 0x0000) == 0x0000)
4740 rv
= decode_CALLa_0 (iw0
, iw1
, pc
, outf
);
4741 else if ((iw0
& 0xfc00) == 0xe400 && (iw1
& 0x0000) == 0x0000)
4742 rv
= decode_LDSTidxI_0 (iw0
, iw1
, outf
);
4743 else if ((iw0
& 0xfffe) == 0xe800 && (iw1
& 0x0000) == 0x0000)
4744 rv
= decode_linkage_0 (iw0
, iw1
, outf
);
4745 else if ((iw0
& 0xf600) == 0xc000 && (iw1
& 0x0000) == 0x0000)
4746 rv
= decode_dsp32mac_0 (iw0
, iw1
, outf
);
4747 else if ((iw0
& 0xf600) == 0xc200 && (iw1
& 0x0000) == 0x0000)
4748 rv
= decode_dsp32mult_0 (iw0
, iw1
, outf
);
4749 else if ((iw0
& 0xf7c0) == 0xc400 && (iw1
& 0x0000) == 0x0000)
4750 rv
= decode_dsp32alu_0 (iw0
, iw1
, outf
);
4751 else if ((iw0
& 0xf780) == 0xc600 && (iw1
& 0x01c0) == 0x0000)
4752 rv
= decode_dsp32shift_0 (iw0
, iw1
, outf
);
4753 else if ((iw0
& 0xf780) == 0xc680 && (iw1
& 0x0000) == 0x0000)
4754 rv
= decode_dsp32shiftimm_0 (iw0
, iw1
, outf
);
4755 else if ((iw0
& 0xff00) == 0xf800)
4756 rv
= decode_pseudoDEBUG_0 (iw0
, outf
);
4757 else if ((iw0
& 0xFF00) == 0xF900)
4758 rv
= decode_pseudoOChar_0 (iw0
, outf
);
4759 else if ((iw0
& 0xFF00) == 0xf000 && (iw1
& 0x0000) == 0x0000)
4760 rv
= decode_pseudodbg_assert_0 (iw0
, iw1
, outf
);
4763 OUTS (outf
, "ILLEGAL");
4769 print_insn_bfin (bfd_vma pc
, disassemble_info
*outf
)
4771 struct private priv
;
4774 priv
.parallel
= FALSE
;
4775 priv
.comment
= FALSE
;
4776 outf
->private_data
= &priv
;
4778 count
= _print_insn_bfin (pc
, outf
);
4782 /* Proper display of multiple issue instructions. */
4784 if (count
== 4 && (priv
.iw0
& 0xc000) == 0xc000 && (priv
.iw0
& BIT_MULTI_INS
)
4785 && ((priv
.iw0
& 0xe800) != 0xe800 /* Not Linkage. */ ))
4787 bfd_boolean legal
= TRUE
;
4790 priv
.parallel
= TRUE
;
4791 OUTS (outf
, " || ");
4792 len
= _print_insn_bfin (pc
+ 4, outf
);
4795 OUTS (outf
, " || ");
4798 len
= _print_insn_bfin (pc
+ 6, outf
);
4808 OUTS (outf
, ";\t\t/* ILLEGAL PARALLEL INSTRUCTION */");
4809 priv
.comment
= TRUE
;