1 /* Disassemble ADI Blackfin Instructions.
2 Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012
3 Free Software Foundation, Inc.
5 This file is part of libopcodes.
7 This library is free software; you can redistribute it and/or modify
8 it under the terms of the GNU General Public License as published by
9 the Free Software Foundation; either version 3, or (at your option)
12 It is distributed in the hope that it will be useful, but WITHOUT
13 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
15 License for more details.
17 You should have received a copy of the GNU General Public License
18 along with this program; if not, write to the Free Software
19 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
20 MA 02110-1301, USA. */
25 #include "opcode/bfin.h"
37 #define HOST_LONG_WORD_SIZE (sizeof (long) * 8)
38 #define XFIELD(w,p,s) (((w) & ((1 << (s)) - 1) << (p)) >> (p))
39 #define SIGNEXTEND(v, n) ((v << (HOST_LONG_WORD_SIZE - (n))) >> (HOST_LONG_WORD_SIZE - (n)))
40 #define MASKBITS(val, bits) (val & ((1 << bits) - 1))
44 typedef unsigned int bu32
;
46 static char comment
= 0;
47 static char parallel
= 0;
51 c_0
, c_1
, c_4
, c_2
, c_uimm2
, c_uimm3
, c_imm3
, c_pcrel4
,
52 c_imm4
, c_uimm4s4
, c_uimm4s4d
, c_uimm4
, c_uimm4s2
, c_negimm5s4
, c_imm5
, c_imm5d
, c_uimm5
, c_imm6
,
53 c_imm7
, c_imm7d
, c_imm8
, c_uimm8
, c_pcrel8
, c_uimm8s4
, c_pcrel8s4
, c_lppcrel10
, c_pcrel10
,
54 c_pcrel12
, c_imm16s4
, c_luimm16
, c_imm16
, c_imm16d
, c_huimm16
, c_rimm16
, c_imm16s2
, c_uimm16s4
,
55 c_uimm16s4d
, c_uimm16
, c_pcrel24
, c_uimm32
, c_imm32
, c_huimm32
, c_huimm32e
,
72 } constant_formats
[] =
74 { "0", 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
75 { "1", 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
76 { "4", 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
77 { "2", 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
78 { "uimm2", 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
79 { "uimm3", 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
80 { "imm3", 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
81 { "pcrel4", 4, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0},
82 { "imm4", 4, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
83 { "uimm4s4", 4, 0, 0, 0, 2, 0, 0, 1, 0, 0, 0},
84 { "uimm4s4d", 4, 0, 0, 0, 2, 0, 0, 1, 1, 0, 0},
85 { "uimm4", 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
86 { "uimm4s2", 4, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0},
87 { "negimm5s4", 5, 0, 1, 0, 2, 0, 1, 0, 0, 0, 0},
88 { "imm5", 5, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
89 { "imm5d", 5, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0},
90 { "uimm5", 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
91 { "imm6", 6, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
92 { "imm7", 7, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
93 { "imm7d", 7, 0, 1, 0, 0, 0, 0, 0, 1, 3, 0},
94 { "imm8", 8, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
95 { "uimm8", 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
96 { "pcrel8", 8, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0},
97 { "uimm8s4", 8, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0},
98 { "pcrel8s4", 8, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0},
99 { "lppcrel10", 10, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0},
100 { "pcrel10", 10, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0},
101 { "pcrel12", 12, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0},
102 { "imm16s4", 16, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0},
103 { "luimm16", 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
104 { "imm16", 16, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
105 { "imm16d", 16, 0, 1, 0, 0, 0, 0, 0, 1, 3, 0},
106 { "huimm16", 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
107 { "rimm16", 16, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0},
108 { "imm16s2", 16, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0},
109 { "uimm16s4", 16, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0},
110 { "uimm16s4d", 16, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0},
111 { "uimm16", 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
112 { "pcrel24", 24, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0},
113 { "uimm32", 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
114 { "imm32", 32, 0, 1, 0, 0, 0, 0, 0, 1, 3, 0},
115 { "huimm32", 32, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
116 { "huimm32e", 32, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
120 fmtconst (const_forms_t cf
, TIword x
, bfd_vma pc
, disassemble_info
*outf
)
124 if (constant_formats
[cf
].reloc
)
126 bfd_vma ea
= (((constant_formats
[cf
].pcrel
? SIGNEXTEND (x
, constant_formats
[cf
].nbits
)
127 : x
) + constant_formats
[cf
].offset
) << constant_formats
[cf
].scale
);
128 if (constant_formats
[cf
].pcrel
)
131 /* truncate to 32-bits for proper symbol lookup/matching */
134 if (outf
->symbol_at_address_func (ea
, outf
) || !constant_formats
[cf
].exact
)
136 outf
->print_address_func (ea
, outf
);
141 sprintf (buf
, "%lx", (unsigned long) x
);
146 /* Negative constants have an implied sign bit. */
147 if (constant_formats
[cf
].negative
)
149 int nb
= constant_formats
[cf
].nbits
+ 1;
151 x
= x
| (1 << constant_formats
[cf
].nbits
);
152 x
= SIGNEXTEND (x
, nb
);
155 x
= constant_formats
[cf
].issigned
? SIGNEXTEND (x
, constant_formats
[cf
].nbits
) : x
;
157 if (constant_formats
[cf
].offset
)
158 x
+= constant_formats
[cf
].offset
;
160 if (constant_formats
[cf
].scale
)
161 x
<<= constant_formats
[cf
].scale
;
163 if (constant_formats
[cf
].decimal
)
164 sprintf (buf
, "%*li", constant_formats
[cf
].leading
, x
);
167 if (constant_formats
[cf
].issigned
&& x
< 0)
168 sprintf (buf
, "-0x%x", abs (x
));
170 sprintf (buf
, "0x%lx", (unsigned long) x
);
177 fmtconst_val (const_forms_t cf
, unsigned int x
, unsigned int pc
)
179 if (0 && constant_formats
[cf
].reloc
)
181 bu32 ea
= (((constant_formats
[cf
].pcrel
182 ? SIGNEXTEND (x
, constant_formats
[cf
].nbits
)
183 : x
) + constant_formats
[cf
].offset
)
184 << constant_formats
[cf
].scale
);
185 if (constant_formats
[cf
].pcrel
)
191 /* Negative constants have an implied sign bit. */
192 if (constant_formats
[cf
].negative
)
194 int nb
= constant_formats
[cf
].nbits
+ 1;
195 x
= x
| (1 << constant_formats
[cf
].nbits
);
196 x
= SIGNEXTEND (x
, nb
);
198 else if (constant_formats
[cf
].issigned
)
199 x
= SIGNEXTEND (x
, constant_formats
[cf
].nbits
);
201 x
+= constant_formats
[cf
].offset
;
202 x
<<= constant_formats
[cf
].scale
;
207 enum machine_registers
209 REG_RL0
, REG_RL1
, REG_RL2
, REG_RL3
, REG_RL4
, REG_RL5
, REG_RL6
, REG_RL7
,
210 REG_RH0
, REG_RH1
, REG_RH2
, REG_RH3
, REG_RH4
, REG_RH5
, REG_RH6
, REG_RH7
,
211 REG_R0
, REG_R1
, REG_R2
, REG_R3
, REG_R4
, REG_R5
, REG_R6
, REG_R7
,
212 REG_R1_0
, REG_R3_2
, REG_R5_4
, REG_R7_6
, REG_P0
, REG_P1
, REG_P2
, REG_P3
,
213 REG_P4
, REG_P5
, REG_SP
, REG_FP
, REG_A0x
, REG_A1x
, REG_A0w
, REG_A1w
,
214 REG_A0
, REG_A1
, REG_I0
, REG_I1
, REG_I2
, REG_I3
, REG_M0
, REG_M1
,
215 REG_M2
, REG_M3
, REG_B0
, REG_B1
, REG_B2
, REG_B3
, REG_L0
, REG_L1
,
217 REG_AZ
, REG_AN
, REG_AC0
, REG_AC1
, REG_AV0
, REG_AV1
, REG_AV0S
, REG_AV1S
,
218 REG_AQ
, REG_V
, REG_VS
,
219 REG_sftreset
, REG_omode
, REG_excause
, REG_emucause
, REG_idle_req
, REG_hwerrcause
, REG_CC
, REG_LC0
,
220 REG_LC1
, REG_ASTAT
, REG_RETS
, REG_LT0
, REG_LB0
, REG_LT1
, REG_LB1
,
221 REG_CYCLES
, REG_CYCLES2
, REG_USP
, REG_SEQSTAT
, REG_SYSCFG
, REG_RETI
, REG_RETX
, REG_RETN
,
222 REG_RETE
, REG_EMUDAT
, REG_BR0
, REG_BR1
, REG_BR2
, REG_BR3
, REG_BR4
, REG_BR5
, REG_BR6
,
223 REG_BR7
, REG_PL0
, REG_PL1
, REG_PL2
, REG_PL3
, REG_PL4
, REG_PL5
, REG_SLP
, REG_FLP
,
224 REG_PH0
, REG_PH1
, REG_PH2
, REG_PH3
, REG_PH4
, REG_PH5
, REG_SHP
, REG_FHP
,
225 REG_IL0
, REG_IL1
, REG_IL2
, REG_IL3
, REG_ML0
, REG_ML1
, REG_ML2
, REG_ML3
,
226 REG_BL0
, REG_BL1
, REG_BL2
, REG_BL3
, REG_LL0
, REG_LL1
, REG_LL2
, REG_LL3
,
227 REG_IH0
, REG_IH1
, REG_IH2
, REG_IH3
, REG_MH0
, REG_MH1
, REG_MH2
, REG_MH3
,
228 REG_BH0
, REG_BH1
, REG_BH2
, REG_BH3
, REG_LH0
, REG_LH1
, REG_LH2
, REG_LH3
,
229 REG_AC0_COPY
, REG_V_COPY
, REG_RND_MOD
,
235 rc_dregs_lo
, rc_dregs_hi
, rc_dregs
, rc_dregs_pair
, rc_pregs
, rc_spfp
, rc_dregs_hilo
, rc_accum_ext
,
236 rc_accum_word
, rc_accum
, rc_iregs
, rc_mregs
, rc_bregs
, rc_lregs
, rc_dpregs
, rc_gregs
,
237 rc_regs
, rc_statbits
, rc_ignore_bits
, rc_ccstat
, rc_counters
, rc_dregs2_sysregs1
, rc_open
, rc_sysregs2
,
238 rc_sysregs3
, rc_allregs
,
242 static const char * const reg_names
[] =
244 "R0.L", "R1.L", "R2.L", "R3.L", "R4.L", "R5.L", "R6.L", "R7.L",
245 "R0.H", "R1.H", "R2.H", "R3.H", "R4.H", "R5.H", "R6.H", "R7.H",
246 "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7",
247 "R1:0", "R3:2", "R5:4", "R7:6", "P0", "P1", "P2", "P3",
248 "P4", "P5", "SP", "FP", "A0.X", "A1.X", "A0.W", "A1.W",
249 "A0", "A1", "I0", "I1", "I2", "I3", "M0", "M1",
250 "M2", "M3", "B0", "B1", "B2", "B3", "L0", "L1",
252 "AZ", "AN", "AC0", "AC1", "AV0", "AV1", "AV0S", "AV1S",
254 "sftreset", "omode", "excause", "emucause", "idle_req", "hwerrcause", "CC", "LC0",
255 "LC1", "ASTAT", "RETS", "LT0", "LB0", "LT1", "LB1",
256 "CYCLES", "CYCLES2", "USP", "SEQSTAT", "SYSCFG", "RETI", "RETX", "RETN",
258 "R0.B", "R1.B", "R2.B", "R3.B", "R4.B", "R5.B", "R6.B", "R7.B",
259 "P0.L", "P1.L", "P2.L", "P3.L", "P4.L", "P5.L", "SP.L", "FP.L",
260 "P0.H", "P1.H", "P2.H", "P3.H", "P4.H", "P5.H", "SP.H", "FP.H",
261 "I0.L", "I1.L", "I2.L", "I3.L", "M0.L", "M1.L", "M2.L", "M3.L",
262 "B0.L", "B1.L", "B2.L", "B3.L", "L0.L", "L1.L", "L2.L", "L3.L",
263 "I0.H", "I1.H", "I2.H", "I3.H", "M0.H", "M1.H", "M2.H", "M3.H",
264 "B0.H", "B1.H", "B2.H", "B3.H", "L0.H", "L1.H", "L2.H", "L3.H",
265 "AC0_COPY", "V_COPY", "RND_MOD",
270 #define REGNAME(x) ((x) < REG_LASTREG ? (reg_names[x]) : "...... Illegal register .......")
273 static const enum machine_registers decode_dregs_lo
[] =
275 REG_RL0
, REG_RL1
, REG_RL2
, REG_RL3
, REG_RL4
, REG_RL5
, REG_RL6
, REG_RL7
,
278 #define dregs_lo(x) REGNAME (decode_dregs_lo[(x) & 7])
281 static const enum machine_registers decode_dregs_hi
[] =
283 REG_RH0
, REG_RH1
, REG_RH2
, REG_RH3
, REG_RH4
, REG_RH5
, REG_RH6
, REG_RH7
,
286 #define dregs_hi(x) REGNAME (decode_dregs_hi[(x) & 7])
289 static const enum machine_registers decode_dregs
[] =
291 REG_R0
, REG_R1
, REG_R2
, REG_R3
, REG_R4
, REG_R5
, REG_R6
, REG_R7
,
294 #define dregs(x) REGNAME (decode_dregs[(x) & 7])
297 static const enum machine_registers decode_dregs_byte
[] =
299 REG_BR0
, REG_BR1
, REG_BR2
, REG_BR3
, REG_BR4
, REG_BR5
, REG_BR6
, REG_BR7
,
302 #define dregs_byte(x) REGNAME (decode_dregs_byte[(x) & 7])
305 static const enum machine_registers decode_pregs
[] =
307 REG_P0
, REG_P1
, REG_P2
, REG_P3
, REG_P4
, REG_P5
, REG_SP
, REG_FP
,
310 #define pregs(x) REGNAME (decode_pregs[(x) & 7])
311 #define spfp(x) REGNAME (decode_spfp[(x) & 1])
312 #define dregs_hilo(x, i) REGNAME (decode_dregs_hilo[((i) << 3) | (x)])
313 #define accum_ext(x) REGNAME (decode_accum_ext[(x) & 1])
314 #define accum_word(x) REGNAME (decode_accum_word[(x) & 1])
315 #define accum(x) REGNAME (decode_accum[(x) & 1])
318 static const enum machine_registers decode_iregs
[] =
320 REG_I0
, REG_I1
, REG_I2
, REG_I3
,
323 #define iregs(x) REGNAME (decode_iregs[(x) & 3])
326 static const enum machine_registers decode_mregs
[] =
328 REG_M0
, REG_M1
, REG_M2
, REG_M3
,
331 #define mregs(x) REGNAME (decode_mregs[(x) & 3])
332 #define bregs(x) REGNAME (decode_bregs[(x) & 3])
333 #define lregs(x) REGNAME (decode_lregs[(x) & 3])
336 static const enum machine_registers decode_dpregs
[] =
338 REG_R0
, REG_R1
, REG_R2
, REG_R3
, REG_R4
, REG_R5
, REG_R6
, REG_R7
,
339 REG_P0
, REG_P1
, REG_P2
, REG_P3
, REG_P4
, REG_P5
, REG_SP
, REG_FP
,
342 #define dpregs(x) REGNAME (decode_dpregs[(x) & 15])
345 static const enum machine_registers decode_gregs
[] =
347 REG_R0
, REG_R1
, REG_R2
, REG_R3
, REG_R4
, REG_R5
, REG_R6
, REG_R7
,
348 REG_P0
, REG_P1
, REG_P2
, REG_P3
, REG_P4
, REG_P5
, REG_SP
, REG_FP
,
351 #define gregs(x, i) REGNAME (decode_gregs[((i) << 3) | (x)])
353 /* [dregs pregs (iregs mregs) (bregs lregs)]. */
354 static const enum machine_registers decode_regs
[] =
356 REG_R0
, REG_R1
, REG_R2
, REG_R3
, REG_R4
, REG_R5
, REG_R6
, REG_R7
,
357 REG_P0
, REG_P1
, REG_P2
, REG_P3
, REG_P4
, REG_P5
, REG_SP
, REG_FP
,
358 REG_I0
, REG_I1
, REG_I2
, REG_I3
, REG_M0
, REG_M1
, REG_M2
, REG_M3
,
359 REG_B0
, REG_B1
, REG_B2
, REG_B3
, REG_L0
, REG_L1
, REG_L2
, REG_L3
,
362 #define regs(x, i) REGNAME (decode_regs[((i) << 3) | (x)])
364 /* [dregs pregs (iregs mregs) (bregs lregs) Low Half]. */
365 static const enum machine_registers decode_regs_lo
[] =
367 REG_RL0
, REG_RL1
, REG_RL2
, REG_RL3
, REG_RL4
, REG_RL5
, REG_RL6
, REG_RL7
,
368 REG_PL0
, REG_PL1
, REG_PL2
, REG_PL3
, REG_PL4
, REG_PL5
, REG_SLP
, REG_FLP
,
369 REG_IL0
, REG_IL1
, REG_IL2
, REG_IL3
, REG_ML0
, REG_ML1
, REG_ML2
, REG_ML3
,
370 REG_BL0
, REG_BL1
, REG_BL2
, REG_BL3
, REG_LL0
, REG_LL1
, REG_LL2
, REG_LL3
,
373 #define regs_lo(x, i) REGNAME (decode_regs_lo[((i) << 3) | (x)])
375 /* [dregs pregs (iregs mregs) (bregs lregs) High Half]. */
376 static const enum machine_registers decode_regs_hi
[] =
378 REG_RH0
, REG_RH1
, REG_RH2
, REG_RH3
, REG_RH4
, REG_RH5
, REG_RH6
, REG_RH7
,
379 REG_PH0
, REG_PH1
, REG_PH2
, REG_PH3
, REG_PH4
, REG_PH5
, REG_SHP
, REG_FHP
,
380 REG_IH0
, REG_IH1
, REG_IH2
, REG_IH3
, REG_MH0
, REG_MH1
, REG_MH2
, REG_MH3
,
381 REG_BH0
, REG_BH1
, REG_BH2
, REG_BH3
, REG_LH0
, REG_LH1
, REG_LH2
, REG_LH3
,
384 #define regs_hi(x, i) REGNAME (decode_regs_hi[((i) << 3) | (x)])
386 static const enum machine_registers decode_statbits
[] =
388 REG_AZ
, REG_AN
, REG_AC0_COPY
, REG_V_COPY
,
389 REG_LASTREG
, REG_LASTREG
, REG_AQ
, REG_LASTREG
,
390 REG_RND_MOD
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
,
391 REG_AC0
, REG_AC1
, REG_LASTREG
, REG_LASTREG
,
392 REG_AV0
, REG_AV0S
, REG_AV1
, REG_AV1S
,
393 REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
,
394 REG_V
, REG_VS
, REG_LASTREG
, REG_LASTREG
,
395 REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
,
398 #define statbits(x) REGNAME (decode_statbits[(x) & 31])
401 static const enum machine_registers decode_counters
[] =
406 #define counters(x) REGNAME (decode_counters[(x) & 1])
407 #define dregs2_sysregs1(x) REGNAME (decode_dregs2_sysregs1[(x) & 7])
409 /* [dregs pregs (iregs mregs) (bregs lregs)
410 dregs2_sysregs1 open sysregs2 sysregs3]. */
411 static const enum machine_registers decode_allregs
[] =
413 REG_R0
, REG_R1
, REG_R2
, REG_R3
, REG_R4
, REG_R5
, REG_R6
, REG_R7
,
414 REG_P0
, REG_P1
, REG_P2
, REG_P3
, REG_P4
, REG_P5
, REG_SP
, REG_FP
,
415 REG_I0
, REG_I1
, REG_I2
, REG_I3
, REG_M0
, REG_M1
, REG_M2
, REG_M3
,
416 REG_B0
, REG_B1
, REG_B2
, REG_B3
, REG_L0
, REG_L1
, REG_L2
, REG_L3
,
417 REG_A0x
, REG_A0w
, REG_A1x
, REG_A1w
, REG_LASTREG
, REG_LASTREG
, REG_ASTAT
, REG_RETS
,
418 REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
,
419 REG_LC0
, REG_LT0
, REG_LB0
, REG_LC1
, REG_LT1
, REG_LB1
, REG_CYCLES
, REG_CYCLES2
,
420 REG_USP
, REG_SEQSTAT
, REG_SYSCFG
, REG_RETI
, REG_RETX
, REG_RETN
, REG_RETE
, REG_EMUDAT
,
424 #define IS_DREG(g,r) ((g) == 0 && (r) < 8)
425 #define IS_PREG(g,r) ((g) == 1 && (r) < 8)
426 #define IS_AREG(g,r) ((g) == 4 && (r) >= 0 && (r) < 4)
427 #define IS_GENREG(g,r) ((((g) == 0 || (g) == 1) && (r) < 8) || IS_AREG (g, r))
428 #define IS_DAGREG(g,r) (((g) == 2 || (g) == 3) && (r) < 8)
429 #define IS_SYSREG(g,r) \
430 (((g) == 4 && ((r) == 6 || (r) == 7)) || (g) == 6 || (g) == 7)
431 #define IS_RESERVEDREG(g,r) \
432 (((r) > 7) || ((g) == 4 && ((r) == 4 || (r) == 5)) || (g) == 5)
434 #define allreg(r,g) (!IS_RESERVEDREG (g, r))
435 #define mostreg(r,g) (!(IS_DREG (g, r) || IS_PREG (g, r) || IS_RESERVEDREG (g, r)))
437 #define allregs(x, i) REGNAME (decode_allregs[((i) << 3) | (x)])
438 #define uimm16s4(x) fmtconst (c_uimm16s4, x, 0, outf)
439 #define uimm16s4d(x) fmtconst (c_uimm16s4d, x, 0, outf)
440 #define pcrel4(x) fmtconst (c_pcrel4, x, pc, outf)
441 #define pcrel8(x) fmtconst (c_pcrel8, x, pc, outf)
442 #define pcrel8s4(x) fmtconst (c_pcrel8s4, x, pc, outf)
443 #define pcrel10(x) fmtconst (c_pcrel10, x, pc, outf)
444 #define pcrel12(x) fmtconst (c_pcrel12, x, pc, outf)
445 #define negimm5s4(x) fmtconst (c_negimm5s4, x, 0, outf)
446 #define rimm16(x) fmtconst (c_rimm16, x, 0, outf)
447 #define huimm16(x) fmtconst (c_huimm16, x, 0, outf)
448 #define imm16(x) fmtconst (c_imm16, x, 0, outf)
449 #define imm16d(x) fmtconst (c_imm16d, x, 0, outf)
450 #define uimm2(x) fmtconst (c_uimm2, x, 0, outf)
451 #define uimm3(x) fmtconst (c_uimm3, x, 0, outf)
452 #define luimm16(x) fmtconst (c_luimm16, x, 0, outf)
453 #define uimm4(x) fmtconst (c_uimm4, x, 0, outf)
454 #define uimm5(x) fmtconst (c_uimm5, x, 0, outf)
455 #define imm16s2(x) fmtconst (c_imm16s2, x, 0, outf)
456 #define uimm8(x) fmtconst (c_uimm8, x, 0, outf)
457 #define imm16s4(x) fmtconst (c_imm16s4, x, 0, outf)
458 #define uimm4s2(x) fmtconst (c_uimm4s2, x, 0, outf)
459 #define uimm4s4(x) fmtconst (c_uimm4s4, x, 0, outf)
460 #define uimm4s4d(x) fmtconst (c_uimm4s4d, x, 0, outf)
461 #define lppcrel10(x) fmtconst (c_lppcrel10, x, pc, outf)
462 #define imm3(x) fmtconst (c_imm3, x, 0, outf)
463 #define imm4(x) fmtconst (c_imm4, x, 0, outf)
464 #define uimm8s4(x) fmtconst (c_uimm8s4, x, 0, outf)
465 #define imm5(x) fmtconst (c_imm5, x, 0, outf)
466 #define imm5d(x) fmtconst (c_imm5d, x, 0, outf)
467 #define imm6(x) fmtconst (c_imm6, x, 0, outf)
468 #define imm7(x) fmtconst (c_imm7, x, 0, outf)
469 #define imm7d(x) fmtconst (c_imm7d, x, 0, outf)
470 #define imm8(x) fmtconst (c_imm8, x, 0, outf)
471 #define pcrel24(x) fmtconst (c_pcrel24, x, pc, outf)
472 #define uimm16(x) fmtconst (c_uimm16, x, 0, outf)
473 #define uimm32(x) fmtconst (c_uimm32, x, 0, outf)
474 #define imm32(x) fmtconst (c_imm32, x, 0, outf)
475 #define huimm32(x) fmtconst (c_huimm32, x, 0, outf)
476 #define huimm32e(x) fmtconst (c_huimm32e, x, 0, outf)
477 #define imm7_val(x) fmtconst_val (c_imm7, x, 0)
478 #define imm16_val(x) fmtconst_val (c_uimm16, x, 0)
479 #define luimm16_val(x) fmtconst_val (c_luimm16, x, 0)
481 /* (arch.pm)arch_disassembler_functions. */
483 #define OUTS(p, txt) (p)->fprintf_func ((p)->stream, "%s", txt)
487 amod0 (int s0
, int x0
, disassemble_info
*outf
)
489 if (s0
== 1 && x0
== 0)
491 else if (s0
== 0 && x0
== 1)
492 OUTS (outf
, " (CO)");
493 else if (s0
== 1 && x0
== 1)
494 OUTS (outf
, " (SCO)");
498 amod1 (int s0
, int x0
, disassemble_info
*outf
)
500 if (s0
== 0 && x0
== 0)
501 OUTS (outf
, " (NS)");
502 else if (s0
== 1 && x0
== 0)
507 amod0amod2 (int s0
, int x0
, int aop0
, disassemble_info
*outf
)
509 if (s0
== 1 && x0
== 0 && aop0
== 0)
511 else if (s0
== 0 && x0
== 1 && aop0
== 0)
512 OUTS (outf
, " (CO)");
513 else if (s0
== 1 && x0
== 1 && aop0
== 0)
514 OUTS (outf
, " (SCO)");
515 else if (s0
== 0 && x0
== 0 && aop0
== 2)
516 OUTS (outf
, " (ASR)");
517 else if (s0
== 1 && x0
== 0 && aop0
== 2)
518 OUTS (outf
, " (S, ASR)");
519 else if (s0
== 0 && x0
== 1 && aop0
== 2)
520 OUTS (outf
, " (CO, ASR)");
521 else if (s0
== 1 && x0
== 1 && aop0
== 2)
522 OUTS (outf
, " (SCO, ASR)");
523 else if (s0
== 0 && x0
== 0 && aop0
== 3)
524 OUTS (outf
, " (ASL)");
525 else if (s0
== 1 && x0
== 0 && aop0
== 3)
526 OUTS (outf
, " (S, ASL)");
527 else if (s0
== 0 && x0
== 1 && aop0
== 3)
528 OUTS (outf
, " (CO, ASL)");
529 else if (s0
== 1 && x0
== 1 && aop0
== 3)
530 OUTS (outf
, " (SCO, ASL)");
534 searchmod (int r0
, disassemble_info
*outf
)
547 aligndir (int r0
, disassemble_info
*outf
)
554 decode_multfunc (int h0
, int h1
, int src0
, int src1
, disassemble_info
*outf
)
559 s0
= dregs_hi (src0
);
561 s0
= dregs_lo (src0
);
564 s1
= dregs_hi (src1
);
566 s1
= dregs_lo (src1
);
575 decode_macfunc (int which
, int op
, int h0
, int h1
, int src0
, int src1
, disassemble_info
*outf
)
578 const char *sop
= "<unknown op>";
593 case 0: sop
= " = "; break;
594 case 1: sop
= " += "; break;
595 case 2: sop
= " -= "; break;
601 decode_multfunc (h0
, h1
, src0
, src1
, outf
);
607 decode_optmode (int mod
, int MM
, disassemble_info
*outf
)
609 if (mod
== 0 && MM
== 0)
624 OUTS (outf
, "S2RND");
627 else if (mod
== M_W32
)
629 else if (mod
== M_FU
)
631 else if (mod
== M_TFU
)
633 else if (mod
== M_IS
)
635 else if (mod
== M_ISS2
)
637 else if (mod
== M_IH
)
639 else if (mod
== M_IU
)
647 static struct saved_state
649 bu32 dpregs
[16], iregs
[4], mregs
[4], bregs
[4], lregs
[4];
651 bu32 lt
[2], lc
[2], lb
[2];
655 #define DREG(x) (saved_state.dpregs[x])
656 #define GREG(x, i) DPREG ((x) | ((i) << 3))
657 #define DPREG(x) (saved_state.dpregs[x])
658 #define DREG(x) (saved_state.dpregs[x])
659 #define PREG(x) (saved_state.dpregs[(x) + 8])
660 #define SPREG PREG (6)
661 #define FPREG PREG (7)
662 #define IREG(x) (saved_state.iregs[x])
663 #define MREG(x) (saved_state.mregs[x])
664 #define BREG(x) (saved_state.bregs[x])
665 #define LREG(x) (saved_state.lregs[x])
666 #define AXREG(x) (saved_state.ax[x])
667 #define AWREG(x) (saved_state.aw[x])
668 #define LCREG(x) (saved_state.lc[x])
669 #define LTREG(x) (saved_state.lt[x])
670 #define LBREG(x) (saved_state.lb[x])
671 #define RETSREG (saved_state.rets)
674 get_allreg (int grp
, int reg
)
676 int fullreg
= (grp
<< 3) | reg
;
677 /* REG_R0, REG_R1, REG_R2, REG_R3, REG_R4, REG_R5, REG_R6, REG_R7,
678 REG_P0, REG_P1, REG_P2, REG_P3, REG_P4, REG_P5, REG_SP, REG_FP,
679 REG_I0, REG_I1, REG_I2, REG_I3, REG_M0, REG_M1, REG_M2, REG_M3,
680 REG_B0, REG_B1, REG_B2, REG_B3, REG_L0, REG_L1, REG_L2, REG_L3,
681 REG_A0x, REG_A0w, REG_A1x, REG_A1w, , , REG_ASTAT, REG_RETS,
683 REG_LC0, REG_LT0, REG_LB0, REG_LC1, REG_LT1, REG_LB1, REG_CYCLES,
685 REG_USP, REG_SEQSTAT, REG_SYSCFG, REG_RETI, REG_RETX, REG_RETN, REG_RETE,
687 switch (fullreg
>> 2)
689 case 0: case 1: return &DREG (reg
);
690 case 2: case 3: return &PREG (reg
);
691 case 4: return &IREG (reg
& 3);
692 case 5: return &MREG (reg
& 3);
693 case 6: return &BREG (reg
& 3);
694 case 7: return &LREG (reg
& 3);
698 case 32: return &AXREG (0);
699 case 33: return &AWREG (0);
700 case 34: return &AXREG (1);
701 case 35: return &AWREG (1);
702 case 39: return &RETSREG
;
703 case 48: return &LCREG (0);
704 case 49: return <REG (0);
705 case 50: return &LBREG (0);
706 case 51: return &LCREG (1);
707 case 52: return <REG (1);
708 case 53: return &LBREG (1);
715 decode_ProgCtrl_0 (TIword iw0
, disassemble_info
*outf
)
718 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
719 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |.prgfunc.......|.poprnd........|
720 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
721 int poprnd
= ((iw0
>> ProgCtrl_poprnd_bits
) & ProgCtrl_poprnd_mask
);
722 int prgfunc
= ((iw0
>> ProgCtrl_prgfunc_bits
) & ProgCtrl_prgfunc_mask
);
724 if (prgfunc
== 0 && poprnd
== 0)
728 else if (prgfunc
== 1 && poprnd
== 0)
730 else if (prgfunc
== 1 && poprnd
== 1)
732 else if (prgfunc
== 1 && poprnd
== 2)
734 else if (prgfunc
== 1 && poprnd
== 3)
736 else if (prgfunc
== 1 && poprnd
== 4)
738 else if (prgfunc
== 2 && poprnd
== 0)
740 else if (prgfunc
== 2 && poprnd
== 3)
741 OUTS (outf
, "CSYNC");
742 else if (prgfunc
== 2 && poprnd
== 4)
743 OUTS (outf
, "SSYNC");
744 else if (prgfunc
== 2 && poprnd
== 5)
745 OUTS (outf
, "EMUEXCPT");
746 else if (prgfunc
== 3 && IS_DREG (0, poprnd
))
749 OUTS (outf
, dregs (poprnd
));
751 else if (prgfunc
== 4 && IS_DREG (0, poprnd
))
754 OUTS (outf
, dregs (poprnd
));
756 else if (prgfunc
== 5 && IS_PREG (1, poprnd
))
758 OUTS (outf
, "JUMP (");
759 OUTS (outf
, pregs (poprnd
));
762 else if (prgfunc
== 6 && IS_PREG (1, poprnd
))
764 OUTS (outf
, "CALL (");
765 OUTS (outf
, pregs (poprnd
));
768 else if (prgfunc
== 7 && IS_PREG (1, poprnd
))
770 OUTS (outf
, "CALL (PC + ");
771 OUTS (outf
, pregs (poprnd
));
774 else if (prgfunc
== 8 && IS_PREG (1, poprnd
))
776 OUTS (outf
, "JUMP (PC + ");
777 OUTS (outf
, pregs (poprnd
));
780 else if (prgfunc
== 9)
782 OUTS (outf
, "RAISE ");
783 OUTS (outf
, uimm4 (poprnd
));
785 else if (prgfunc
== 10)
787 OUTS (outf
, "EXCPT ");
788 OUTS (outf
, uimm4 (poprnd
));
790 else if (prgfunc
== 11 && IS_PREG (1, poprnd
) && poprnd
<= 5)
792 OUTS (outf
, "TESTSET (");
793 OUTS (outf
, pregs (poprnd
));
802 decode_CaCTRL_0 (TIword iw0
, disassemble_info
*outf
)
805 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
806 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 |.a.|.op....|.reg.......|
807 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
808 int a
= ((iw0
>> CaCTRL_a_bits
) & CaCTRL_a_mask
);
809 int op
= ((iw0
>> CaCTRL_op_bits
) & CaCTRL_op_mask
);
810 int reg
= ((iw0
>> CaCTRL_reg_bits
) & CaCTRL_reg_mask
);
815 if (a
== 0 && op
== 0)
817 OUTS (outf
, "PREFETCH[");
818 OUTS (outf
, pregs (reg
));
821 else if (a
== 0 && op
== 1)
823 OUTS (outf
, "FLUSHINV[");
824 OUTS (outf
, pregs (reg
));
827 else if (a
== 0 && op
== 2)
829 OUTS (outf
, "FLUSH[");
830 OUTS (outf
, pregs (reg
));
833 else if (a
== 0 && op
== 3)
835 OUTS (outf
, "IFLUSH[");
836 OUTS (outf
, pregs (reg
));
839 else if (a
== 1 && op
== 0)
841 OUTS (outf
, "PREFETCH[");
842 OUTS (outf
, pregs (reg
));
845 else if (a
== 1 && op
== 1)
847 OUTS (outf
, "FLUSHINV[");
848 OUTS (outf
, pregs (reg
));
851 else if (a
== 1 && op
== 2)
853 OUTS (outf
, "FLUSH[");
854 OUTS (outf
, pregs (reg
));
857 else if (a
== 1 && op
== 3)
859 OUTS (outf
, "IFLUSH[");
860 OUTS (outf
, pregs (reg
));
869 decode_PushPopReg_0 (TIword iw0
, disassemble_info
*outf
)
872 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
873 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |.W.|.grp.......|.reg.......|
874 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
875 int W
= ((iw0
>> PushPopReg_W_bits
) & PushPopReg_W_mask
);
876 int grp
= ((iw0
>> PushPopReg_grp_bits
) & PushPopReg_grp_mask
);
877 int reg
= ((iw0
>> PushPopReg_reg_bits
) & PushPopReg_reg_mask
);
882 if (W
== 0 && mostreg (reg
, grp
))
884 OUTS (outf
, allregs (reg
, grp
));
885 OUTS (outf
, " = [SP++]");
887 else if (W
== 1 && allreg (reg
, grp
) && !(grp
== 1 && reg
== 6))
889 OUTS (outf
, "[--SP] = ");
890 OUTS (outf
, allregs (reg
, grp
));
898 decode_PushPopMultiple_0 (TIword iw0
, disassemble_info
*outf
)
901 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
902 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |.d.|.p.|.W.|.dr........|.pr........|
903 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
904 int p
= ((iw0
>> PushPopMultiple_p_bits
) & PushPopMultiple_p_mask
);
905 int d
= ((iw0
>> PushPopMultiple_d_bits
) & PushPopMultiple_d_mask
);
906 int W
= ((iw0
>> PushPopMultiple_W_bits
) & PushPopMultiple_W_mask
);
907 int dr
= ((iw0
>> PushPopMultiple_dr_bits
) & PushPopMultiple_dr_mask
);
908 int pr
= ((iw0
>> PushPopMultiple_pr_bits
) & PushPopMultiple_pr_mask
);
916 if (W
== 1 && d
== 1 && p
== 1)
918 OUTS (outf
, "[--SP] = (R7:");
919 OUTS (outf
, imm5d (dr
));
920 OUTS (outf
, ", P5:");
921 OUTS (outf
, imm5d (pr
));
924 else if (W
== 1 && d
== 1 && p
== 0 && pr
== 0)
926 OUTS (outf
, "[--SP] = (R7:");
927 OUTS (outf
, imm5d (dr
));
930 else if (W
== 1 && d
== 0 && p
== 1 && dr
== 0)
932 OUTS (outf
, "[--SP] = (P5:");
933 OUTS (outf
, imm5d (pr
));
936 else if (W
== 0 && d
== 1 && p
== 1)
939 OUTS (outf
, imm5d (dr
));
940 OUTS (outf
, ", P5:");
941 OUTS (outf
, imm5d (pr
));
942 OUTS (outf
, ") = [SP++]");
944 else if (W
== 0 && d
== 1 && p
== 0 && pr
== 0)
947 OUTS (outf
, imm5d (dr
));
948 OUTS (outf
, ") = [SP++]");
950 else if (W
== 0 && d
== 0 && p
== 1 && dr
== 0)
953 OUTS (outf
, imm5d (pr
));
954 OUTS (outf
, ") = [SP++]");
962 decode_ccMV_0 (TIword iw0
, disassemble_info
*outf
)
965 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
966 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |.T.|.d.|.s.|.dst.......|.src.......|
967 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
968 int s
= ((iw0
>> CCmv_s_bits
) & CCmv_s_mask
);
969 int d
= ((iw0
>> CCmv_d_bits
) & CCmv_d_mask
);
970 int T
= ((iw0
>> CCmv_T_bits
) & CCmv_T_mask
);
971 int src
= ((iw0
>> CCmv_src_bits
) & CCmv_src_mask
);
972 int dst
= ((iw0
>> CCmv_dst_bits
) & CCmv_dst_mask
);
979 OUTS (outf
, "IF CC ");
980 OUTS (outf
, gregs (dst
, d
));
982 OUTS (outf
, gregs (src
, s
));
986 OUTS (outf
, "IF !CC ");
987 OUTS (outf
, gregs (dst
, d
));
989 OUTS (outf
, gregs (src
, s
));
997 decode_CCflag_0 (TIword iw0
, disassemble_info
*outf
)
1000 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1001 | 0 | 0 | 0 | 0 | 1 |.I.|.opc.......|.G.|.y.........|.x.........|
1002 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1003 int x
= ((iw0
>> CCflag_x_bits
) & CCflag_x_mask
);
1004 int y
= ((iw0
>> CCflag_y_bits
) & CCflag_y_mask
);
1005 int I
= ((iw0
>> CCflag_I_bits
) & CCflag_I_mask
);
1006 int G
= ((iw0
>> CCflag_G_bits
) & CCflag_G_mask
);
1007 int opc
= ((iw0
>> CCflag_opc_bits
) & CCflag_opc_mask
);
1012 if (opc
== 0 && I
== 0 && G
== 0)
1014 OUTS (outf
, "CC = ");
1015 OUTS (outf
, dregs (x
));
1016 OUTS (outf
, " == ");
1017 OUTS (outf
, dregs (y
));
1019 else if (opc
== 1 && I
== 0 && G
== 0)
1021 OUTS (outf
, "CC = ");
1022 OUTS (outf
, dregs (x
));
1024 OUTS (outf
, dregs (y
));
1026 else if (opc
== 2 && I
== 0 && G
== 0)
1028 OUTS (outf
, "CC = ");
1029 OUTS (outf
, dregs (x
));
1030 OUTS (outf
, " <= ");
1031 OUTS (outf
, dregs (y
));
1033 else if (opc
== 3 && I
== 0 && G
== 0)
1035 OUTS (outf
, "CC = ");
1036 OUTS (outf
, dregs (x
));
1038 OUTS (outf
, dregs (y
));
1039 OUTS (outf
, " (IU)");
1041 else if (opc
== 4 && I
== 0 && G
== 0)
1043 OUTS (outf
, "CC = ");
1044 OUTS (outf
, dregs (x
));
1045 OUTS (outf
, " <= ");
1046 OUTS (outf
, dregs (y
));
1047 OUTS (outf
, " (IU)");
1049 else if (opc
== 0 && I
== 1 && G
== 0)
1051 OUTS (outf
, "CC = ");
1052 OUTS (outf
, dregs (x
));
1053 OUTS (outf
, " == ");
1054 OUTS (outf
, imm3 (y
));
1056 else if (opc
== 1 && I
== 1 && G
== 0)
1058 OUTS (outf
, "CC = ");
1059 OUTS (outf
, dregs (x
));
1061 OUTS (outf
, imm3 (y
));
1063 else if (opc
== 2 && I
== 1 && G
== 0)
1065 OUTS (outf
, "CC = ");
1066 OUTS (outf
, dregs (x
));
1067 OUTS (outf
, " <= ");
1068 OUTS (outf
, imm3 (y
));
1070 else if (opc
== 3 && I
== 1 && G
== 0)
1072 OUTS (outf
, "CC = ");
1073 OUTS (outf
, dregs (x
));
1075 OUTS (outf
, uimm3 (y
));
1076 OUTS (outf
, " (IU)");
1078 else if (opc
== 4 && I
== 1 && G
== 0)
1080 OUTS (outf
, "CC = ");
1081 OUTS (outf
, dregs (x
));
1082 OUTS (outf
, " <= ");
1083 OUTS (outf
, uimm3 (y
));
1084 OUTS (outf
, " (IU)");
1086 else if (opc
== 0 && I
== 0 && G
== 1)
1088 OUTS (outf
, "CC = ");
1089 OUTS (outf
, pregs (x
));
1090 OUTS (outf
, " == ");
1091 OUTS (outf
, pregs (y
));
1093 else if (opc
== 1 && I
== 0 && G
== 1)
1095 OUTS (outf
, "CC = ");
1096 OUTS (outf
, pregs (x
));
1098 OUTS (outf
, pregs (y
));
1100 else if (opc
== 2 && I
== 0 && G
== 1)
1102 OUTS (outf
, "CC = ");
1103 OUTS (outf
, pregs (x
));
1104 OUTS (outf
, " <= ");
1105 OUTS (outf
, pregs (y
));
1107 else if (opc
== 3 && I
== 0 && G
== 1)
1109 OUTS (outf
, "CC = ");
1110 OUTS (outf
, pregs (x
));
1112 OUTS (outf
, pregs (y
));
1113 OUTS (outf
, " (IU)");
1115 else if (opc
== 4 && I
== 0 && G
== 1)
1117 OUTS (outf
, "CC = ");
1118 OUTS (outf
, pregs (x
));
1119 OUTS (outf
, " <= ");
1120 OUTS (outf
, pregs (y
));
1121 OUTS (outf
, " (IU)");
1123 else if (opc
== 0 && I
== 1 && G
== 1)
1125 OUTS (outf
, "CC = ");
1126 OUTS (outf
, pregs (x
));
1127 OUTS (outf
, " == ");
1128 OUTS (outf
, imm3 (y
));
1130 else if (opc
== 1 && I
== 1 && G
== 1)
1132 OUTS (outf
, "CC = ");
1133 OUTS (outf
, pregs (x
));
1135 OUTS (outf
, imm3 (y
));
1137 else if (opc
== 2 && I
== 1 && G
== 1)
1139 OUTS (outf
, "CC = ");
1140 OUTS (outf
, pregs (x
));
1141 OUTS (outf
, " <= ");
1142 OUTS (outf
, imm3 (y
));
1144 else if (opc
== 3 && I
== 1 && G
== 1)
1146 OUTS (outf
, "CC = ");
1147 OUTS (outf
, pregs (x
));
1149 OUTS (outf
, uimm3 (y
));
1150 OUTS (outf
, " (IU)");
1152 else if (opc
== 4 && I
== 1 && G
== 1)
1154 OUTS (outf
, "CC = ");
1155 OUTS (outf
, pregs (x
));
1156 OUTS (outf
, " <= ");
1157 OUTS (outf
, uimm3 (y
));
1158 OUTS (outf
, " (IU)");
1160 else if (opc
== 5 && I
== 0 && G
== 0 && x
== 0 && y
== 0)
1161 OUTS (outf
, "CC = A0 == A1");
1163 else if (opc
== 6 && I
== 0 && G
== 0 && x
== 0 && y
== 0)
1164 OUTS (outf
, "CC = A0 < A1");
1166 else if (opc
== 7 && I
== 0 && G
== 0 && x
== 0 && y
== 0)
1167 OUTS (outf
, "CC = A0 <= A1");
1175 decode_CC2dreg_0 (TIword iw0
, disassemble_info
*outf
)
1178 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1179 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |.op....|.reg.......|
1180 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1181 int op
= ((iw0
>> CC2dreg_op_bits
) & CC2dreg_op_mask
);
1182 int reg
= ((iw0
>> CC2dreg_reg_bits
) & CC2dreg_reg_mask
);
1189 OUTS (outf
, dregs (reg
));
1190 OUTS (outf
, " = CC");
1194 OUTS (outf
, "CC = ");
1195 OUTS (outf
, dregs (reg
));
1197 else if (op
== 3 && reg
== 0)
1198 OUTS (outf
, "CC = !CC");
1206 decode_CC2stat_0 (TIword iw0
, disassemble_info
*outf
)
1209 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1210 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |.D.|.op....|.cbit..............|
1211 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1212 int D
= ((iw0
>> CC2stat_D_bits
) & CC2stat_D_mask
);
1213 int op
= ((iw0
>> CC2stat_op_bits
) & CC2stat_op_mask
);
1214 int cbit
= ((iw0
>> CC2stat_cbit_bits
) & CC2stat_cbit_mask
);
1216 const char *bitname
= statbits (cbit
);
1221 if (decode_statbits
[cbit
] == REG_LASTREG
)
1223 /* All ASTAT bits except CC may be operated on in hardware, but may
1224 not have a dedicated insn, so still decode "valid" insns. */
1225 static char bitnames
[64];
1227 sprintf (bitnames
, "ASTAT[%i /* unused bit */]", cbit
);
1234 if (op
== 0 && D
== 0)
1236 OUTS (outf
, "CC = ");
1237 OUTS (outf
, bitname
);
1239 else if (op
== 1 && D
== 0)
1241 OUTS (outf
, "CC |= ");
1242 OUTS (outf
, bitname
);
1244 else if (op
== 2 && D
== 0)
1246 OUTS (outf
, "CC &= ");
1247 OUTS (outf
, bitname
);
1249 else if (op
== 3 && D
== 0)
1251 OUTS (outf
, "CC ^= ");
1252 OUTS (outf
, bitname
);
1254 else if (op
== 0 && D
== 1)
1256 OUTS (outf
, bitname
);
1257 OUTS (outf
, " = CC");
1259 else if (op
== 1 && D
== 1)
1261 OUTS (outf
, bitname
);
1262 OUTS (outf
, " |= CC");
1264 else if (op
== 2 && D
== 1)
1266 OUTS (outf
, bitname
);
1267 OUTS (outf
, " &= CC");
1269 else if (op
== 3 && D
== 1)
1271 OUTS (outf
, bitname
);
1272 OUTS (outf
, " ^= CC");
1281 decode_BRCC_0 (TIword iw0
, bfd_vma pc
, disassemble_info
*outf
)
1284 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1285 | 0 | 0 | 0 | 1 |.T.|.B.|.offset................................|
1286 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1287 int B
= ((iw0
>> BRCC_B_bits
) & BRCC_B_mask
);
1288 int T
= ((iw0
>> BRCC_T_bits
) & BRCC_T_mask
);
1289 int offset
= ((iw0
>> BRCC_offset_bits
) & BRCC_offset_mask
);
1294 if (T
== 1 && B
== 1)
1296 OUTS (outf
, "IF CC JUMP 0x");
1297 OUTS (outf
, pcrel10 (offset
));
1298 OUTS (outf
, " (BP)");
1300 else if (T
== 0 && B
== 1)
1302 OUTS (outf
, "IF !CC JUMP 0x");
1303 OUTS (outf
, pcrel10 (offset
));
1304 OUTS (outf
, " (BP)");
1308 OUTS (outf
, "IF CC JUMP 0x");
1309 OUTS (outf
, pcrel10 (offset
));
1313 OUTS (outf
, "IF !CC JUMP 0x");
1314 OUTS (outf
, pcrel10 (offset
));
1323 decode_UJUMP_0 (TIword iw0
, bfd_vma pc
, disassemble_info
*outf
)
1326 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1327 | 0 | 0 | 1 | 0 |.offset........................................|
1328 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1329 int offset
= ((iw0
>> UJump_offset_bits
) & UJump_offset_mask
);
1334 OUTS (outf
, "JUMP.S 0x");
1335 OUTS (outf
, pcrel12 (offset
));
1340 decode_REGMV_0 (TIword iw0
, disassemble_info
*outf
)
1343 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1344 | 0 | 0 | 1 | 1 |.gd........|.gs........|.dst.......|.src.......|
1345 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1346 int gs
= ((iw0
>> RegMv_gs_bits
) & RegMv_gs_mask
);
1347 int gd
= ((iw0
>> RegMv_gd_bits
) & RegMv_gd_mask
);
1348 int src
= ((iw0
>> RegMv_src_bits
) & RegMv_src_mask
);
1349 int dst
= ((iw0
>> RegMv_dst_bits
) & RegMv_dst_mask
);
1351 /* Reserved slots cannot be a src/dst. */
1352 if (IS_RESERVEDREG (gs
, src
) || IS_RESERVEDREG (gd
, dst
))
1355 /* Standard register moves */
1356 if ((gs
< 2) || /* Dregs/Pregs as source */
1357 (gd
< 2) || /* Dregs/Pregs as dest */
1358 (gs
== 4 && src
< 4) || /* Accumulators as source */
1359 (gd
== 4 && dst
< 4 && (gs
< 4)) || /* Accumulators as dest */
1360 (gs
== 7 && src
== 7 && !(gd
== 4 && dst
< 4)) || /* EMUDAT as src */
1361 (gd
== 7 && dst
== 7)) /* EMUDAT as dest */
1364 /* dareg = dareg (IMBL) */
1365 if (gs
< 4 && gd
< 4)
1368 /* USP can be src to sysregs, but not dagregs. */
1369 if ((gs
== 7 && src
== 0) && (gd
>= 4))
1372 /* USP can move between genregs (only check Accumulators). */
1373 if (((gs
== 7 && src
== 0) && (gd
== 4 && dst
< 4)) ||
1374 ((gd
== 7 && dst
== 0) && (gs
== 4 && src
< 4)))
1377 /* Still here ? Invalid reg pair. */
1382 OUTS (outf
, allregs (dst
, gd
));
1384 OUTS (outf
, allregs (src
, gs
));
1389 decode_ALU2op_0 (TIword iw0
, disassemble_info
*outf
)
1392 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1393 | 0 | 1 | 0 | 0 | 0 | 0 |.opc...........|.src.......|.dst.......|
1394 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1395 int src
= ((iw0
>> ALU2op_src_bits
) & ALU2op_src_mask
);
1396 int opc
= ((iw0
>> ALU2op_opc_bits
) & ALU2op_opc_mask
);
1397 int dst
= ((iw0
>> ALU2op_dst_bits
) & ALU2op_dst_mask
);
1401 OUTS (outf
, dregs (dst
));
1402 OUTS (outf
, " >>>= ");
1403 OUTS (outf
, dregs (src
));
1407 OUTS (outf
, dregs (dst
));
1408 OUTS (outf
, " >>= ");
1409 OUTS (outf
, dregs (src
));
1413 OUTS (outf
, dregs (dst
));
1414 OUTS (outf
, " <<= ");
1415 OUTS (outf
, dregs (src
));
1419 OUTS (outf
, dregs (dst
));
1420 OUTS (outf
, " *= ");
1421 OUTS (outf
, dregs (src
));
1425 OUTS (outf
, dregs (dst
));
1426 OUTS (outf
, " = (");
1427 OUTS (outf
, dregs (dst
));
1429 OUTS (outf
, dregs (src
));
1430 OUTS (outf
, ") << 0x1");
1434 OUTS (outf
, dregs (dst
));
1435 OUTS (outf
, " = (");
1436 OUTS (outf
, dregs (dst
));
1438 OUTS (outf
, dregs (src
));
1439 OUTS (outf
, ") << 0x2");
1443 OUTS (outf
, "DIVQ (");
1444 OUTS (outf
, dregs (dst
));
1446 OUTS (outf
, dregs (src
));
1451 OUTS (outf
, "DIVS (");
1452 OUTS (outf
, dregs (dst
));
1454 OUTS (outf
, dregs (src
));
1459 OUTS (outf
, dregs (dst
));
1461 OUTS (outf
, dregs_lo (src
));
1462 OUTS (outf
, " (X)");
1466 OUTS (outf
, dregs (dst
));
1468 OUTS (outf
, dregs_lo (src
));
1469 OUTS (outf
, " (Z)");
1473 OUTS (outf
, dregs (dst
));
1475 OUTS (outf
, dregs_byte (src
));
1476 OUTS (outf
, " (X)");
1480 OUTS (outf
, dregs (dst
));
1482 OUTS (outf
, dregs_byte (src
));
1483 OUTS (outf
, " (Z)");
1487 OUTS (outf
, dregs (dst
));
1488 OUTS (outf
, " = -");
1489 OUTS (outf
, dregs (src
));
1493 OUTS (outf
, dregs (dst
));
1494 OUTS (outf
, " =~ ");
1495 OUTS (outf
, dregs (src
));
1504 decode_PTR2op_0 (TIword iw0
, disassemble_info
*outf
)
1507 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1508 | 0 | 1 | 0 | 0 | 0 | 1 | 0 |.opc.......|.src.......|.dst.......|
1509 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1510 int src
= ((iw0
>> PTR2op_src_bits
) & PTR2op_dst_mask
);
1511 int opc
= ((iw0
>> PTR2op_opc_bits
) & PTR2op_opc_mask
);
1512 int dst
= ((iw0
>> PTR2op_dst_bits
) & PTR2op_dst_mask
);
1516 OUTS (outf
, pregs (dst
));
1517 OUTS (outf
, " -= ");
1518 OUTS (outf
, pregs (src
));
1522 OUTS (outf
, pregs (dst
));
1524 OUTS (outf
, pregs (src
));
1525 OUTS (outf
, " << 0x2");
1529 OUTS (outf
, pregs (dst
));
1531 OUTS (outf
, pregs (src
));
1532 OUTS (outf
, " >> 0x2");
1536 OUTS (outf
, pregs (dst
));
1538 OUTS (outf
, pregs (src
));
1539 OUTS (outf
, " >> 0x1");
1543 OUTS (outf
, pregs (dst
));
1544 OUTS (outf
, " += ");
1545 OUTS (outf
, pregs (src
));
1546 OUTS (outf
, " (BREV)");
1550 OUTS (outf
, pregs (dst
));
1551 OUTS (outf
, " = (");
1552 OUTS (outf
, pregs (dst
));
1554 OUTS (outf
, pregs (src
));
1555 OUTS (outf
, ") << 0x1");
1559 OUTS (outf
, pregs (dst
));
1560 OUTS (outf
, " = (");
1561 OUTS (outf
, pregs (dst
));
1563 OUTS (outf
, pregs (src
));
1564 OUTS (outf
, ") << 0x2");
1573 decode_LOGI2op_0 (TIword iw0
, disassemble_info
*outf
)
1576 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1577 | 0 | 1 | 0 | 0 | 1 |.opc.......|.src...............|.dst.......|
1578 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1579 int src
= ((iw0
>> LOGI2op_src_bits
) & LOGI2op_src_mask
);
1580 int opc
= ((iw0
>> LOGI2op_opc_bits
) & LOGI2op_opc_mask
);
1581 int dst
= ((iw0
>> LOGI2op_dst_bits
) & LOGI2op_dst_mask
);
1588 OUTS (outf
, "CC = !BITTST (");
1589 OUTS (outf
, dregs (dst
));
1591 OUTS (outf
, uimm5 (src
));
1592 OUTS (outf
, ");\t\t/* bit");
1593 OUTS (outf
, imm7d (src
));
1599 OUTS (outf
, "CC = BITTST (");
1600 OUTS (outf
, dregs (dst
));
1602 OUTS (outf
, uimm5 (src
));
1603 OUTS (outf
, ");\t\t/* bit");
1604 OUTS (outf
, imm7d (src
));
1610 OUTS (outf
, "BITSET (");
1611 OUTS (outf
, dregs (dst
));
1613 OUTS (outf
, uimm5 (src
));
1614 OUTS (outf
, ");\t\t/* bit");
1615 OUTS (outf
, imm7d (src
));
1621 OUTS (outf
, "BITTGL (");
1622 OUTS (outf
, dregs (dst
));
1624 OUTS (outf
, uimm5 (src
));
1625 OUTS (outf
, ");\t\t/* bit");
1626 OUTS (outf
, imm7d (src
));
1632 OUTS (outf
, "BITCLR (");
1633 OUTS (outf
, dregs (dst
));
1635 OUTS (outf
, uimm5 (src
));
1636 OUTS (outf
, ");\t\t/* bit");
1637 OUTS (outf
, imm7d (src
));
1643 OUTS (outf
, dregs (dst
));
1644 OUTS (outf
, " >>>= ");
1645 OUTS (outf
, uimm5 (src
));
1649 OUTS (outf
, dregs (dst
));
1650 OUTS (outf
, " >>= ");
1651 OUTS (outf
, uimm5 (src
));
1655 OUTS (outf
, dregs (dst
));
1656 OUTS (outf
, " <<= ");
1657 OUTS (outf
, uimm5 (src
));
1666 decode_COMP3op_0 (TIword iw0
, disassemble_info
*outf
)
1669 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1670 | 0 | 1 | 0 | 1 |.opc.......|.dst.......|.src1......|.src0......|
1671 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1672 int opc
= ((iw0
>> COMP3op_opc_bits
) & COMP3op_opc_mask
);
1673 int dst
= ((iw0
>> COMP3op_dst_bits
) & COMP3op_dst_mask
);
1674 int src0
= ((iw0
>> COMP3op_src0_bits
) & COMP3op_src0_mask
);
1675 int src1
= ((iw0
>> COMP3op_src1_bits
) & COMP3op_src1_mask
);
1677 if (opc
== 5 && src1
== src0
)
1679 OUTS (outf
, pregs (dst
));
1681 OUTS (outf
, pregs (src0
));
1682 OUTS (outf
, " << 0x1");
1686 OUTS (outf
, dregs (dst
));
1688 OUTS (outf
, dregs (src0
));
1690 OUTS (outf
, dregs (src1
));
1694 OUTS (outf
, dregs (dst
));
1696 OUTS (outf
, dregs (src0
));
1698 OUTS (outf
, dregs (src1
));
1702 OUTS (outf
, dregs (dst
));
1704 OUTS (outf
, dregs (src0
));
1706 OUTS (outf
, dregs (src1
));
1710 OUTS (outf
, dregs (dst
));
1712 OUTS (outf
, dregs (src0
));
1714 OUTS (outf
, dregs (src1
));
1718 OUTS (outf
, pregs (dst
));
1720 OUTS (outf
, pregs (src0
));
1722 OUTS (outf
, pregs (src1
));
1726 OUTS (outf
, pregs (dst
));
1728 OUTS (outf
, pregs (src0
));
1729 OUTS (outf
, " + (");
1730 OUTS (outf
, pregs (src1
));
1731 OUTS (outf
, " << 0x1)");
1735 OUTS (outf
, pregs (dst
));
1737 OUTS (outf
, pregs (src0
));
1738 OUTS (outf
, " + (");
1739 OUTS (outf
, pregs (src1
));
1740 OUTS (outf
, " << 0x2)");
1744 OUTS (outf
, dregs (dst
));
1746 OUTS (outf
, dregs (src0
));
1748 OUTS (outf
, dregs (src1
));
1757 decode_COMPI2opD_0 (TIword iw0
, disassemble_info
*outf
)
1760 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1761 | 0 | 1 | 1 | 0 | 0 |.op|..src......................|.dst.......|
1762 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1763 int op
= ((iw0
>> COMPI2opD_op_bits
) & COMPI2opD_op_mask
);
1764 int dst
= ((iw0
>> COMPI2opD_dst_bits
) & COMPI2opD_dst_mask
);
1765 int src
= ((iw0
>> COMPI2opD_src_bits
) & COMPI2opD_src_mask
);
1767 bu32
*pval
= get_allreg (0, dst
);
1772 /* Since we don't have 32-bit immediate loads, we allow the disassembler
1773 to combine them, so it prints out the right values.
1774 Here we keep track of the registers. */
1777 *pval
= imm7_val (src
);
1779 *pval
|= 0xFFFFFF80;
1786 OUTS (outf
, dregs (dst
));
1788 OUTS (outf
, imm7 (src
));
1789 OUTS (outf
, " (X);\t\t/*\t\t");
1790 OUTS (outf
, dregs (dst
));
1792 OUTS (outf
, uimm32 (*pval
));
1794 OUTS (outf
, imm32 (*pval
));
1795 OUTS (outf
, ") */");
1800 OUTS (outf
, dregs (dst
));
1801 OUTS (outf
, " += ");
1802 OUTS (outf
, imm7 (src
));
1803 OUTS (outf
, ";\t\t/* (");
1804 OUTS (outf
, imm7d (src
));
1805 OUTS (outf
, ") */");
1815 decode_COMPI2opP_0 (TIword iw0
, disassemble_info
*outf
)
1818 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1819 | 0 | 1 | 1 | 0 | 1 |.op|.src.......................|.dst.......|
1820 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1821 int op
= ((iw0
>> COMPI2opP_op_bits
) & COMPI2opP_op_mask
);
1822 int src
= ((iw0
>> COMPI2opP_src_bits
) & COMPI2opP_src_mask
);
1823 int dst
= ((iw0
>> COMPI2opP_dst_bits
) & COMPI2opP_dst_mask
);
1825 bu32
*pval
= get_allreg (1, dst
);
1832 *pval
= imm7_val (src
);
1834 *pval
|= 0xFFFFFF80;
1841 OUTS (outf
, pregs (dst
));
1843 OUTS (outf
, imm7 (src
));
1844 OUTS (outf
, " (X);\t\t/*\t\t");
1845 OUTS (outf
, pregs (dst
));
1847 OUTS (outf
, uimm32 (*pval
));
1849 OUTS (outf
, imm32 (*pval
));
1850 OUTS (outf
, ") */");
1855 OUTS (outf
, pregs (dst
));
1856 OUTS (outf
, " += ");
1857 OUTS (outf
, imm7 (src
));
1858 OUTS (outf
, ";\t\t/* (");
1859 OUTS (outf
, imm7d (src
));
1860 OUTS (outf
, ") */");
1870 decode_LDSTpmod_0 (TIword iw0
, disassemble_info
*outf
)
1873 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1874 | 1 | 0 | 0 | 0 |.W.|.aop...|.reg.......|.idx.......|.ptr.......|
1875 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1876 int W
= ((iw0
>> LDSTpmod_W_bits
) & LDSTpmod_W_mask
);
1877 int aop
= ((iw0
>> LDSTpmod_aop_bits
) & LDSTpmod_aop_mask
);
1878 int idx
= ((iw0
>> LDSTpmod_idx_bits
) & LDSTpmod_idx_mask
);
1879 int ptr
= ((iw0
>> LDSTpmod_ptr_bits
) & LDSTpmod_ptr_mask
);
1880 int reg
= ((iw0
>> LDSTpmod_reg_bits
) & LDSTpmod_reg_mask
);
1882 if (aop
== 1 && W
== 0 && idx
== ptr
)
1884 OUTS (outf
, dregs_lo (reg
));
1885 OUTS (outf
, " = W[");
1886 OUTS (outf
, pregs (ptr
));
1889 else if (aop
== 2 && W
== 0 && idx
== ptr
)
1891 OUTS (outf
, dregs_hi (reg
));
1892 OUTS (outf
, " = W[");
1893 OUTS (outf
, pregs (ptr
));
1896 else if (aop
== 1 && W
== 1 && idx
== ptr
)
1899 OUTS (outf
, pregs (ptr
));
1900 OUTS (outf
, "] = ");
1901 OUTS (outf
, dregs_lo (reg
));
1903 else if (aop
== 2 && W
== 1 && idx
== ptr
)
1906 OUTS (outf
, pregs (ptr
));
1907 OUTS (outf
, "] = ");
1908 OUTS (outf
, dregs_hi (reg
));
1910 else if (aop
== 0 && W
== 0)
1912 OUTS (outf
, dregs (reg
));
1913 OUTS (outf
, " = [");
1914 OUTS (outf
, pregs (ptr
));
1915 OUTS (outf
, " ++ ");
1916 OUTS (outf
, pregs (idx
));
1919 else if (aop
== 1 && W
== 0)
1921 OUTS (outf
, dregs_lo (reg
));
1922 OUTS (outf
, " = W[");
1923 OUTS (outf
, pregs (ptr
));
1924 OUTS (outf
, " ++ ");
1925 OUTS (outf
, pregs (idx
));
1928 else if (aop
== 2 && W
== 0)
1930 OUTS (outf
, dregs_hi (reg
));
1931 OUTS (outf
, " = W[");
1932 OUTS (outf
, pregs (ptr
));
1933 OUTS (outf
, " ++ ");
1934 OUTS (outf
, pregs (idx
));
1937 else if (aop
== 3 && W
== 0)
1939 OUTS (outf
, dregs (reg
));
1940 OUTS (outf
, " = W[");
1941 OUTS (outf
, pregs (ptr
));
1942 OUTS (outf
, " ++ ");
1943 OUTS (outf
, pregs (idx
));
1944 OUTS (outf
, "] (Z)");
1946 else if (aop
== 3 && W
== 1)
1948 OUTS (outf
, dregs (reg
));
1949 OUTS (outf
, " = W[");
1950 OUTS (outf
, pregs (ptr
));
1951 OUTS (outf
, " ++ ");
1952 OUTS (outf
, pregs (idx
));
1953 OUTS (outf
, "] (X)");
1955 else if (aop
== 0 && W
== 1)
1958 OUTS (outf
, pregs (ptr
));
1959 OUTS (outf
, " ++ ");
1960 OUTS (outf
, pregs (idx
));
1961 OUTS (outf
, "] = ");
1962 OUTS (outf
, dregs (reg
));
1964 else if (aop
== 1 && W
== 1)
1967 OUTS (outf
, pregs (ptr
));
1968 OUTS (outf
, " ++ ");
1969 OUTS (outf
, pregs (idx
));
1970 OUTS (outf
, "] = ");
1971 OUTS (outf
, dregs_lo (reg
));
1973 else if (aop
== 2 && W
== 1)
1976 OUTS (outf
, pregs (ptr
));
1977 OUTS (outf
, " ++ ");
1978 OUTS (outf
, pregs (idx
));
1979 OUTS (outf
, "] = ");
1980 OUTS (outf
, dregs_hi (reg
));
1989 decode_dagMODim_0 (TIword iw0
, disassemble_info
*outf
)
1992 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1993 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 0 |.br| 1 | 1 |.op|.m.....|.i.....|
1994 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1995 int i
= ((iw0
>> DagMODim_i_bits
) & DagMODim_i_mask
);
1996 int m
= ((iw0
>> DagMODim_m_bits
) & DagMODim_m_mask
);
1997 int br
= ((iw0
>> DagMODim_br_bits
) & DagMODim_br_mask
);
1998 int op
= ((iw0
>> DagMODim_op_bits
) & DagMODim_op_mask
);
2000 if (op
== 0 && br
== 1)
2002 OUTS (outf
, iregs (i
));
2003 OUTS (outf
, " += ");
2004 OUTS (outf
, mregs (m
));
2005 OUTS (outf
, " (BREV)");
2009 OUTS (outf
, iregs (i
));
2010 OUTS (outf
, " += ");
2011 OUTS (outf
, mregs (m
));
2013 else if (op
== 1 && br
== 0)
2015 OUTS (outf
, iregs (i
));
2016 OUTS (outf
, " -= ");
2017 OUTS (outf
, mregs (m
));
2026 decode_dagMODik_0 (TIword iw0
, disassemble_info
*outf
)
2029 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2030 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 0 |.op....|.i.....|
2031 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2032 int i
= ((iw0
>> DagMODik_i_bits
) & DagMODik_i_mask
);
2033 int op
= ((iw0
>> DagMODik_op_bits
) & DagMODik_op_mask
);
2037 OUTS (outf
, iregs (i
));
2038 OUTS (outf
, " += 0x2");
2042 OUTS (outf
, iregs (i
));
2043 OUTS (outf
, " -= 0x2");
2047 OUTS (outf
, iregs (i
));
2048 OUTS (outf
, " += 0x4");
2052 OUTS (outf
, iregs (i
));
2053 OUTS (outf
, " -= 0x4");
2060 OUTS (outf
, ";\t\t/* ( ");
2061 if (op
== 0 || op
== 1)
2063 else if (op
== 2 || op
== 3)
2065 OUTS (outf
, ") */");
2073 decode_dspLDST_0 (TIword iw0
, disassemble_info
*outf
)
2076 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2077 | 1 | 0 | 0 | 1 | 1 | 1 |.W.|.aop...|.m.....|.i.....|.reg.......|
2078 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2079 int i
= ((iw0
>> DspLDST_i_bits
) & DspLDST_i_mask
);
2080 int m
= ((iw0
>> DspLDST_m_bits
) & DspLDST_m_mask
);
2081 int W
= ((iw0
>> DspLDST_W_bits
) & DspLDST_W_mask
);
2082 int aop
= ((iw0
>> DspLDST_aop_bits
) & DspLDST_aop_mask
);
2083 int reg
= ((iw0
>> DspLDST_reg_bits
) & DspLDST_reg_mask
);
2085 if (aop
== 0 && W
== 0 && m
== 0)
2087 OUTS (outf
, dregs (reg
));
2088 OUTS (outf
, " = [");
2089 OUTS (outf
, iregs (i
));
2092 else if (aop
== 0 && W
== 0 && m
== 1)
2094 OUTS (outf
, dregs_lo (reg
));
2095 OUTS (outf
, " = W[");
2096 OUTS (outf
, iregs (i
));
2099 else if (aop
== 0 && W
== 0 && m
== 2)
2101 OUTS (outf
, dregs_hi (reg
));
2102 OUTS (outf
, " = W[");
2103 OUTS (outf
, iregs (i
));
2106 else if (aop
== 1 && W
== 0 && m
== 0)
2108 OUTS (outf
, dregs (reg
));
2109 OUTS (outf
, " = [");
2110 OUTS (outf
, iregs (i
));
2113 else if (aop
== 1 && W
== 0 && m
== 1)
2115 OUTS (outf
, dregs_lo (reg
));
2116 OUTS (outf
, " = W[");
2117 OUTS (outf
, iregs (i
));
2120 else if (aop
== 1 && W
== 0 && m
== 2)
2122 OUTS (outf
, dregs_hi (reg
));
2123 OUTS (outf
, " = W[");
2124 OUTS (outf
, iregs (i
));
2127 else if (aop
== 2 && W
== 0 && m
== 0)
2129 OUTS (outf
, dregs (reg
));
2130 OUTS (outf
, " = [");
2131 OUTS (outf
, iregs (i
));
2134 else if (aop
== 2 && W
== 0 && m
== 1)
2136 OUTS (outf
, dregs_lo (reg
));
2137 OUTS (outf
, " = W[");
2138 OUTS (outf
, iregs (i
));
2141 else if (aop
== 2 && W
== 0 && m
== 2)
2143 OUTS (outf
, dregs_hi (reg
));
2144 OUTS (outf
, " = W[");
2145 OUTS (outf
, iregs (i
));
2148 else if (aop
== 0 && W
== 1 && m
== 0)
2151 OUTS (outf
, iregs (i
));
2152 OUTS (outf
, "++] = ");
2153 OUTS (outf
, dregs (reg
));
2155 else if (aop
== 0 && W
== 1 && m
== 1)
2158 OUTS (outf
, iregs (i
));
2159 OUTS (outf
, "++] = ");
2160 OUTS (outf
, dregs_lo (reg
));
2162 else if (aop
== 0 && W
== 1 && m
== 2)
2165 OUTS (outf
, iregs (i
));
2166 OUTS (outf
, "++] = ");
2167 OUTS (outf
, dregs_hi (reg
));
2169 else if (aop
== 1 && W
== 1 && m
== 0)
2172 OUTS (outf
, iregs (i
));
2173 OUTS (outf
, "--] = ");
2174 OUTS (outf
, dregs (reg
));
2176 else if (aop
== 1 && W
== 1 && m
== 1)
2179 OUTS (outf
, iregs (i
));
2180 OUTS (outf
, "--] = ");
2181 OUTS (outf
, dregs_lo (reg
));
2183 else if (aop
== 1 && W
== 1 && m
== 2)
2186 OUTS (outf
, iregs (i
));
2187 OUTS (outf
, "--] = ");
2188 OUTS (outf
, dregs_hi (reg
));
2190 else if (aop
== 2 && W
== 1 && m
== 0)
2193 OUTS (outf
, iregs (i
));
2194 OUTS (outf
, "] = ");
2195 OUTS (outf
, dregs (reg
));
2197 else if (aop
== 2 && W
== 1 && m
== 1)
2200 OUTS (outf
, iregs (i
));
2201 OUTS (outf
, "] = ");
2202 OUTS (outf
, dregs_lo (reg
));
2204 else if (aop
== 2 && W
== 1 && m
== 2)
2207 OUTS (outf
, iregs (i
));
2208 OUTS (outf
, "] = ");
2209 OUTS (outf
, dregs_hi (reg
));
2211 else if (aop
== 3 && W
== 0)
2213 OUTS (outf
, dregs (reg
));
2214 OUTS (outf
, " = [");
2215 OUTS (outf
, iregs (i
));
2216 OUTS (outf
, " ++ ");
2217 OUTS (outf
, mregs (m
));
2220 else if (aop
== 3 && W
== 1)
2223 OUTS (outf
, iregs (i
));
2224 OUTS (outf
, " ++ ");
2225 OUTS (outf
, mregs (m
));
2226 OUTS (outf
, "] = ");
2227 OUTS (outf
, dregs (reg
));
2236 decode_LDST_0 (TIword iw0
, disassemble_info
*outf
)
2239 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2240 | 1 | 0 | 0 | 1 |.sz....|.W.|.aop...|.Z.|.ptr.......|.reg.......|
2241 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2242 int Z
= ((iw0
>> LDST_Z_bits
) & LDST_Z_mask
);
2243 int W
= ((iw0
>> LDST_W_bits
) & LDST_W_mask
);
2244 int sz
= ((iw0
>> LDST_sz_bits
) & LDST_sz_mask
);
2245 int aop
= ((iw0
>> LDST_aop_bits
) & LDST_aop_mask
);
2246 int reg
= ((iw0
>> LDST_reg_bits
) & LDST_reg_mask
);
2247 int ptr
= ((iw0
>> LDST_ptr_bits
) & LDST_ptr_mask
);
2249 if (aop
== 0 && sz
== 0 && Z
== 0 && W
== 0)
2251 OUTS (outf
, dregs (reg
));
2252 OUTS (outf
, " = [");
2253 OUTS (outf
, pregs (ptr
));
2256 else if (aop
== 0 && sz
== 0 && Z
== 1 && W
== 0 && reg
!= ptr
)
2258 OUTS (outf
, pregs (reg
));
2259 OUTS (outf
, " = [");
2260 OUTS (outf
, pregs (ptr
));
2263 else if (aop
== 0 && sz
== 1 && Z
== 0 && W
== 0)
2265 OUTS (outf
, dregs (reg
));
2266 OUTS (outf
, " = W[");
2267 OUTS (outf
, pregs (ptr
));
2268 OUTS (outf
, "++] (Z)");
2270 else if (aop
== 0 && sz
== 1 && Z
== 1 && W
== 0)
2272 OUTS (outf
, dregs (reg
));
2273 OUTS (outf
, " = W[");
2274 OUTS (outf
, pregs (ptr
));
2275 OUTS (outf
, "++] (X)");
2277 else if (aop
== 0 && sz
== 2 && Z
== 0 && W
== 0)
2279 OUTS (outf
, dregs (reg
));
2280 OUTS (outf
, " = B[");
2281 OUTS (outf
, pregs (ptr
));
2282 OUTS (outf
, "++] (Z)");
2284 else if (aop
== 0 && sz
== 2 && Z
== 1 && W
== 0)
2286 OUTS (outf
, dregs (reg
));
2287 OUTS (outf
, " = B[");
2288 OUTS (outf
, pregs (ptr
));
2289 OUTS (outf
, "++] (X)");
2291 else if (aop
== 1 && sz
== 0 && Z
== 0 && W
== 0)
2293 OUTS (outf
, dregs (reg
));
2294 OUTS (outf
, " = [");
2295 OUTS (outf
, pregs (ptr
));
2298 else if (aop
== 1 && sz
== 0 && Z
== 1 && W
== 0 && reg
!= ptr
)
2300 OUTS (outf
, pregs (reg
));
2301 OUTS (outf
, " = [");
2302 OUTS (outf
, pregs (ptr
));
2305 else if (aop
== 1 && sz
== 1 && Z
== 0 && W
== 0)
2307 OUTS (outf
, dregs (reg
));
2308 OUTS (outf
, " = W[");
2309 OUTS (outf
, pregs (ptr
));
2310 OUTS (outf
, "--] (Z)");
2312 else if (aop
== 1 && sz
== 1 && Z
== 1 && W
== 0)
2314 OUTS (outf
, dregs (reg
));
2315 OUTS (outf
, " = W[");
2316 OUTS (outf
, pregs (ptr
));
2317 OUTS (outf
, "--] (X)");
2319 else if (aop
== 1 && sz
== 2 && Z
== 0 && W
== 0)
2321 OUTS (outf
, dregs (reg
));
2322 OUTS (outf
, " = B[");
2323 OUTS (outf
, pregs (ptr
));
2324 OUTS (outf
, "--] (Z)");
2326 else if (aop
== 1 && sz
== 2 && Z
== 1 && W
== 0)
2328 OUTS (outf
, dregs (reg
));
2329 OUTS (outf
, " = B[");
2330 OUTS (outf
, pregs (ptr
));
2331 OUTS (outf
, "--] (X)");
2333 else if (aop
== 2 && sz
== 0 && Z
== 0 && W
== 0)
2335 OUTS (outf
, dregs (reg
));
2336 OUTS (outf
, " = [");
2337 OUTS (outf
, pregs (ptr
));
2340 else if (aop
== 2 && sz
== 0 && Z
== 1 && W
== 0)
2342 OUTS (outf
, pregs (reg
));
2343 OUTS (outf
, " = [");
2344 OUTS (outf
, pregs (ptr
));
2347 else if (aop
== 2 && sz
== 1 && Z
== 0 && W
== 0)
2349 OUTS (outf
, dregs (reg
));
2350 OUTS (outf
, " = W[");
2351 OUTS (outf
, pregs (ptr
));
2352 OUTS (outf
, "] (Z)");
2354 else if (aop
== 2 && sz
== 1 && Z
== 1 && W
== 0)
2356 OUTS (outf
, dregs (reg
));
2357 OUTS (outf
, " = W[");
2358 OUTS (outf
, pregs (ptr
));
2359 OUTS (outf
, "] (X)");
2361 else if (aop
== 2 && sz
== 2 && Z
== 0 && W
== 0)
2363 OUTS (outf
, dregs (reg
));
2364 OUTS (outf
, " = B[");
2365 OUTS (outf
, pregs (ptr
));
2366 OUTS (outf
, "] (Z)");
2368 else if (aop
== 2 && sz
== 2 && Z
== 1 && W
== 0)
2370 OUTS (outf
, dregs (reg
));
2371 OUTS (outf
, " = B[");
2372 OUTS (outf
, pregs (ptr
));
2373 OUTS (outf
, "] (X)");
2375 else if (aop
== 0 && sz
== 0 && Z
== 0 && W
== 1)
2378 OUTS (outf
, pregs (ptr
));
2379 OUTS (outf
, "++] = ");
2380 OUTS (outf
, dregs (reg
));
2382 else if (aop
== 0 && sz
== 0 && Z
== 1 && W
== 1)
2385 OUTS (outf
, pregs (ptr
));
2386 OUTS (outf
, "++] = ");
2387 OUTS (outf
, pregs (reg
));
2389 else if (aop
== 0 && sz
== 1 && Z
== 0 && W
== 1)
2392 OUTS (outf
, pregs (ptr
));
2393 OUTS (outf
, "++] = ");
2394 OUTS (outf
, dregs (reg
));
2396 else if (aop
== 0 && sz
== 2 && Z
== 0 && W
== 1)
2399 OUTS (outf
, pregs (ptr
));
2400 OUTS (outf
, "++] = ");
2401 OUTS (outf
, dregs (reg
));
2403 else if (aop
== 1 && sz
== 0 && Z
== 0 && W
== 1)
2406 OUTS (outf
, pregs (ptr
));
2407 OUTS (outf
, "--] = ");
2408 OUTS (outf
, dregs (reg
));
2410 else if (aop
== 1 && sz
== 0 && Z
== 1 && W
== 1)
2413 OUTS (outf
, pregs (ptr
));
2414 OUTS (outf
, "--] = ");
2415 OUTS (outf
, pregs (reg
));
2417 else if (aop
== 1 && sz
== 1 && Z
== 0 && W
== 1)
2420 OUTS (outf
, pregs (ptr
));
2421 OUTS (outf
, "--] = ");
2422 OUTS (outf
, dregs (reg
));
2424 else if (aop
== 1 && sz
== 2 && Z
== 0 && W
== 1)
2427 OUTS (outf
, pregs (ptr
));
2428 OUTS (outf
, "--] = ");
2429 OUTS (outf
, dregs (reg
));
2431 else if (aop
== 2 && sz
== 0 && Z
== 0 && W
== 1)
2434 OUTS (outf
, pregs (ptr
));
2435 OUTS (outf
, "] = ");
2436 OUTS (outf
, dregs (reg
));
2438 else if (aop
== 2 && sz
== 0 && Z
== 1 && W
== 1)
2441 OUTS (outf
, pregs (ptr
));
2442 OUTS (outf
, "] = ");
2443 OUTS (outf
, pregs (reg
));
2445 else if (aop
== 2 && sz
== 1 && Z
== 0 && W
== 1)
2448 OUTS (outf
, pregs (ptr
));
2449 OUTS (outf
, "] = ");
2450 OUTS (outf
, dregs (reg
));
2452 else if (aop
== 2 && sz
== 2 && Z
== 0 && W
== 1)
2455 OUTS (outf
, pregs (ptr
));
2456 OUTS (outf
, "] = ");
2457 OUTS (outf
, dregs (reg
));
2466 decode_LDSTiiFP_0 (TIword iw0
, disassemble_info
*outf
)
2469 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2470 | 1 | 0 | 1 | 1 | 1 | 0 |.W.|.offset............|.reg...........|
2471 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2472 int reg
= ((iw0
>> LDSTiiFP_reg_bits
) & LDSTiiFP_reg_mask
);
2473 int offset
= ((iw0
>> LDSTiiFP_offset_bits
) & LDSTiiFP_offset_mask
);
2474 int W
= ((iw0
>> LDSTiiFP_W_bits
) & LDSTiiFP_W_mask
);
2478 OUTS (outf
, dpregs (reg
));
2479 OUTS (outf
, " = [FP ");
2480 OUTS (outf
, negimm5s4 (offset
));
2485 OUTS (outf
, "[FP ");
2486 OUTS (outf
, negimm5s4 (offset
));
2487 OUTS (outf
, "] = ");
2488 OUTS (outf
, dpregs (reg
));
2497 decode_LDSTii_0 (TIword iw0
, disassemble_info
*outf
)
2500 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2501 | 1 | 0 | 1 |.W.|.op....|.offset........|.ptr.......|.reg.......|
2502 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2503 int reg
= ((iw0
>> LDSTii_reg_bit
) & LDSTii_reg_mask
);
2504 int ptr
= ((iw0
>> LDSTii_ptr_bit
) & LDSTii_ptr_mask
);
2505 int offset
= ((iw0
>> LDSTii_offset_bit
) & LDSTii_offset_mask
);
2506 int op
= ((iw0
>> LDSTii_op_bit
) & LDSTii_op_mask
);
2507 int W
= ((iw0
>> LDSTii_W_bit
) & LDSTii_W_mask
);
2509 if (W
== 0 && op
== 0)
2511 OUTS (outf
, dregs (reg
));
2512 OUTS (outf
, " = [");
2513 OUTS (outf
, pregs (ptr
));
2515 OUTS (outf
, uimm4s4 (offset
));
2518 else if (W
== 0 && op
== 1)
2520 OUTS (outf
, dregs (reg
));
2521 OUTS (outf
, " = W[");
2522 OUTS (outf
, pregs (ptr
));
2524 OUTS (outf
, uimm4s2 (offset
));
2525 OUTS (outf
, "] (Z)");
2527 else if (W
== 0 && op
== 2)
2529 OUTS (outf
, dregs (reg
));
2530 OUTS (outf
, " = W[");
2531 OUTS (outf
, pregs (ptr
));
2533 OUTS (outf
, uimm4s2 (offset
));
2534 OUTS (outf
, "] (X)");
2536 else if (W
== 0 && op
== 3)
2538 OUTS (outf
, pregs (reg
));
2539 OUTS (outf
, " = [");
2540 OUTS (outf
, pregs (ptr
));
2542 OUTS (outf
, uimm4s4 (offset
));
2545 else if (W
== 1 && op
== 0)
2548 OUTS (outf
, pregs (ptr
));
2550 OUTS (outf
, uimm4s4 (offset
));
2551 OUTS (outf
, "] = ");
2552 OUTS (outf
, dregs (reg
));
2554 else if (W
== 1 && op
== 1)
2557 OUTS (outf
, pregs (ptr
));
2559 OUTS (outf
, uimm4s2 (offset
));
2560 OUTS (outf
, "] = ");
2561 OUTS (outf
, dregs (reg
));
2563 else if (W
== 1 && op
== 3)
2566 OUTS (outf
, pregs (ptr
));
2568 OUTS (outf
, uimm4s4 (offset
));
2569 OUTS (outf
, "] = ");
2570 OUTS (outf
, pregs (reg
));
2579 decode_LoopSetup_0 (TIword iw0
, TIword iw1
, bfd_vma pc
, disassemble_info
*outf
)
2582 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2583 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 |.rop...|.c.|.soffset.......|
2584 |.reg...........| - | - |.eoffset...............................|
2585 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2586 int c
= ((iw0
>> (LoopSetup_c_bits
- 16)) & LoopSetup_c_mask
);
2587 int reg
= ((iw1
>> LoopSetup_reg_bits
) & LoopSetup_reg_mask
);
2588 int rop
= ((iw0
>> (LoopSetup_rop_bits
- 16)) & LoopSetup_rop_mask
);
2589 int soffset
= ((iw0
>> (LoopSetup_soffset_bits
- 16)) & LoopSetup_soffset_mask
);
2590 int eoffset
= ((iw1
>> LoopSetup_eoffset_bits
) & LoopSetup_eoffset_mask
);
2600 OUTS (outf
, "LSETUP");
2602 OUTS (outf
, pcrel4 (soffset
));
2603 OUTS (outf
, ", 0x");
2604 OUTS (outf
, lppcrel10 (eoffset
));
2606 OUTS (outf
, counters (c
));
2610 OUTS (outf
, "LSETUP");
2612 OUTS (outf
, pcrel4 (soffset
));
2613 OUTS (outf
, ", 0x");
2614 OUTS (outf
, lppcrel10 (eoffset
));
2616 OUTS (outf
, counters (c
));
2618 OUTS (outf
, pregs (reg
));
2622 OUTS (outf
, "LSETUP");
2624 OUTS (outf
, pcrel4 (soffset
));
2625 OUTS (outf
, ", 0x");
2626 OUTS (outf
, lppcrel10 (eoffset
));
2628 OUTS (outf
, counters (c
));
2630 OUTS (outf
, pregs (reg
));
2631 OUTS (outf
, " >> 0x1");
2640 decode_LDIMMhalf_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
2643 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2644 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 1 |.Z.|.H.|.S.|.grp...|.reg.......|
2645 |.hword.........................................................|
2646 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2647 int H
= ((iw0
>> (LDIMMhalf_H_bits
- 16)) & LDIMMhalf_H_mask
);
2648 int Z
= ((iw0
>> (LDIMMhalf_Z_bits
- 16)) & LDIMMhalf_Z_mask
);
2649 int S
= ((iw0
>> (LDIMMhalf_S_bits
- 16)) & LDIMMhalf_S_mask
);
2650 int reg
= ((iw0
>> (LDIMMhalf_reg_bits
- 16)) & LDIMMhalf_reg_mask
);
2651 int grp
= ((iw0
>> (LDIMMhalf_grp_bits
- 16)) & LDIMMhalf_grp_mask
);
2652 int hword
= ((iw1
>> LDIMMhalf_hword_bits
) & LDIMMhalf_hword_mask
);
2654 bu32
*pval
= get_allreg (grp
, reg
);
2659 /* Since we don't have 32-bit immediate loads, we allow the disassembler
2660 to combine them, so it prints out the right values.
2661 Here we keep track of the registers. */
2662 if (H
== 0 && S
== 1 && Z
== 0)
2664 /* regs = imm16 (x) */
2665 *pval
= imm16_val (hword
);
2667 *pval
|= 0xFFFF0000;
2671 else if (H
== 0 && S
== 0 && Z
== 1)
2673 /* regs = luimm16 (Z) */
2674 *pval
= luimm16_val (hword
);
2677 else if (H
== 0 && S
== 0 && Z
== 0)
2679 /* regs_lo = luimm16 */
2680 *pval
&= 0xFFFF0000;
2681 *pval
|= luimm16_val (hword
);
2683 else if (H
== 1 && S
== 0 && Z
== 0)
2685 /* regs_hi = huimm16 */
2687 *pval
|= luimm16_val (hword
) << 16;
2690 /* Here we do the disassembly */
2691 if (grp
== 0 && H
== 0 && S
== 0 && Z
== 0)
2693 OUTS (outf
, dregs_lo (reg
));
2695 OUTS (outf
, uimm16 (hword
));
2697 else if (grp
== 0 && H
== 1 && S
== 0 && Z
== 0)
2699 OUTS (outf
, dregs_hi (reg
));
2701 OUTS (outf
, uimm16 (hword
));
2703 else if (grp
== 0 && H
== 0 && S
== 1 && Z
== 0)
2705 OUTS (outf
, dregs (reg
));
2707 OUTS (outf
, imm16 (hword
));
2708 OUTS (outf
, " (X)");
2710 else if (H
== 0 && S
== 1 && Z
== 0)
2712 OUTS (outf
, regs (reg
, grp
));
2714 OUTS (outf
, imm16 (hword
));
2715 OUTS (outf
, " (X)");
2717 else if (H
== 0 && S
== 0 && Z
== 1)
2719 OUTS (outf
, regs (reg
, grp
));
2721 OUTS (outf
, uimm16 (hword
));
2722 OUTS (outf
, " (Z)");
2724 else if (H
== 0 && S
== 0 && Z
== 0)
2726 OUTS (outf
, regs_lo (reg
, grp
));
2728 OUTS (outf
, uimm16 (hword
));
2730 else if (H
== 1 && S
== 0 && Z
== 0)
2732 OUTS (outf
, regs_hi (reg
, grp
));
2734 OUTS (outf
, uimm16 (hword
));
2739 /* And we print out the 32-bit value if it is a pointer. */
2740 if (S
== 0 && Z
== 0)
2742 OUTS (outf
, ";\t\t/* (");
2743 OUTS (outf
, imm16d (hword
));
2746 /* If it is an MMR, don't print the symbol. */
2747 if (*pval
< 0xFFC00000 && grp
== 1)
2749 OUTS (outf
, regs (reg
, grp
));
2751 OUTS (outf
, huimm32e (*pval
));
2755 OUTS (outf
, regs (reg
, grp
));
2757 OUTS (outf
, huimm32e (*pval
));
2759 OUTS (outf
, imm32 (*pval
));
2766 if (S
== 1 || Z
== 1)
2768 OUTS (outf
, ";\t\t/*\t\t");
2769 OUTS (outf
, regs (reg
, grp
));
2771 OUTS (outf
, huimm32e (*pval
));
2773 OUTS (outf
, imm32 (*pval
));
2774 OUTS (outf
, ") */");
2781 decode_CALLa_0 (TIword iw0
, TIword iw1
, bfd_vma pc
, disassemble_info
*outf
)
2784 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2785 | 1 | 1 | 1 | 0 | 0 | 0 | 1 |.S.|.msw...........................|
2786 |.lsw...........................................................|
2787 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2788 int S
= ((iw0
>> (CALLa_S_bits
- 16)) & CALLa_S_mask
);
2789 int lsw
= ((iw1
>> 0) & 0xffff);
2790 int msw
= ((iw0
>> 0) & 0xff);
2796 OUTS (outf
, "CALL 0x");
2798 OUTS (outf
, "JUMP.L 0x");
2802 OUTS (outf
, pcrel24 (((msw
) << 16) | (lsw
)));
2807 decode_LDSTidxI_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
2810 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2811 | 1 | 1 | 1 | 0 | 0 | 1 |.W.|.Z.|.sz....|.ptr.......|.reg.......|
2812 |.offset........................................................|
2813 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2814 int Z
= ((iw0
>> (LDSTidxI_Z_bits
- 16)) & LDSTidxI_Z_mask
);
2815 int W
= ((iw0
>> (LDSTidxI_W_bits
- 16)) & LDSTidxI_W_mask
);
2816 int sz
= ((iw0
>> (LDSTidxI_sz_bits
- 16)) & LDSTidxI_sz_mask
);
2817 int reg
= ((iw0
>> (LDSTidxI_reg_bits
- 16)) & LDSTidxI_reg_mask
);
2818 int ptr
= ((iw0
>> (LDSTidxI_ptr_bits
- 16)) & LDSTidxI_ptr_mask
);
2819 int offset
= ((iw1
>> LDSTidxI_offset_bits
) & LDSTidxI_offset_mask
);
2821 if (W
== 0 && sz
== 0 && Z
== 0)
2823 OUTS (outf
, dregs (reg
));
2824 OUTS (outf
, " = [");
2825 OUTS (outf
, pregs (ptr
));
2827 OUTS (outf
, imm16s4 (offset
));
2830 else if (W
== 0 && sz
== 0 && Z
== 1)
2832 OUTS (outf
, pregs (reg
));
2833 OUTS (outf
, " = [");
2834 OUTS (outf
, pregs (ptr
));
2836 OUTS (outf
, imm16s4 (offset
));
2839 else if (W
== 0 && sz
== 1 && Z
== 0)
2841 OUTS (outf
, dregs (reg
));
2842 OUTS (outf
, " = W[");
2843 OUTS (outf
, pregs (ptr
));
2845 OUTS (outf
, imm16s2 (offset
));
2846 OUTS (outf
, "] (Z)");
2848 else if (W
== 0 && sz
== 1 && Z
== 1)
2850 OUTS (outf
, dregs (reg
));
2851 OUTS (outf
, " = W[");
2852 OUTS (outf
, pregs (ptr
));
2854 OUTS (outf
, imm16s2 (offset
));
2855 OUTS (outf
, "] (X)");
2857 else if (W
== 0 && sz
== 2 && Z
== 0)
2859 OUTS (outf
, dregs (reg
));
2860 OUTS (outf
, " = B[");
2861 OUTS (outf
, pregs (ptr
));
2863 OUTS (outf
, imm16 (offset
));
2864 OUTS (outf
, "] (Z)");
2866 else if (W
== 0 && sz
== 2 && Z
== 1)
2868 OUTS (outf
, dregs (reg
));
2869 OUTS (outf
, " = B[");
2870 OUTS (outf
, pregs (ptr
));
2872 OUTS (outf
, imm16 (offset
));
2873 OUTS (outf
, "] (X)");
2875 else if (W
== 1 && sz
== 0 && Z
== 0)
2878 OUTS (outf
, pregs (ptr
));
2880 OUTS (outf
, imm16s4 (offset
));
2881 OUTS (outf
, "] = ");
2882 OUTS (outf
, dregs (reg
));
2884 else if (W
== 1 && sz
== 0 && Z
== 1)
2887 OUTS (outf
, pregs (ptr
));
2889 OUTS (outf
, imm16s4 (offset
));
2890 OUTS (outf
, "] = ");
2891 OUTS (outf
, pregs (reg
));
2893 else if (W
== 1 && sz
== 1 && Z
== 0)
2896 OUTS (outf
, pregs (ptr
));
2898 OUTS (outf
, imm16s2 (offset
));
2899 OUTS (outf
, "] = ");
2900 OUTS (outf
, dregs (reg
));
2902 else if (W
== 1 && sz
== 2 && Z
== 0)
2905 OUTS (outf
, pregs (ptr
));
2907 OUTS (outf
, imm16 (offset
));
2908 OUTS (outf
, "] = ");
2909 OUTS (outf
, dregs (reg
));
2918 decode_linkage_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
2921 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2922 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |.R.|
2923 |.framesize.....................................................|
2924 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2925 int R
= ((iw0
>> (Linkage_R_bits
- 16)) & Linkage_R_mask
);
2926 int framesize
= ((iw1
>> Linkage_framesize_bits
) & Linkage_framesize_mask
);
2933 OUTS (outf
, "LINK ");
2934 OUTS (outf
, uimm16s4 (framesize
));
2935 OUTS (outf
, ";\t\t/* (");
2936 OUTS (outf
, uimm16s4d (framesize
));
2937 OUTS (outf
, ") */");
2941 OUTS (outf
, "UNLINK");
2949 decode_dsp32mac_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
2952 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2953 | 1 | 1 | 0 | 0 |.M.| 0 | 0 |.mmod..........|.MM|.P.|.w1|.op1...|
2954 |.h01|.h11|.w0|.op0...|.h00|.h10|.dst.......|.src0......|.src1..|
2955 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2956 int op1
= ((iw0
>> (DSP32Mac_op1_bits
- 16)) & DSP32Mac_op1_mask
);
2957 int w1
= ((iw0
>> (DSP32Mac_w1_bits
- 16)) & DSP32Mac_w1_mask
);
2958 int P
= ((iw0
>> (DSP32Mac_p_bits
- 16)) & DSP32Mac_p_mask
);
2959 int MM
= ((iw0
>> (DSP32Mac_MM_bits
- 16)) & DSP32Mac_MM_mask
);
2960 int mmod
= ((iw0
>> (DSP32Mac_mmod_bits
- 16)) & DSP32Mac_mmod_mask
);
2961 int w0
= ((iw1
>> DSP32Mac_w0_bits
) & DSP32Mac_w0_mask
);
2962 int src0
= ((iw1
>> DSP32Mac_src0_bits
) & DSP32Mac_src0_mask
);
2963 int src1
= ((iw1
>> DSP32Mac_src1_bits
) & DSP32Mac_src1_mask
);
2964 int dst
= ((iw1
>> DSP32Mac_dst_bits
) & DSP32Mac_dst_mask
);
2965 int h10
= ((iw1
>> DSP32Mac_h10_bits
) & DSP32Mac_h10_mask
);
2966 int h00
= ((iw1
>> DSP32Mac_h00_bits
) & DSP32Mac_h00_mask
);
2967 int op0
= ((iw1
>> DSP32Mac_op0_bits
) & DSP32Mac_op0_mask
);
2968 int h11
= ((iw1
>> DSP32Mac_h11_bits
) & DSP32Mac_h11_mask
);
2969 int h01
= ((iw1
>> DSP32Mac_h01_bits
) & DSP32Mac_h01_mask
);
2971 if (w0
== 0 && w1
== 0 && op1
== 3 && op0
== 3)
2977 if ((w1
|| w0
) && mmod
== M_W32
)
2980 if (((1 << mmod
) & (P
? 0x131b : 0x1b5f)) == 0)
2983 if (w1
== 1 || op1
!= 3)
2986 OUTS (outf
, P
? dregs (dst
+ 1) : dregs_hi (dst
));
2989 OUTS (outf
, " = A1");
2993 OUTS (outf
, " = (");
2994 decode_macfunc (1, op1
, h01
, h11
, src0
, src1
, outf
);
2999 if (w0
== 1 || op0
!= 3)
3002 OUTS (outf
, " (M)");
3007 if (w0
== 1 || op0
!= 3)
3009 /* Clear MM option since it only matters for MAC1, and if we made
3010 it this far, we've already shown it or we want to ignore it. */
3014 OUTS (outf
, P
? dregs (dst
) : dregs_lo (dst
));
3017 OUTS (outf
, " = A0");
3021 OUTS (outf
, " = (");
3022 decode_macfunc (0, op0
, h00
, h10
, src0
, src1
, outf
);
3028 decode_optmode (mmod
, MM
, outf
);
3034 decode_dsp32mult_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
3037 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
3038 | 1 | 1 | 0 | 0 |.M.| 0 | 1 |.mmod..........|.MM|.P.|.w1|.op1...|
3039 |.h01|.h11|.w0|.op0...|.h00|.h10|.dst.......|.src0......|.src1..|
3040 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
3041 int w1
= ((iw0
>> (DSP32Mac_w1_bits
- 16)) & DSP32Mac_w1_mask
);
3042 int P
= ((iw0
>> (DSP32Mac_p_bits
- 16)) & DSP32Mac_p_mask
);
3043 int MM
= ((iw0
>> (DSP32Mac_MM_bits
- 16)) & DSP32Mac_MM_mask
);
3044 int mmod
= ((iw0
>> (DSP32Mac_mmod_bits
- 16)) & DSP32Mac_mmod_mask
);
3045 int w0
= ((iw1
>> DSP32Mac_w0_bits
) & DSP32Mac_w0_mask
);
3046 int src0
= ((iw1
>> DSP32Mac_src0_bits
) & DSP32Mac_src0_mask
);
3047 int src1
= ((iw1
>> DSP32Mac_src1_bits
) & DSP32Mac_src1_mask
);
3048 int dst
= ((iw1
>> DSP32Mac_dst_bits
) & DSP32Mac_dst_mask
);
3049 int h10
= ((iw1
>> DSP32Mac_h10_bits
) & DSP32Mac_h10_mask
);
3050 int h00
= ((iw1
>> DSP32Mac_h00_bits
) & DSP32Mac_h00_mask
);
3051 int h11
= ((iw1
>> DSP32Mac_h11_bits
) & DSP32Mac_h11_mask
);
3052 int h01
= ((iw1
>> DSP32Mac_h01_bits
) & DSP32Mac_h01_mask
);
3054 if (w1
== 0 && w0
== 0)
3057 if (((1 << mmod
) & (P
? 0x313 : 0x1b57)) == 0)
3062 OUTS (outf
, P
? dregs (dst
+ 1) : dregs_hi (dst
));
3064 decode_multfunc (h01
, h11
, src0
, src1
, outf
);
3069 OUTS (outf
, " (M)");
3077 OUTS (outf
, P
? dregs (dst
) : dregs_lo (dst
));
3079 decode_multfunc (h00
, h10
, src0
, src1
, outf
);
3082 decode_optmode (mmod
, MM
, outf
);
3087 decode_dsp32alu_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
3090 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
3091 | 1 | 1 | 0 | 0 |.M.| 1 | 0 | - | - | - |.HL|.aopcde............|
3092 |.aop...|.s.|.x.|.dst0......|.dst1......|.src0......|.src1......|
3093 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
3094 int s
= ((iw1
>> DSP32Alu_s_bits
) & DSP32Alu_s_mask
);
3095 int x
= ((iw1
>> DSP32Alu_x_bits
) & DSP32Alu_x_mask
);
3096 int aop
= ((iw1
>> DSP32Alu_aop_bits
) & DSP32Alu_aop_mask
);
3097 int src0
= ((iw1
>> DSP32Alu_src0_bits
) & DSP32Alu_src0_mask
);
3098 int src1
= ((iw1
>> DSP32Alu_src1_bits
) & DSP32Alu_src1_mask
);
3099 int dst0
= ((iw1
>> DSP32Alu_dst0_bits
) & DSP32Alu_dst0_mask
);
3100 int dst1
= ((iw1
>> DSP32Alu_dst1_bits
) & DSP32Alu_dst1_mask
);
3101 int HL
= ((iw0
>> (DSP32Alu_HL_bits
- 16)) & DSP32Alu_HL_mask
);
3102 int aopcde
= ((iw0
>> (DSP32Alu_aopcde_bits
- 16)) & DSP32Alu_aopcde_mask
);
3104 if (aop
== 0 && aopcde
== 9 && HL
== 0 && s
== 0)
3106 OUTS (outf
, "A0.L = ");
3107 OUTS (outf
, dregs_lo (src0
));
3109 else if (aop
== 2 && aopcde
== 9 && HL
== 1 && s
== 0)
3111 OUTS (outf
, "A1.H = ");
3112 OUTS (outf
, dregs_hi (src0
));
3114 else if (aop
== 2 && aopcde
== 9 && HL
== 0 && s
== 0)
3116 OUTS (outf
, "A1.L = ");
3117 OUTS (outf
, dregs_lo (src0
));
3119 else if (aop
== 0 && aopcde
== 9 && HL
== 1 && s
== 0)
3121 OUTS (outf
, "A0.H = ");
3122 OUTS (outf
, dregs_hi (src0
));
3124 else if (x
== 1 && HL
== 1 && aop
== 3 && aopcde
== 5)
3126 OUTS (outf
, dregs_hi (dst0
));
3128 OUTS (outf
, dregs (src0
));
3130 OUTS (outf
, dregs (src1
));
3131 OUTS (outf
, " (RND20)");
3133 else if (x
== 1 && HL
== 1 && aop
== 2 && aopcde
== 5)
3135 OUTS (outf
, dregs_hi (dst0
));
3137 OUTS (outf
, dregs (src0
));
3139 OUTS (outf
, dregs (src1
));
3140 OUTS (outf
, " (RND20)");
3142 else if (x
== 0 && HL
== 0 && aop
== 1 && aopcde
== 5)
3144 OUTS (outf
, dregs_lo (dst0
));
3146 OUTS (outf
, dregs (src0
));
3148 OUTS (outf
, dregs (src1
));
3149 OUTS (outf
, " (RND12)");
3151 else if (x
== 0 && HL
== 0 && aop
== 0 && aopcde
== 5)
3153 OUTS (outf
, dregs_lo (dst0
));
3155 OUTS (outf
, dregs (src0
));
3157 OUTS (outf
, dregs (src1
));
3158 OUTS (outf
, " (RND12)");
3160 else if (x
== 1 && HL
== 0 && aop
== 3 && aopcde
== 5)
3162 OUTS (outf
, dregs_lo (dst0
));
3164 OUTS (outf
, dregs (src0
));
3166 OUTS (outf
, dregs (src1
));
3167 OUTS (outf
, " (RND20)");
3169 else if (x
== 0 && HL
== 1 && aop
== 0 && aopcde
== 5)
3171 OUTS (outf
, dregs_hi (dst0
));
3173 OUTS (outf
, dregs (src0
));
3175 OUTS (outf
, dregs (src1
));
3176 OUTS (outf
, " (RND12)");
3178 else if (x
== 1 && HL
== 0 && aop
== 2 && aopcde
== 5)
3180 OUTS (outf
, dregs_lo (dst0
));
3182 OUTS (outf
, dregs (src0
));
3184 OUTS (outf
, dregs (src1
));
3185 OUTS (outf
, " (RND20)");
3187 else if (x
== 0 && HL
== 1 && aop
== 1 && aopcde
== 5)
3189 OUTS (outf
, dregs_hi (dst0
));
3191 OUTS (outf
, dregs (src0
));
3193 OUTS (outf
, dregs (src1
));
3194 OUTS (outf
, " (RND12)");
3196 else if (HL
== 1 && aop
== 0 && aopcde
== 2)
3198 OUTS (outf
, dregs_hi (dst0
));
3200 OUTS (outf
, dregs_lo (src0
));
3202 OUTS (outf
, dregs_lo (src1
));
3205 else if (HL
== 1 && aop
== 1 && aopcde
== 2)
3207 OUTS (outf
, dregs_hi (dst0
));
3209 OUTS (outf
, dregs_lo (src0
));
3211 OUTS (outf
, dregs_hi (src1
));
3214 else if (HL
== 1 && aop
== 2 && aopcde
== 2)
3216 OUTS (outf
, dregs_hi (dst0
));
3218 OUTS (outf
, dregs_hi (src0
));
3220 OUTS (outf
, dregs_lo (src1
));
3223 else if (HL
== 1 && aop
== 3 && aopcde
== 2)
3225 OUTS (outf
, dregs_hi (dst0
));
3227 OUTS (outf
, dregs_hi (src0
));
3229 OUTS (outf
, dregs_hi (src1
));
3232 else if (HL
== 0 && aop
== 0 && aopcde
== 3)
3234 OUTS (outf
, dregs_lo (dst0
));
3236 OUTS (outf
, dregs_lo (src0
));
3238 OUTS (outf
, dregs_lo (src1
));
3241 else if (HL
== 0 && aop
== 1 && aopcde
== 3)
3243 OUTS (outf
, dregs_lo (dst0
));
3245 OUTS (outf
, dregs_lo (src0
));
3247 OUTS (outf
, dregs_hi (src1
));
3250 else if (HL
== 0 && aop
== 3 && aopcde
== 2)
3252 OUTS (outf
, dregs_lo (dst0
));
3254 OUTS (outf
, dregs_hi (src0
));
3256 OUTS (outf
, dregs_hi (src1
));
3259 else if (HL
== 1 && aop
== 0 && aopcde
== 3)
3261 OUTS (outf
, dregs_hi (dst0
));
3263 OUTS (outf
, dregs_lo (src0
));
3265 OUTS (outf
, dregs_lo (src1
));
3268 else if (HL
== 1 && aop
== 1 && aopcde
== 3)
3270 OUTS (outf
, dregs_hi (dst0
));
3272 OUTS (outf
, dregs_lo (src0
));
3274 OUTS (outf
, dregs_hi (src1
));
3277 else if (HL
== 1 && aop
== 2 && aopcde
== 3)
3279 OUTS (outf
, dregs_hi (dst0
));
3281 OUTS (outf
, dregs_hi (src0
));
3283 OUTS (outf
, dregs_lo (src1
));
3286 else if (HL
== 1 && aop
== 3 && aopcde
== 3)
3288 OUTS (outf
, dregs_hi (dst0
));
3290 OUTS (outf
, dregs_hi (src0
));
3292 OUTS (outf
, dregs_hi (src1
));
3295 else if (HL
== 0 && aop
== 2 && aopcde
== 2)
3297 OUTS (outf
, dregs_lo (dst0
));
3299 OUTS (outf
, dregs_hi (src0
));
3301 OUTS (outf
, dregs_lo (src1
));
3304 else if (HL
== 0 && aop
== 1 && aopcde
== 2)
3306 OUTS (outf
, dregs_lo (dst0
));
3308 OUTS (outf
, dregs_lo (src0
));
3310 OUTS (outf
, dregs_hi (src1
));
3313 else if (HL
== 0 && aop
== 2 && aopcde
== 3)
3315 OUTS (outf
, dregs_lo (dst0
));
3317 OUTS (outf
, dregs_hi (src0
));
3319 OUTS (outf
, dregs_lo (src1
));
3322 else if (HL
== 0 && aop
== 3 && aopcde
== 3)
3324 OUTS (outf
, dregs_lo (dst0
));
3326 OUTS (outf
, dregs_hi (src0
));
3328 OUTS (outf
, dregs_hi (src1
));
3331 else if (HL
== 0 && aop
== 0 && aopcde
== 2)
3333 OUTS (outf
, dregs_lo (dst0
));
3335 OUTS (outf
, dregs_lo (src0
));
3337 OUTS (outf
, dregs_lo (src1
));
3340 else if (aop
== 0 && aopcde
== 9 && s
== 1)
3342 OUTS (outf
, "A0 = ");
3343 OUTS (outf
, dregs (src0
));
3345 else if (aop
== 3 && aopcde
== 11 && s
== 0)
3346 OUTS (outf
, "A0 -= A1");
3348 else if (aop
== 3 && aopcde
== 11 && s
== 1)
3349 OUTS (outf
, "A0 -= A1 (W32)");
3351 else if (aop
== 1 && aopcde
== 22 && HL
== 1)
3353 OUTS (outf
, dregs (dst0
));
3354 OUTS (outf
, " = BYTEOP2P (");
3355 OUTS (outf
, dregs (src0
+ 1));
3357 OUTS (outf
, imm5d (src0
));
3359 OUTS (outf
, dregs (src1
+ 1));
3361 OUTS (outf
, imm5d (src1
));
3362 OUTS (outf
, ") (TH");
3364 OUTS (outf
, ", R)");
3368 else if (aop
== 1 && aopcde
== 22 && HL
== 0)
3370 OUTS (outf
, dregs (dst0
));
3371 OUTS (outf
, " = BYTEOP2P (");
3372 OUTS (outf
, dregs (src0
+ 1));
3374 OUTS (outf
, imm5d (src0
));
3376 OUTS (outf
, dregs (src1
+ 1));
3378 OUTS (outf
, imm5d (src1
));
3379 OUTS (outf
, ") (TL");
3381 OUTS (outf
, ", R)");
3385 else if (aop
== 0 && aopcde
== 22 && HL
== 1)
3387 OUTS (outf
, dregs (dst0
));
3388 OUTS (outf
, " = BYTEOP2P (");
3389 OUTS (outf
, dregs (src0
+ 1));
3391 OUTS (outf
, imm5d (src0
));
3393 OUTS (outf
, dregs (src1
+ 1));
3395 OUTS (outf
, imm5d (src1
));
3396 OUTS (outf
, ") (RNDH");
3398 OUTS (outf
, ", R)");
3402 else if (aop
== 0 && aopcde
== 22 && HL
== 0)
3404 OUTS (outf
, dregs (dst0
));
3405 OUTS (outf
, " = BYTEOP2P (");
3406 OUTS (outf
, dregs (src0
+ 1));
3408 OUTS (outf
, imm5d (src0
));
3410 OUTS (outf
, dregs (src1
+ 1));
3412 OUTS (outf
, imm5d (src1
));
3413 OUTS (outf
, ") (RNDL");
3415 OUTS (outf
, ", R)");
3419 else if (aop
== 0 && s
== 0 && aopcde
== 8)
3420 OUTS (outf
, "A0 = 0");
3422 else if (aop
== 0 && s
== 1 && aopcde
== 8)
3423 OUTS (outf
, "A0 = A0 (S)");
3425 else if (aop
== 1 && s
== 0 && aopcde
== 8)
3426 OUTS (outf
, "A1 = 0");
3428 else if (aop
== 1 && s
== 1 && aopcde
== 8)
3429 OUTS (outf
, "A1 = A1 (S)");
3431 else if (aop
== 2 && s
== 0 && aopcde
== 8)
3432 OUTS (outf
, "A1 = A0 = 0");
3434 else if (aop
== 2 && s
== 1 && aopcde
== 8)
3435 OUTS (outf
, "A1 = A1 (S), A0 = A0 (S)");
3437 else if (aop
== 3 && s
== 0 && aopcde
== 8)
3438 OUTS (outf
, "A0 = A1");
3440 else if (aop
== 3 && s
== 1 && aopcde
== 8)
3441 OUTS (outf
, "A1 = A0");
3443 else if (aop
== 1 && aopcde
== 9 && s
== 0)
3445 OUTS (outf
, "A0.X = ");
3446 OUTS (outf
, dregs_lo (src0
));
3448 else if (aop
== 1 && HL
== 0 && aopcde
== 11)
3450 OUTS (outf
, dregs_lo (dst0
));
3451 OUTS (outf
, " = (A0 += A1)");
3453 else if (aop
== 3 && HL
== 0 && aopcde
== 16)
3454 OUTS (outf
, "A1 = ABS A1, A0 = ABS A0");
3456 else if (aop
== 0 && aopcde
== 23 && HL
== 1)
3458 OUTS (outf
, dregs (dst0
));
3459 OUTS (outf
, " = BYTEOP3P (");
3460 OUTS (outf
, dregs (src0
+ 1));
3462 OUTS (outf
, imm5d (src0
));
3464 OUTS (outf
, dregs (src1
+ 1));
3466 OUTS (outf
, imm5d (src1
));
3467 OUTS (outf
, ") (HI");
3469 OUTS (outf
, ", R)");
3473 else if (aop
== 3 && aopcde
== 9 && s
== 0)
3475 OUTS (outf
, "A1.X = ");
3476 OUTS (outf
, dregs_lo (src0
));
3478 else if (aop
== 1 && HL
== 1 && aopcde
== 16)
3479 OUTS (outf
, "A1 = ABS A1");
3481 else if (aop
== 0 && HL
== 1 && aopcde
== 16)
3482 OUTS (outf
, "A1 = ABS A0");
3484 else if (aop
== 2 && aopcde
== 9 && s
== 1)
3486 OUTS (outf
, "A1 = ");
3487 OUTS (outf
, dregs (src0
));
3489 else if (HL
== 0 && aop
== 3 && aopcde
== 12)
3491 OUTS (outf
, dregs_lo (dst0
));
3493 OUTS (outf
, dregs (src0
));
3494 OUTS (outf
, " (RND)");
3496 else if (aop
== 1 && HL
== 0 && aopcde
== 16)
3497 OUTS (outf
, "A0 = ABS A1");
3499 else if (aop
== 0 && HL
== 0 && aopcde
== 16)
3500 OUTS (outf
, "A0 = ABS A0");
3502 else if (aop
== 3 && HL
== 0 && aopcde
== 15)
3504 OUTS (outf
, dregs (dst0
));
3505 OUTS (outf
, " = -");
3506 OUTS (outf
, dregs (src0
));
3507 OUTS (outf
, " (V)");
3509 else if (aop
== 3 && s
== 1 && HL
== 0 && aopcde
== 7)
3511 OUTS (outf
, dregs (dst0
));
3512 OUTS (outf
, " = -");
3513 OUTS (outf
, dregs (src0
));
3514 OUTS (outf
, " (S)");
3516 else if (aop
== 3 && s
== 0 && HL
== 0 && aopcde
== 7)
3518 OUTS (outf
, dregs (dst0
));
3519 OUTS (outf
, " = -");
3520 OUTS (outf
, dregs (src0
));
3521 OUTS (outf
, " (NS)");
3523 else if (aop
== 1 && HL
== 1 && aopcde
== 11)
3525 OUTS (outf
, dregs_hi (dst0
));
3526 OUTS (outf
, " = (A0 += A1)");
3528 else if (aop
== 2 && aopcde
== 11 && s
== 0)
3529 OUTS (outf
, "A0 += A1");
3531 else if (aop
== 2 && aopcde
== 11 && s
== 1)
3532 OUTS (outf
, "A0 += A1 (W32)");
3534 else if (aop
== 3 && HL
== 0 && aopcde
== 14)
3535 OUTS (outf
, "A1 = -A1, A0 = -A0");
3537 else if (HL
== 1 && aop
== 3 && aopcde
== 12)
3539 OUTS (outf
, dregs_hi (dst0
));
3541 OUTS (outf
, dregs (src0
));
3542 OUTS (outf
, " (RND)");
3544 else if (aop
== 0 && aopcde
== 23 && HL
== 0)
3546 OUTS (outf
, dregs (dst0
));
3547 OUTS (outf
, " = BYTEOP3P (");
3548 OUTS (outf
, dregs (src0
+ 1));
3550 OUTS (outf
, imm5d (src0
));
3552 OUTS (outf
, dregs (src1
+ 1));
3554 OUTS (outf
, imm5d (src1
));
3555 OUTS (outf
, ") (LO");
3557 OUTS (outf
, ", R)");
3561 else if (aop
== 0 && HL
== 0 && aopcde
== 14)
3562 OUTS (outf
, "A0 = -A0");
3564 else if (aop
== 1 && HL
== 0 && aopcde
== 14)
3565 OUTS (outf
, "A0 = -A1");
3567 else if (aop
== 0 && HL
== 1 && aopcde
== 14)
3568 OUTS (outf
, "A1 = -A0");
3570 else if (aop
== 1 && HL
== 1 && aopcde
== 14)
3571 OUTS (outf
, "A1 = -A1");
3573 else if (aop
== 0 && aopcde
== 12)
3575 OUTS (outf
, dregs_hi (dst0
));
3577 OUTS (outf
, dregs_lo (dst0
));
3578 OUTS (outf
, " = SIGN (");
3579 OUTS (outf
, dregs_hi (src0
));
3580 OUTS (outf
, ") * ");
3581 OUTS (outf
, dregs_hi (src1
));
3582 OUTS (outf
, " + SIGN (");
3583 OUTS (outf
, dregs_lo (src0
));
3584 OUTS (outf
, ") * ");
3585 OUTS (outf
, dregs_lo (src1
));
3587 else if (aop
== 2 && aopcde
== 0)
3589 OUTS (outf
, dregs (dst0
));
3591 OUTS (outf
, dregs (src0
));
3592 OUTS (outf
, " -|+ ");
3593 OUTS (outf
, dregs (src1
));
3596 else if (aop
== 1 && aopcde
== 12)
3598 OUTS (outf
, dregs (dst1
));
3599 OUTS (outf
, " = A1.L + A1.H, ");
3600 OUTS (outf
, dregs (dst0
));
3601 OUTS (outf
, " = A0.L + A0.H");
3603 else if (aop
== 2 && aopcde
== 4)
3605 OUTS (outf
, dregs (dst1
));
3607 OUTS (outf
, dregs (src0
));
3609 OUTS (outf
, dregs (src1
));
3611 OUTS (outf
, dregs (dst0
));
3613 OUTS (outf
, dregs (src0
));
3615 OUTS (outf
, dregs (src1
));
3618 else if (HL
== 0 && aopcde
== 1)
3620 OUTS (outf
, dregs (dst1
));
3622 OUTS (outf
, dregs (src0
));
3623 OUTS (outf
, " +|+ ");
3624 OUTS (outf
, dregs (src1
));
3626 OUTS (outf
, dregs (dst0
));
3628 OUTS (outf
, dregs (src0
));
3629 OUTS (outf
, " -|- ");
3630 OUTS (outf
, dregs (src1
));
3631 amod0amod2 (s
, x
, aop
, outf
);
3633 else if (aop
== 0 && aopcde
== 11)
3635 OUTS (outf
, dregs (dst0
));
3636 OUTS (outf
, " = (A0 += A1)");
3638 else if (aop
== 0 && aopcde
== 10)
3640 OUTS (outf
, dregs_lo (dst0
));
3641 OUTS (outf
, " = A0.X");
3643 else if (aop
== 1 && aopcde
== 10)
3645 OUTS (outf
, dregs_lo (dst0
));
3646 OUTS (outf
, " = A1.X");
3648 else if (aop
== 1 && aopcde
== 0)
3650 OUTS (outf
, dregs (dst0
));
3652 OUTS (outf
, dregs (src0
));
3653 OUTS (outf
, " +|- ");
3654 OUTS (outf
, dregs (src1
));
3657 else if (aop
== 3 && aopcde
== 0)
3659 OUTS (outf
, dregs (dst0
));
3661 OUTS (outf
, dregs (src0
));
3662 OUTS (outf
, " -|- ");
3663 OUTS (outf
, dregs (src1
));
3666 else if (aop
== 1 && aopcde
== 4)
3668 OUTS (outf
, dregs (dst0
));
3670 OUTS (outf
, dregs (src0
));
3672 OUTS (outf
, dregs (src1
));
3675 else if (aop
== 0 && aopcde
== 17)
3677 OUTS (outf
, dregs (dst1
));
3678 OUTS (outf
, " = A1 + A0, ");
3679 OUTS (outf
, dregs (dst0
));
3680 OUTS (outf
, " = A1 - A0");
3683 else if (aop
== 1 && aopcde
== 17)
3685 OUTS (outf
, dregs (dst1
));
3686 OUTS (outf
, " = A0 + A1, ");
3687 OUTS (outf
, dregs (dst0
));
3688 OUTS (outf
, " = A0 - A1");
3691 else if (aop
== 0 && aopcde
== 18)
3693 OUTS (outf
, "SAA (");
3694 OUTS (outf
, dregs (src0
+ 1));
3696 OUTS (outf
, imm5d (src0
));
3698 OUTS (outf
, dregs (src1
+ 1));
3700 OUTS (outf
, imm5d (src1
));
3704 else if (aop
== 3 && aopcde
== 18)
3705 OUTS (outf
, "DISALGNEXCPT");
3707 else if (aop
== 0 && aopcde
== 20)
3709 OUTS (outf
, dregs (dst0
));
3710 OUTS (outf
, " = BYTEOP1P (");
3711 OUTS (outf
, dregs (src0
+ 1));
3713 OUTS (outf
, imm5d (src0
));
3715 OUTS (outf
, dregs (src1
+ 1));
3717 OUTS (outf
, imm5d (src1
));
3721 else if (aop
== 1 && aopcde
== 20)
3723 OUTS (outf
, dregs (dst0
));
3724 OUTS (outf
, " = BYTEOP1P (");
3725 OUTS (outf
, dregs (src0
+ 1));
3727 OUTS (outf
, imm5d (src0
));
3729 OUTS (outf
, dregs (src1
+ 1));
3731 OUTS (outf
, imm5d (src1
));
3732 OUTS (outf
, ") (T");
3734 OUTS (outf
, ", R)");
3738 else if (aop
== 0 && aopcde
== 21)
3741 OUTS (outf
, dregs (dst1
));
3743 OUTS (outf
, dregs (dst0
));
3744 OUTS (outf
, ") = BYTEOP16P (");
3745 OUTS (outf
, dregs (src0
+ 1));
3747 OUTS (outf
, imm5d (src0
));
3749 OUTS (outf
, dregs (src1
+ 1));
3751 OUTS (outf
, imm5d (src1
));
3755 else if (aop
== 1 && aopcde
== 21)
3758 OUTS (outf
, dregs (dst1
));
3760 OUTS (outf
, dregs (dst0
));
3761 OUTS (outf
, ") = BYTEOP16M (");
3762 OUTS (outf
, dregs (src0
+ 1));
3764 OUTS (outf
, imm5d (src0
));
3766 OUTS (outf
, dregs (src1
+ 1));
3768 OUTS (outf
, imm5d (src1
));
3772 else if (aop
== 2 && aopcde
== 7)
3774 OUTS (outf
, dregs (dst0
));
3775 OUTS (outf
, " = ABS ");
3776 OUTS (outf
, dregs (src0
));
3778 else if (aop
== 1 && aopcde
== 7)
3780 OUTS (outf
, dregs (dst0
));
3781 OUTS (outf
, " = MIN (");
3782 OUTS (outf
, dregs (src0
));
3784 OUTS (outf
, dregs (src1
));
3787 else if (aop
== 0 && aopcde
== 7)
3789 OUTS (outf
, dregs (dst0
));
3790 OUTS (outf
, " = MAX (");
3791 OUTS (outf
, dregs (src0
));
3793 OUTS (outf
, dregs (src1
));
3796 else if (aop
== 2 && aopcde
== 6)
3798 OUTS (outf
, dregs (dst0
));
3799 OUTS (outf
, " = ABS ");
3800 OUTS (outf
, dregs (src0
));
3801 OUTS (outf
, " (V)");
3803 else if (aop
== 1 && aopcde
== 6)
3805 OUTS (outf
, dregs (dst0
));
3806 OUTS (outf
, " = MIN (");
3807 OUTS (outf
, dregs (src0
));
3809 OUTS (outf
, dregs (src1
));
3810 OUTS (outf
, ") (V)");
3812 else if (aop
== 0 && aopcde
== 6)
3814 OUTS (outf
, dregs (dst0
));
3815 OUTS (outf
, " = MAX (");
3816 OUTS (outf
, dregs (src0
));
3818 OUTS (outf
, dregs (src1
));
3819 OUTS (outf
, ") (V)");
3821 else if (HL
== 1 && aopcde
== 1)
3823 OUTS (outf
, dregs (dst1
));
3825 OUTS (outf
, dregs (src0
));
3826 OUTS (outf
, " +|- ");
3827 OUTS (outf
, dregs (src1
));
3829 OUTS (outf
, dregs (dst0
));
3831 OUTS (outf
, dregs (src0
));
3832 OUTS (outf
, " -|+ ");
3833 OUTS (outf
, dregs (src1
));
3834 amod0amod2 (s
, x
, aop
, outf
);
3836 else if (aop
== 0 && aopcde
== 4)
3838 OUTS (outf
, dregs (dst0
));
3840 OUTS (outf
, dregs (src0
));
3842 OUTS (outf
, dregs (src1
));
3845 else if (aop
== 0 && aopcde
== 0)
3847 OUTS (outf
, dregs (dst0
));
3849 OUTS (outf
, dregs (src0
));
3850 OUTS (outf
, " +|+ ");
3851 OUTS (outf
, dregs (src1
));
3854 else if (aop
== 0 && aopcde
== 24)
3856 OUTS (outf
, dregs (dst0
));
3857 OUTS (outf
, " = BYTEPACK (");
3858 OUTS (outf
, dregs (src0
));
3860 OUTS (outf
, dregs (src1
));
3863 else if (aop
== 1 && aopcde
== 24)
3866 OUTS (outf
, dregs (dst1
));
3868 OUTS (outf
, dregs (dst0
));
3869 OUTS (outf
, ") = BYTEUNPACK ");
3870 OUTS (outf
, dregs (src0
+ 1));
3872 OUTS (outf
, imm5d (src0
));
3875 else if (aopcde
== 13)
3878 OUTS (outf
, dregs (dst1
));
3880 OUTS (outf
, dregs (dst0
));
3881 OUTS (outf
, ") = SEARCH ");
3882 OUTS (outf
, dregs (src0
));
3884 searchmod (aop
, outf
);
3894 decode_dsp32shift_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
3897 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
3898 | 1 | 1 | 0 | 0 |.M.| 1 | 1 | 0 | 0 | - | - |.sopcde............|
3899 |.sop...|.HLs...|.dst0......| - | - | - |.src0......|.src1......|
3900 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
3901 int HLs
= ((iw1
>> DSP32Shift_HLs_bits
) & DSP32Shift_HLs_mask
);
3902 int sop
= ((iw1
>> DSP32Shift_sop_bits
) & DSP32Shift_sop_mask
);
3903 int src0
= ((iw1
>> DSP32Shift_src0_bits
) & DSP32Shift_src0_mask
);
3904 int src1
= ((iw1
>> DSP32Shift_src1_bits
) & DSP32Shift_src1_mask
);
3905 int dst0
= ((iw1
>> DSP32Shift_dst0_bits
) & DSP32Shift_dst0_mask
);
3906 int sopcde
= ((iw0
>> (DSP32Shift_sopcde_bits
- 16)) & DSP32Shift_sopcde_mask
);
3907 const char *acc01
= (HLs
& 1) == 0 ? "A0" : "A1";
3909 if (HLs
== 0 && sop
== 0 && sopcde
== 0)
3911 OUTS (outf
, dregs_lo (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
== 1 && sop
== 0 && sopcde
== 0)
3919 OUTS (outf
, dregs_lo (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
== 2 && sop
== 0 && sopcde
== 0)
3927 OUTS (outf
, dregs_hi (dst0
));
3928 OUTS (outf
, " = ASHIFT ");
3929 OUTS (outf
, dregs_lo (src1
));
3930 OUTS (outf
, " BY ");
3931 OUTS (outf
, dregs_lo (src0
));
3933 else if (HLs
== 3 && sop
== 0 && sopcde
== 0)
3935 OUTS (outf
, dregs_hi (dst0
));
3936 OUTS (outf
, " = ASHIFT ");
3937 OUTS (outf
, dregs_hi (src1
));
3938 OUTS (outf
, " BY ");
3939 OUTS (outf
, dregs_lo (src0
));
3941 else if (HLs
== 0 && sop
== 1 && sopcde
== 0)
3943 OUTS (outf
, dregs_lo (dst0
));
3944 OUTS (outf
, " = ASHIFT ");
3945 OUTS (outf
, dregs_lo (src1
));
3946 OUTS (outf
, " BY ");
3947 OUTS (outf
, dregs_lo (src0
));
3948 OUTS (outf
, " (S)");
3950 else if (HLs
== 1 && sop
== 1 && sopcde
== 0)
3952 OUTS (outf
, dregs_lo (dst0
));
3953 OUTS (outf
, " = ASHIFT ");
3954 OUTS (outf
, dregs_hi (src1
));
3955 OUTS (outf
, " BY ");
3956 OUTS (outf
, dregs_lo (src0
));
3957 OUTS (outf
, " (S)");
3959 else if (HLs
== 2 && sop
== 1 && sopcde
== 0)
3961 OUTS (outf
, dregs_hi (dst0
));
3962 OUTS (outf
, " = ASHIFT ");
3963 OUTS (outf
, dregs_lo (src1
));
3964 OUTS (outf
, " BY ");
3965 OUTS (outf
, dregs_lo (src0
));
3966 OUTS (outf
, " (S)");
3968 else if (HLs
== 3 && sop
== 1 && sopcde
== 0)
3970 OUTS (outf
, dregs_hi (dst0
));
3971 OUTS (outf
, " = ASHIFT ");
3972 OUTS (outf
, dregs_hi (src1
));
3973 OUTS (outf
, " BY ");
3974 OUTS (outf
, dregs_lo (src0
));
3975 OUTS (outf
, " (S)");
3977 else if (sop
== 2 && sopcde
== 0)
3979 OUTS (outf
, (HLs
& 2) == 0 ? dregs_lo (dst0
) : dregs_hi (dst0
));
3980 OUTS (outf
, " = LSHIFT ");
3981 OUTS (outf
, (HLs
& 1) == 0 ? dregs_lo (src1
) : dregs_hi (src1
));
3982 OUTS (outf
, " BY ");
3983 OUTS (outf
, dregs_lo (src0
));
3985 else if (sop
== 0 && sopcde
== 3)
3988 OUTS (outf
, " = ASHIFT ");
3990 OUTS (outf
, " BY ");
3991 OUTS (outf
, dregs_lo (src0
));
3993 else if (sop
== 1 && sopcde
== 3)
3996 OUTS (outf
, " = LSHIFT ");
3998 OUTS (outf
, " BY ");
3999 OUTS (outf
, dregs_lo (src0
));
4001 else if (sop
== 2 && sopcde
== 3)
4004 OUTS (outf
, " = ROT ");
4006 OUTS (outf
, " BY ");
4007 OUTS (outf
, dregs_lo (src0
));
4009 else if (sop
== 3 && sopcde
== 3)
4011 OUTS (outf
, dregs (dst0
));
4012 OUTS (outf
, " = ROT ");
4013 OUTS (outf
, dregs (src1
));
4014 OUTS (outf
, " BY ");
4015 OUTS (outf
, dregs_lo (src0
));
4017 else if (sop
== 1 && sopcde
== 1)
4019 OUTS (outf
, dregs (dst0
));
4020 OUTS (outf
, " = ASHIFT ");
4021 OUTS (outf
, dregs (src1
));
4022 OUTS (outf
, " BY ");
4023 OUTS (outf
, dregs_lo (src0
));
4024 OUTS (outf
, " (V, S)");
4026 else if (sop
== 0 && sopcde
== 1)
4028 OUTS (outf
, dregs (dst0
));
4029 OUTS (outf
, " = ASHIFT ");
4030 OUTS (outf
, dregs (src1
));
4031 OUTS (outf
, " BY ");
4032 OUTS (outf
, dregs_lo (src0
));
4033 OUTS (outf
, " (V)");
4035 else if (sop
== 0 && sopcde
== 2)
4037 OUTS (outf
, dregs (dst0
));
4038 OUTS (outf
, " = ASHIFT ");
4039 OUTS (outf
, dregs (src1
));
4040 OUTS (outf
, " BY ");
4041 OUTS (outf
, dregs_lo (src0
));
4043 else if (sop
== 1 && sopcde
== 2)
4045 OUTS (outf
, dregs (dst0
));
4046 OUTS (outf
, " = ASHIFT ");
4047 OUTS (outf
, dregs (src1
));
4048 OUTS (outf
, " BY ");
4049 OUTS (outf
, dregs_lo (src0
));
4050 OUTS (outf
, " (S)");
4052 else if (sop
== 2 && sopcde
== 2)
4054 OUTS (outf
, dregs (dst0
));
4055 OUTS (outf
, " = LSHIFT ");
4056 OUTS (outf
, dregs (src1
));
4057 OUTS (outf
, " BY ");
4058 OUTS (outf
, dregs_lo (src0
));
4060 else if (sop
== 3 && sopcde
== 2)
4062 OUTS (outf
, dregs (dst0
));
4063 OUTS (outf
, " = ROT ");
4064 OUTS (outf
, dregs (src1
));
4065 OUTS (outf
, " BY ");
4066 OUTS (outf
, dregs_lo (src0
));
4068 else if (sop
== 2 && sopcde
== 1)
4070 OUTS (outf
, dregs (dst0
));
4071 OUTS (outf
, " = LSHIFT ");
4072 OUTS (outf
, dregs (src1
));
4073 OUTS (outf
, " BY ");
4074 OUTS (outf
, dregs_lo (src0
));
4075 OUTS (outf
, " (V)");
4077 else if (sop
== 0 && sopcde
== 4)
4079 OUTS (outf
, dregs (dst0
));
4080 OUTS (outf
, " = PACK (");
4081 OUTS (outf
, dregs_lo (src1
));
4083 OUTS (outf
, dregs_lo (src0
));
4086 else if (sop
== 1 && sopcde
== 4)
4088 OUTS (outf
, dregs (dst0
));
4089 OUTS (outf
, " = PACK (");
4090 OUTS (outf
, dregs_lo (src1
));
4092 OUTS (outf
, dregs_hi (src0
));
4095 else if (sop
== 2 && sopcde
== 4)
4097 OUTS (outf
, dregs (dst0
));
4098 OUTS (outf
, " = PACK (");
4099 OUTS (outf
, dregs_hi (src1
));
4101 OUTS (outf
, dregs_lo (src0
));
4104 else if (sop
== 3 && sopcde
== 4)
4106 OUTS (outf
, dregs (dst0
));
4107 OUTS (outf
, " = PACK (");
4108 OUTS (outf
, dregs_hi (src1
));
4110 OUTS (outf
, dregs_hi (src0
));
4113 else if (sop
== 0 && sopcde
== 5)
4115 OUTS (outf
, dregs_lo (dst0
));
4116 OUTS (outf
, " = SIGNBITS ");
4117 OUTS (outf
, dregs (src1
));
4119 else if (sop
== 1 && sopcde
== 5)
4121 OUTS (outf
, dregs_lo (dst0
));
4122 OUTS (outf
, " = SIGNBITS ");
4123 OUTS (outf
, dregs_lo (src1
));
4125 else if (sop
== 2 && sopcde
== 5)
4127 OUTS (outf
, dregs_lo (dst0
));
4128 OUTS (outf
, " = SIGNBITS ");
4129 OUTS (outf
, dregs_hi (src1
));
4131 else if (sop
== 0 && sopcde
== 6)
4133 OUTS (outf
, dregs_lo (dst0
));
4134 OUTS (outf
, " = SIGNBITS A0");
4136 else if (sop
== 1 && sopcde
== 6)
4138 OUTS (outf
, dregs_lo (dst0
));
4139 OUTS (outf
, " = SIGNBITS A1");
4141 else if (sop
== 3 && sopcde
== 6)
4143 OUTS (outf
, dregs_lo (dst0
));
4144 OUTS (outf
, " = ONES ");
4145 OUTS (outf
, dregs (src1
));
4147 else if (sop
== 0 && sopcde
== 7)
4149 OUTS (outf
, dregs_lo (dst0
));
4150 OUTS (outf
, " = EXPADJ (");
4151 OUTS (outf
, dregs (src1
));
4153 OUTS (outf
, dregs_lo (src0
));
4156 else if (sop
== 1 && sopcde
== 7)
4158 OUTS (outf
, dregs_lo (dst0
));
4159 OUTS (outf
, " = EXPADJ (");
4160 OUTS (outf
, dregs (src1
));
4162 OUTS (outf
, dregs_lo (src0
));
4163 OUTS (outf
, ") (V)");
4165 else if (sop
== 2 && sopcde
== 7)
4167 OUTS (outf
, dregs_lo (dst0
));
4168 OUTS (outf
, " = EXPADJ (");
4169 OUTS (outf
, dregs_lo (src1
));
4171 OUTS (outf
, dregs_lo (src0
));
4174 else if (sop
== 3 && sopcde
== 7)
4176 OUTS (outf
, dregs_lo (dst0
));
4177 OUTS (outf
, " = EXPADJ (");
4178 OUTS (outf
, dregs_hi (src1
));
4180 OUTS (outf
, dregs_lo (src0
));
4183 else if (sop
== 0 && sopcde
== 8)
4185 OUTS (outf
, "BITMUX (");
4186 OUTS (outf
, dregs (src0
));
4188 OUTS (outf
, dregs (src1
));
4189 OUTS (outf
, ", A0) (ASR)");
4191 else if (sop
== 1 && sopcde
== 8)
4193 OUTS (outf
, "BITMUX (");
4194 OUTS (outf
, dregs (src0
));
4196 OUTS (outf
, dregs (src1
));
4197 OUTS (outf
, ", A0) (ASL)");
4199 else if (sop
== 0 && sopcde
== 9)
4201 OUTS (outf
, dregs_lo (dst0
));
4202 OUTS (outf
, " = VIT_MAX (");
4203 OUTS (outf
, dregs (src1
));
4204 OUTS (outf
, ") (ASL)");
4206 else if (sop
== 1 && sopcde
== 9)
4208 OUTS (outf
, dregs_lo (dst0
));
4209 OUTS (outf
, " = VIT_MAX (");
4210 OUTS (outf
, dregs (src1
));
4211 OUTS (outf
, ") (ASR)");
4213 else if (sop
== 2 && sopcde
== 9)
4215 OUTS (outf
, dregs (dst0
));
4216 OUTS (outf
, " = VIT_MAX (");
4217 OUTS (outf
, dregs (src1
));
4219 OUTS (outf
, dregs (src0
));
4220 OUTS (outf
, ") (ASL)");
4222 else if (sop
== 3 && sopcde
== 9)
4224 OUTS (outf
, dregs (dst0
));
4225 OUTS (outf
, " = VIT_MAX (");
4226 OUTS (outf
, dregs (src1
));
4228 OUTS (outf
, dregs (src0
));
4229 OUTS (outf
, ") (ASR)");
4231 else if (sop
== 0 && sopcde
== 10)
4233 OUTS (outf
, dregs (dst0
));
4234 OUTS (outf
, " = EXTRACT (");
4235 OUTS (outf
, dregs (src1
));
4237 OUTS (outf
, dregs_lo (src0
));
4238 OUTS (outf
, ") (Z)");
4240 else if (sop
== 1 && sopcde
== 10)
4242 OUTS (outf
, dregs (dst0
));
4243 OUTS (outf
, " = EXTRACT (");
4244 OUTS (outf
, dregs (src1
));
4246 OUTS (outf
, dregs_lo (src0
));
4247 OUTS (outf
, ") (X)");
4249 else if (sop
== 2 && sopcde
== 10)
4251 OUTS (outf
, dregs (dst0
));
4252 OUTS (outf
, " = DEPOSIT (");
4253 OUTS (outf
, dregs (src1
));
4255 OUTS (outf
, dregs (src0
));
4258 else if (sop
== 3 && sopcde
== 10)
4260 OUTS (outf
, dregs (dst0
));
4261 OUTS (outf
, " = DEPOSIT (");
4262 OUTS (outf
, dregs (src1
));
4264 OUTS (outf
, dregs (src0
));
4265 OUTS (outf
, ") (X)");
4267 else if (sop
== 0 && sopcde
== 11)
4269 OUTS (outf
, dregs_lo (dst0
));
4270 OUTS (outf
, " = CC = BXORSHIFT (A0, ");
4271 OUTS (outf
, dregs (src0
));
4274 else if (sop
== 1 && sopcde
== 11)
4276 OUTS (outf
, dregs_lo (dst0
));
4277 OUTS (outf
, " = CC = BXOR (A0, ");
4278 OUTS (outf
, dregs (src0
));
4281 else if (sop
== 0 && sopcde
== 12)
4282 OUTS (outf
, "A0 = BXORSHIFT (A0, A1, CC)");
4284 else if (sop
== 1 && sopcde
== 12)
4286 OUTS (outf
, dregs_lo (dst0
));
4287 OUTS (outf
, " = CC = BXOR (A0, A1, CC)");
4289 else if (sop
== 0 && sopcde
== 13)
4291 OUTS (outf
, dregs (dst0
));
4292 OUTS (outf
, " = ALIGN8 (");
4293 OUTS (outf
, dregs (src1
));
4295 OUTS (outf
, dregs (src0
));
4298 else if (sop
== 1 && sopcde
== 13)
4300 OUTS (outf
, dregs (dst0
));
4301 OUTS (outf
, " = ALIGN16 (");
4302 OUTS (outf
, dregs (src1
));
4304 OUTS (outf
, dregs (src0
));
4307 else if (sop
== 2 && sopcde
== 13)
4309 OUTS (outf
, dregs (dst0
));
4310 OUTS (outf
, " = ALIGN24 (");
4311 OUTS (outf
, dregs (src1
));
4313 OUTS (outf
, dregs (src0
));
4323 decode_dsp32shiftimm_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
4326 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
4327 | 1 | 1 | 0 | 0 |.M.| 1 | 1 | 0 | 1 | - | - |.sopcde............|
4328 |.sop...|.HLs...|.dst0......|.immag.................|.src1......|
4329 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4330 int src1
= ((iw1
>> DSP32ShiftImm_src1_bits
) & DSP32ShiftImm_src1_mask
);
4331 int sop
= ((iw1
>> DSP32ShiftImm_sop_bits
) & DSP32ShiftImm_sop_mask
);
4332 int bit8
= ((iw1
>> 8) & 0x1);
4333 int immag
= ((iw1
>> DSP32ShiftImm_immag_bits
) & DSP32ShiftImm_immag_mask
);
4334 int newimmag
= (-(iw1
>> DSP32ShiftImm_immag_bits
) & DSP32ShiftImm_immag_mask
);
4335 int dst0
= ((iw1
>> DSP32ShiftImm_dst0_bits
) & DSP32ShiftImm_dst0_mask
);
4336 int sopcde
= ((iw0
>> (DSP32ShiftImm_sopcde_bits
- 16)) & DSP32ShiftImm_sopcde_mask
);
4337 int HLs
= ((iw1
>> DSP32ShiftImm_HLs_bits
) & DSP32ShiftImm_HLs_mask
);
4339 if (sop
== 0 && sopcde
== 0)
4341 OUTS (outf
, (HLs
& 2) ? dregs_hi (dst0
) : dregs_lo (dst0
));
4343 OUTS (outf
, (HLs
& 1) ? dregs_hi (src1
) : dregs_lo (src1
));
4344 OUTS (outf
, " >>> ");
4345 OUTS (outf
, uimm4 (newimmag
));
4347 else if (sop
== 1 && sopcde
== 0 && bit8
== 0)
4349 OUTS (outf
, (HLs
& 2) ? dregs_hi (dst0
) : dregs_lo (dst0
));
4351 OUTS (outf
, (HLs
& 1) ? dregs_hi (src1
) : dregs_lo (src1
));
4352 OUTS (outf
, " << ");
4353 OUTS (outf
, uimm4 (immag
));
4354 OUTS (outf
, " (S)");
4356 else if (sop
== 1 && sopcde
== 0 && bit8
== 1)
4358 OUTS (outf
, (HLs
& 2) ? dregs_hi (dst0
) : dregs_lo (dst0
));
4360 OUTS (outf
, (HLs
& 1) ? dregs_hi (src1
) : dregs_lo (src1
));
4361 OUTS (outf
, " >>> ");
4362 OUTS (outf
, uimm4 (newimmag
));
4363 OUTS (outf
, " (S)");
4365 else if (sop
== 2 && sopcde
== 0 && bit8
== 0)
4367 OUTS (outf
, (HLs
& 2) ? dregs_hi (dst0
) : dregs_lo (dst0
));
4369 OUTS (outf
, (HLs
& 1) ? dregs_hi (src1
) : dregs_lo (src1
));
4370 OUTS (outf
, " << ");
4371 OUTS (outf
, uimm4 (immag
));
4373 else if (sop
== 2 && sopcde
== 0 && bit8
== 1)
4375 OUTS (outf
, (HLs
& 2) ? dregs_hi (dst0
) : dregs_lo (dst0
));
4377 OUTS (outf
, (HLs
& 1) ? dregs_hi (src1
) : dregs_lo (src1
));
4378 OUTS (outf
, " >> ");
4379 OUTS (outf
, uimm4 (newimmag
));
4381 else if (sop
== 2 && sopcde
== 3 && HLs
== 1)
4383 OUTS (outf
, "A1 = ROT A1 BY ");
4384 OUTS (outf
, imm6 (immag
));
4386 else if (sop
== 0 && sopcde
== 3 && HLs
== 0 && bit8
== 0)
4388 OUTS (outf
, "A0 = A0 << ");
4389 OUTS (outf
, uimm5 (immag
));
4391 else if (sop
== 0 && sopcde
== 3 && HLs
== 0 && bit8
== 1)
4393 OUTS (outf
, "A0 = A0 >>> ");
4394 OUTS (outf
, uimm5 (newimmag
));
4396 else if (sop
== 0 && sopcde
== 3 && HLs
== 1 && bit8
== 0)
4398 OUTS (outf
, "A1 = A1 << ");
4399 OUTS (outf
, uimm5 (immag
));
4401 else if (sop
== 0 && sopcde
== 3 && HLs
== 1 && bit8
== 1)
4403 OUTS (outf
, "A1 = A1 >>> ");
4404 OUTS (outf
, uimm5 (newimmag
));
4406 else if (sop
== 1 && sopcde
== 3 && HLs
== 0)
4408 OUTS (outf
, "A0 = A0 >> ");
4409 OUTS (outf
, uimm5 (newimmag
));
4411 else if (sop
== 1 && sopcde
== 3 && HLs
== 1)
4413 OUTS (outf
, "A1 = A1 >> ");
4414 OUTS (outf
, uimm5 (newimmag
));
4416 else if (sop
== 2 && sopcde
== 3 && HLs
== 0)
4418 OUTS (outf
, "A0 = ROT A0 BY ");
4419 OUTS (outf
, imm6 (immag
));
4421 else if (sop
== 1 && sopcde
== 1 && bit8
== 0)
4423 OUTS (outf
, dregs (dst0
));
4425 OUTS (outf
, dregs (src1
));
4426 OUTS (outf
, " << ");
4427 OUTS (outf
, uimm5 (immag
));
4428 OUTS (outf
, " (V, S)");
4430 else if (sop
== 1 && sopcde
== 1 && bit8
== 1)
4432 OUTS (outf
, dregs (dst0
));
4434 OUTS (outf
, dregs (src1
));
4435 OUTS (outf
, " >>> ");
4436 OUTS (outf
, imm5 (-immag
));
4437 OUTS (outf
, " (V, S)");
4439 else if (sop
== 2 && sopcde
== 1 && bit8
== 1)
4441 OUTS (outf
, dregs (dst0
));
4443 OUTS (outf
, dregs (src1
));
4444 OUTS (outf
, " >> ");
4445 OUTS (outf
, uimm5 (newimmag
));
4446 OUTS (outf
, " (V)");
4448 else if (sop
== 2 && sopcde
== 1 && bit8
== 0)
4450 OUTS (outf
, dregs (dst0
));
4452 OUTS (outf
, dregs (src1
));
4453 OUTS (outf
, " << ");
4454 OUTS (outf
, imm5 (immag
));
4455 OUTS (outf
, " (V)");
4457 else if (sop
== 0 && sopcde
== 1)
4459 OUTS (outf
, dregs (dst0
));
4461 OUTS (outf
, dregs (src1
));
4462 OUTS (outf
, " >>> ");
4463 OUTS (outf
, uimm5 (newimmag
));
4464 OUTS (outf
, " (V)");
4466 else if (sop
== 1 && sopcde
== 2)
4468 OUTS (outf
, dregs (dst0
));
4470 OUTS (outf
, dregs (src1
));
4471 OUTS (outf
, " << ");
4472 OUTS (outf
, uimm5 (immag
));
4473 OUTS (outf
, " (S)");
4475 else if (sop
== 2 && sopcde
== 2 && bit8
== 1)
4477 OUTS (outf
, dregs (dst0
));
4479 OUTS (outf
, dregs (src1
));
4480 OUTS (outf
, " >> ");
4481 OUTS (outf
, uimm5 (newimmag
));
4483 else if (sop
== 2 && sopcde
== 2 && bit8
== 0)
4485 OUTS (outf
, dregs (dst0
));
4487 OUTS (outf
, dregs (src1
));
4488 OUTS (outf
, " << ");
4489 OUTS (outf
, uimm5 (immag
));
4491 else if (sop
== 3 && sopcde
== 2)
4493 OUTS (outf
, dregs (dst0
));
4494 OUTS (outf
, " = ROT ");
4495 OUTS (outf
, dregs (src1
));
4496 OUTS (outf
, " BY ");
4497 OUTS (outf
, imm6 (immag
));
4499 else if (sop
== 0 && sopcde
== 2)
4501 OUTS (outf
, dregs (dst0
));
4503 OUTS (outf
, dregs (src1
));
4504 OUTS (outf
, " >>> ");
4505 OUTS (outf
, uimm5 (newimmag
));
4514 decode_pseudoDEBUG_0 (TIword iw0
, disassemble_info
*outf
)
4517 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
4518 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 |.fn....|.grp.......|.reg.......|
4519 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4520 int fn
= ((iw0
>> PseudoDbg_fn_bits
) & PseudoDbg_fn_mask
);
4521 int grp
= ((iw0
>> PseudoDbg_grp_bits
) & PseudoDbg_grp_mask
);
4522 int reg
= ((iw0
>> PseudoDbg_reg_bits
) & PseudoDbg_reg_mask
);
4527 if (reg
== 0 && fn
== 3)
4528 OUTS (outf
, "DBG A0");
4530 else if (reg
== 1 && fn
== 3)
4531 OUTS (outf
, "DBG A1");
4533 else if (reg
== 3 && fn
== 3)
4534 OUTS (outf
, "ABORT");
4536 else if (reg
== 4 && fn
== 3)
4539 else if (reg
== 5 && fn
== 3)
4540 OUTS (outf
, "DBGHALT");
4542 else if (reg
== 6 && fn
== 3)
4544 OUTS (outf
, "DBGCMPLX (");
4545 OUTS (outf
, dregs (grp
));
4548 else if (reg
== 7 && fn
== 3)
4551 else if (grp
== 0 && fn
== 2)
4553 OUTS (outf
, "OUTC ");
4554 OUTS (outf
, dregs (reg
));
4558 OUTS (outf
, "DBG ");
4559 OUTS (outf
, allregs (reg
, grp
));
4563 OUTS (outf
, "PRNT ");
4564 OUTS (outf
, allregs (reg
, grp
));
4573 decode_pseudoOChar_0 (TIword iw0
, disassemble_info
*outf
)
4576 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
4577 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 1 |.ch............................|
4578 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4579 int ch
= ((iw0
>> PseudoChr_ch_bits
) & PseudoChr_ch_mask
);
4584 OUTS (outf
, "OUTC ");
4585 OUTS (outf
, uimm8 (ch
));
4591 decode_pseudodbg_assert_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
4594 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
4595 | 1 | 1 | 1 | 1 | 0 | - | - | - | dbgop |.grp.......|.regtest...|
4596 |.expected......................................................|
4597 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4598 int expected
= ((iw1
>> PseudoDbg_Assert_expected_bits
) & PseudoDbg_Assert_expected_mask
);
4599 int dbgop
= ((iw0
>> (PseudoDbg_Assert_dbgop_bits
- 16)) & PseudoDbg_Assert_dbgop_mask
);
4600 int grp
= ((iw0
>> (PseudoDbg_Assert_grp_bits
- 16)) & PseudoDbg_Assert_grp_mask
);
4601 int regtest
= ((iw0
>> (PseudoDbg_Assert_regtest_bits
- 16)) & PseudoDbg_Assert_regtest_mask
);
4608 OUTS (outf
, "DBGA (");
4609 OUTS (outf
, regs_lo (regtest
, grp
));
4611 OUTS (outf
, uimm16 (expected
));
4614 else if (dbgop
== 1)
4616 OUTS (outf
, "DBGA (");
4617 OUTS (outf
, regs_hi (regtest
, grp
));
4619 OUTS (outf
, uimm16 (expected
));
4622 else if (dbgop
== 2)
4624 OUTS (outf
, "DBGAL (");
4625 OUTS (outf
, allregs (regtest
, grp
));
4627 OUTS (outf
, uimm16 (expected
));
4630 else if (dbgop
== 3)
4632 OUTS (outf
, "DBGAH (");
4633 OUTS (outf
, allregs (regtest
, grp
));
4635 OUTS (outf
, uimm16 (expected
));
4644 _print_insn_bfin (bfd_vma pc
, disassemble_info
*outf
)
4652 status
= (*outf
->read_memory_func
) (pc
& ~0x1, buf
, 2, outf
);
4655 status
= (*outf
->read_memory_func
) ((pc
+ 2) & ~0x1, buf
+ 2, 2, outf
);
4659 iw0
= bfd_getl16 (buf
);
4660 iw1
= bfd_getl16 (buf
+ 2);
4662 if ((iw0
& 0xf7ff) == 0xc003 && iw1
== 0x1800)
4666 OUTS (outf
, "ILLEGAL");
4669 OUTS (outf
, "MNOP");
4672 else if ((iw0
& 0xff00) == 0x0000)
4673 rv
= decode_ProgCtrl_0 (iw0
, outf
);
4674 else if ((iw0
& 0xffc0) == 0x0240)
4675 rv
= decode_CaCTRL_0 (iw0
, outf
);
4676 else if ((iw0
& 0xff80) == 0x0100)
4677 rv
= decode_PushPopReg_0 (iw0
, outf
);
4678 else if ((iw0
& 0xfe00) == 0x0400)
4679 rv
= decode_PushPopMultiple_0 (iw0
, outf
);
4680 else if ((iw0
& 0xfe00) == 0x0600)
4681 rv
= decode_ccMV_0 (iw0
, outf
);
4682 else if ((iw0
& 0xf800) == 0x0800)
4683 rv
= decode_CCflag_0 (iw0
, outf
);
4684 else if ((iw0
& 0xffe0) == 0x0200)
4685 rv
= decode_CC2dreg_0 (iw0
, outf
);
4686 else if ((iw0
& 0xff00) == 0x0300)
4687 rv
= decode_CC2stat_0 (iw0
, outf
);
4688 else if ((iw0
& 0xf000) == 0x1000)
4689 rv
= decode_BRCC_0 (iw0
, pc
, outf
);
4690 else if ((iw0
& 0xf000) == 0x2000)
4691 rv
= decode_UJUMP_0 (iw0
, pc
, outf
);
4692 else if ((iw0
& 0xf000) == 0x3000)
4693 rv
= decode_REGMV_0 (iw0
, outf
);
4694 else if ((iw0
& 0xfc00) == 0x4000)
4695 rv
= decode_ALU2op_0 (iw0
, outf
);
4696 else if ((iw0
& 0xfe00) == 0x4400)
4697 rv
= decode_PTR2op_0 (iw0
, outf
);
4698 else if ((iw0
& 0xf800) == 0x4800)
4699 rv
= decode_LOGI2op_0 (iw0
, outf
);
4700 else if ((iw0
& 0xf000) == 0x5000)
4701 rv
= decode_COMP3op_0 (iw0
, outf
);
4702 else if ((iw0
& 0xf800) == 0x6000)
4703 rv
= decode_COMPI2opD_0 (iw0
, outf
);
4704 else if ((iw0
& 0xf800) == 0x6800)
4705 rv
= decode_COMPI2opP_0 (iw0
, outf
);
4706 else if ((iw0
& 0xf000) == 0x8000)
4707 rv
= decode_LDSTpmod_0 (iw0
, outf
);
4708 else if ((iw0
& 0xff60) == 0x9e60)
4709 rv
= decode_dagMODim_0 (iw0
, outf
);
4710 else if ((iw0
& 0xfff0) == 0x9f60)
4711 rv
= decode_dagMODik_0 (iw0
, outf
);
4712 else if ((iw0
& 0xfc00) == 0x9c00)
4713 rv
= decode_dspLDST_0 (iw0
, outf
);
4714 else if ((iw0
& 0xf000) == 0x9000)
4715 rv
= decode_LDST_0 (iw0
, outf
);
4716 else if ((iw0
& 0xfc00) == 0xb800)
4717 rv
= decode_LDSTiiFP_0 (iw0
, outf
);
4718 else if ((iw0
& 0xe000) == 0xA000)
4719 rv
= decode_LDSTii_0 (iw0
, outf
);
4720 else if ((iw0
& 0xff80) == 0xe080 && (iw1
& 0x0C00) == 0x0000)
4721 rv
= decode_LoopSetup_0 (iw0
, iw1
, pc
, outf
);
4722 else if ((iw0
& 0xff00) == 0xe100 && (iw1
& 0x0000) == 0x0000)
4723 rv
= decode_LDIMMhalf_0 (iw0
, iw1
, outf
);
4724 else if ((iw0
& 0xfe00) == 0xe200 && (iw1
& 0x0000) == 0x0000)
4725 rv
= decode_CALLa_0 (iw0
, iw1
, pc
, outf
);
4726 else if ((iw0
& 0xfc00) == 0xe400 && (iw1
& 0x0000) == 0x0000)
4727 rv
= decode_LDSTidxI_0 (iw0
, iw1
, outf
);
4728 else if ((iw0
& 0xfffe) == 0xe800 && (iw1
& 0x0000) == 0x0000)
4729 rv
= decode_linkage_0 (iw0
, iw1
, outf
);
4730 else if ((iw0
& 0xf600) == 0xc000 && (iw1
& 0x0000) == 0x0000)
4731 rv
= decode_dsp32mac_0 (iw0
, iw1
, outf
);
4732 else if ((iw0
& 0xf600) == 0xc200 && (iw1
& 0x0000) == 0x0000)
4733 rv
= decode_dsp32mult_0 (iw0
, iw1
, outf
);
4734 else if ((iw0
& 0xf7c0) == 0xc400 && (iw1
& 0x0000) == 0x0000)
4735 rv
= decode_dsp32alu_0 (iw0
, iw1
, outf
);
4736 else if ((iw0
& 0xf780) == 0xc600 && (iw1
& 0x01c0) == 0x0000)
4737 rv
= decode_dsp32shift_0 (iw0
, iw1
, outf
);
4738 else if ((iw0
& 0xf780) == 0xc680 && (iw1
& 0x0000) == 0x0000)
4739 rv
= decode_dsp32shiftimm_0 (iw0
, iw1
, outf
);
4740 else if ((iw0
& 0xff00) == 0xf800)
4741 rv
= decode_pseudoDEBUG_0 (iw0
, outf
);
4742 else if ((iw0
& 0xFF00) == 0xF900)
4743 rv
= decode_pseudoOChar_0 (iw0
, outf
);
4744 else if ((iw0
& 0xFF00) == 0xf000 && (iw1
& 0x0000) == 0x0000)
4745 rv
= decode_pseudodbg_assert_0 (iw0
, iw1
, outf
);
4748 OUTS (outf
, "ILLEGAL");
4754 print_insn_bfin (bfd_vma pc
, disassemble_info
*outf
)
4761 status
= (*outf
->read_memory_func
) (pc
& ~0x01, buf
, 2, outf
);
4764 iw0
= bfd_getl16 (buf
);
4766 count
+= _print_insn_bfin (pc
, outf
);
4768 /* Proper display of multiple issue instructions. */
4770 if (count
== 4 && (iw0
& 0xc000) == 0xc000 && (iw0
& BIT_MULTI_INS
)
4771 && ((iw0
& 0xe800) != 0xe800 /* Not Linkage. */ ))
4777 OUTS (outf
, " || ");
4778 len
= _print_insn_bfin (pc
+ 4, outf
);
4779 OUTS (outf
, " || ");
4782 len
= _print_insn_bfin (pc
+ 6, outf
);
4790 OUTS (outf
, ";\t\t/* ILLEGAL PARALLEL INSTRUCTION */");