1 /* Disassemble ADI Blackfin Instructions.
2 Copyright 2005, 2006, 2007, 2008, 2009, 2010, 2011
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. */
26 #include "opcode/bfin.h"
38 #define HOST_LONG_WORD_SIZE (sizeof (long) * 8)
39 #define XFIELD(w,p,s) (((w) & ((1 << (s)) - 1) << (p)) >> (p))
40 #define SIGNEXTEND(v, n) ((v << (HOST_LONG_WORD_SIZE - (n))) >> (HOST_LONG_WORD_SIZE - (n)))
41 #define MASKBITS(val, bits) (val & ((1 << bits) - 1))
45 typedef unsigned int bu32
;
47 static char comment
= 0;
48 static char parallel
= 0;
52 c_0
, c_1
, c_4
, c_2
, c_uimm2
, c_uimm3
, c_imm3
, c_pcrel4
,
53 c_imm4
, c_uimm4s4
, c_uimm4s4d
, c_uimm4
, c_uimm4s2
, c_negimm5s4
, c_imm5
, c_imm5d
, c_uimm5
, c_imm6
,
54 c_imm7
, c_imm7d
, c_imm8
, c_uimm8
, c_pcrel8
, c_uimm8s4
, c_pcrel8s4
, c_lppcrel10
, c_pcrel10
,
55 c_pcrel12
, c_imm16s4
, c_luimm16
, c_imm16
, c_imm16d
, c_huimm16
, c_rimm16
, c_imm16s2
, c_uimm16s4
,
56 c_uimm16s4d
, c_uimm16
, c_pcrel24
, c_uimm32
, c_imm32
, c_huimm32
, c_huimm32e
,
73 } constant_formats
[] =
75 { "0", 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
76 { "1", 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
77 { "4", 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
78 { "2", 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
79 { "uimm2", 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
80 { "uimm3", 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
81 { "imm3", 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
82 { "pcrel4", 4, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0},
83 { "imm4", 4, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
84 { "uimm4s4", 4, 0, 0, 0, 2, 0, 0, 1, 0, 0, 0},
85 { "uimm4s4d", 4, 0, 0, 0, 2, 0, 0, 1, 1, 0, 0},
86 { "uimm4", 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
87 { "uimm4s2", 4, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0},
88 { "negimm5s4", 5, 0, 1, 0, 2, 0, 1, 0, 0, 0, 0},
89 { "imm5", 5, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
90 { "imm5d", 5, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0},
91 { "uimm5", 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
92 { "imm6", 6, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
93 { "imm7", 7, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
94 { "imm7d", 7, 0, 1, 0, 0, 0, 0, 0, 1, 3, 0},
95 { "imm8", 8, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
96 { "uimm8", 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
97 { "pcrel8", 8, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0},
98 { "uimm8s4", 8, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0},
99 { "pcrel8s4", 8, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0},
100 { "lppcrel10", 10, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0},
101 { "pcrel10", 10, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0},
102 { "pcrel12", 12, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0},
103 { "imm16s4", 16, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0},
104 { "luimm16", 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
105 { "imm16", 16, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
106 { "imm16d", 16, 0, 1, 0, 0, 0, 0, 0, 1, 3, 0},
107 { "huimm16", 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
108 { "rimm16", 16, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0},
109 { "imm16s2", 16, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0},
110 { "uimm16s4", 16, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0},
111 { "uimm16s4d", 16, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0},
112 { "uimm16", 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
113 { "pcrel24", 24, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0},
114 { "uimm32", 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
115 { "imm32", 32, 0, 1, 0, 0, 0, 0, 0, 1, 3, 0},
116 { "huimm32", 32, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
117 { "huimm32e", 32, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
121 fmtconst (const_forms_t cf
, TIword x
, bfd_vma pc
, disassemble_info
*outf
)
125 if (constant_formats
[cf
].reloc
)
127 bfd_vma ea
= (((constant_formats
[cf
].pcrel
? SIGNEXTEND (x
, constant_formats
[cf
].nbits
)
128 : x
) + constant_formats
[cf
].offset
) << constant_formats
[cf
].scale
);
129 if (constant_formats
[cf
].pcrel
)
132 /* truncate to 32-bits for proper symbol lookup/matching */
135 if (outf
->symbol_at_address_func (ea
, outf
) || !constant_formats
[cf
].exact
)
137 outf
->print_address_func (ea
, outf
);
142 sprintf (buf
, "%lx", (unsigned long) x
);
147 /* Negative constants have an implied sign bit. */
148 if (constant_formats
[cf
].negative
)
150 int nb
= constant_formats
[cf
].nbits
+ 1;
152 x
= x
| (1 << constant_formats
[cf
].nbits
);
153 x
= SIGNEXTEND (x
, nb
);
156 x
= constant_formats
[cf
].issigned
? SIGNEXTEND (x
, constant_formats
[cf
].nbits
) : x
;
158 if (constant_formats
[cf
].offset
)
159 x
+= constant_formats
[cf
].offset
;
161 if (constant_formats
[cf
].scale
)
162 x
<<= constant_formats
[cf
].scale
;
164 if (constant_formats
[cf
].decimal
)
166 if (constant_formats
[cf
].leading
)
169 sprintf (ps
, "%%%ii", constant_formats
[cf
].leading
);
170 sprintf (buf
, ps
, x
);
173 sprintf (buf
, "%li", x
);
177 if (constant_formats
[cf
].issigned
&& x
< 0)
178 sprintf (buf
, "-0x%x", abs (x
));
180 sprintf (buf
, "0x%lx", (unsigned long) x
);
187 fmtconst_val (const_forms_t cf
, unsigned int x
, unsigned int pc
)
189 if (0 && constant_formats
[cf
].reloc
)
191 bu32 ea
= (((constant_formats
[cf
].pcrel
192 ? SIGNEXTEND (x
, constant_formats
[cf
].nbits
)
193 : x
) + constant_formats
[cf
].offset
)
194 << constant_formats
[cf
].scale
);
195 if (constant_formats
[cf
].pcrel
)
201 /* Negative constants have an implied sign bit. */
202 if (constant_formats
[cf
].negative
)
204 int nb
= constant_formats
[cf
].nbits
+ 1;
205 x
= x
| (1 << constant_formats
[cf
].nbits
);
206 x
= SIGNEXTEND (x
, nb
);
208 else if (constant_formats
[cf
].issigned
)
209 x
= SIGNEXTEND (x
, constant_formats
[cf
].nbits
);
211 x
+= constant_formats
[cf
].offset
;
212 x
<<= constant_formats
[cf
].scale
;
217 enum machine_registers
219 REG_RL0
, REG_RL1
, REG_RL2
, REG_RL3
, REG_RL4
, REG_RL5
, REG_RL6
, REG_RL7
,
220 REG_RH0
, REG_RH1
, REG_RH2
, REG_RH3
, REG_RH4
, REG_RH5
, REG_RH6
, REG_RH7
,
221 REG_R0
, REG_R1
, REG_R2
, REG_R3
, REG_R4
, REG_R5
, REG_R6
, REG_R7
,
222 REG_R1_0
, REG_R3_2
, REG_R5_4
, REG_R7_6
, REG_P0
, REG_P1
, REG_P2
, REG_P3
,
223 REG_P4
, REG_P5
, REG_SP
, REG_FP
, REG_A0x
, REG_A1x
, REG_A0w
, REG_A1w
,
224 REG_A0
, REG_A1
, REG_I0
, REG_I1
, REG_I2
, REG_I3
, REG_M0
, REG_M1
,
225 REG_M2
, REG_M3
, REG_B0
, REG_B1
, REG_B2
, REG_B3
, REG_L0
, REG_L1
,
227 REG_AZ
, REG_AN
, REG_AC0
, REG_AC1
, REG_AV0
, REG_AV1
, REG_AV0S
, REG_AV1S
,
228 REG_AQ
, REG_V
, REG_VS
,
229 REG_sftreset
, REG_omode
, REG_excause
, REG_emucause
, REG_idle_req
, REG_hwerrcause
, REG_CC
, REG_LC0
,
230 REG_LC1
, REG_ASTAT
, REG_RETS
, REG_LT0
, REG_LB0
, REG_LT1
, REG_LB1
,
231 REG_CYCLES
, REG_CYCLES2
, REG_USP
, REG_SEQSTAT
, REG_SYSCFG
, REG_RETI
, REG_RETX
, REG_RETN
,
232 REG_RETE
, REG_EMUDAT
, REG_BR0
, REG_BR1
, REG_BR2
, REG_BR3
, REG_BR4
, REG_BR5
, REG_BR6
,
233 REG_BR7
, REG_PL0
, REG_PL1
, REG_PL2
, REG_PL3
, REG_PL4
, REG_PL5
, REG_SLP
, REG_FLP
,
234 REG_PH0
, REG_PH1
, REG_PH2
, REG_PH3
, REG_PH4
, REG_PH5
, REG_SHP
, REG_FHP
,
235 REG_IL0
, REG_IL1
, REG_IL2
, REG_IL3
, REG_ML0
, REG_ML1
, REG_ML2
, REG_ML3
,
236 REG_BL0
, REG_BL1
, REG_BL2
, REG_BL3
, REG_LL0
, REG_LL1
, REG_LL2
, REG_LL3
,
237 REG_IH0
, REG_IH1
, REG_IH2
, REG_IH3
, REG_MH0
, REG_MH1
, REG_MH2
, REG_MH3
,
238 REG_BH0
, REG_BH1
, REG_BH2
, REG_BH3
, REG_LH0
, REG_LH1
, REG_LH2
, REG_LH3
,
239 REG_AC0_COPY
, REG_V_COPY
, REG_RND_MOD
,
245 rc_dregs_lo
, rc_dregs_hi
, rc_dregs
, rc_dregs_pair
, rc_pregs
, rc_spfp
, rc_dregs_hilo
, rc_accum_ext
,
246 rc_accum_word
, rc_accum
, rc_iregs
, rc_mregs
, rc_bregs
, rc_lregs
, rc_dpregs
, rc_gregs
,
247 rc_regs
, rc_statbits
, rc_ignore_bits
, rc_ccstat
, rc_counters
, rc_dregs2_sysregs1
, rc_open
, rc_sysregs2
,
248 rc_sysregs3
, rc_allregs
,
252 static const char * const reg_names
[] =
254 "R0.L", "R1.L", "R2.L", "R3.L", "R4.L", "R5.L", "R6.L", "R7.L",
255 "R0.H", "R1.H", "R2.H", "R3.H", "R4.H", "R5.H", "R6.H", "R7.H",
256 "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7",
257 "R1:0", "R3:2", "R5:4", "R7:6", "P0", "P1", "P2", "P3",
258 "P4", "P5", "SP", "FP", "A0.X", "A1.X", "A0.W", "A1.W",
259 "A0", "A1", "I0", "I1", "I2", "I3", "M0", "M1",
260 "M2", "M3", "B0", "B1", "B2", "B3", "L0", "L1",
262 "AZ", "AN", "AC0", "AC1", "AV0", "AV1", "AV0S", "AV1S",
264 "sftreset", "omode", "excause", "emucause", "idle_req", "hwerrcause", "CC", "LC0",
265 "LC1", "ASTAT", "RETS", "LT0", "LB0", "LT1", "LB1",
266 "CYCLES", "CYCLES2", "USP", "SEQSTAT", "SYSCFG", "RETI", "RETX", "RETN",
268 "R0.B", "R1.B", "R2.B", "R3.B", "R4.B", "R5.B", "R6.B", "R7.B",
269 "P0.L", "P1.L", "P2.L", "P3.L", "P4.L", "P5.L", "SP.L", "FP.L",
270 "P0.H", "P1.H", "P2.H", "P3.H", "P4.H", "P5.H", "SP.H", "FP.H",
271 "I0.L", "I1.L", "I2.L", "I3.L", "M0.L", "M1.L", "M2.L", "M3.L",
272 "B0.L", "B1.L", "B2.L", "B3.L", "L0.L", "L1.L", "L2.L", "L3.L",
273 "I0.H", "I1.H", "I2.H", "I3.H", "M0.H", "M1.H", "M2.H", "M3.H",
274 "B0.H", "B1.H", "B2.H", "B3.H", "L0.H", "L1.H", "L2.H", "L3.H",
275 "AC0_COPY", "V_COPY", "RND_MOD",
280 #define REGNAME(x) ((x) < REG_LASTREG ? (reg_names[x]) : "...... Illegal register .......")
283 static const enum machine_registers decode_dregs_lo
[] =
285 REG_RL0
, REG_RL1
, REG_RL2
, REG_RL3
, REG_RL4
, REG_RL5
, REG_RL6
, REG_RL7
,
288 #define dregs_lo(x) REGNAME (decode_dregs_lo[(x) & 7])
291 static const enum machine_registers decode_dregs_hi
[] =
293 REG_RH0
, REG_RH1
, REG_RH2
, REG_RH3
, REG_RH4
, REG_RH5
, REG_RH6
, REG_RH7
,
296 #define dregs_hi(x) REGNAME (decode_dregs_hi[(x) & 7])
299 static const enum machine_registers decode_dregs
[] =
301 REG_R0
, REG_R1
, REG_R2
, REG_R3
, REG_R4
, REG_R5
, REG_R6
, REG_R7
,
304 #define dregs(x) REGNAME (decode_dregs[(x) & 7])
307 static const enum machine_registers decode_dregs_byte
[] =
309 REG_BR0
, REG_BR1
, REG_BR2
, REG_BR3
, REG_BR4
, REG_BR5
, REG_BR6
, REG_BR7
,
312 #define dregs_byte(x) REGNAME (decode_dregs_byte[(x) & 7])
315 static const enum machine_registers decode_pregs
[] =
317 REG_P0
, REG_P1
, REG_P2
, REG_P3
, REG_P4
, REG_P5
, REG_SP
, REG_FP
,
320 #define pregs(x) REGNAME (decode_pregs[(x) & 7])
321 #define spfp(x) REGNAME (decode_spfp[(x) & 1])
322 #define dregs_hilo(x,i) REGNAME (decode_dregs_hilo[((i) << 3)|x])
323 #define accum_ext(x) REGNAME (decode_accum_ext[(x) & 1])
324 #define accum_word(x) REGNAME (decode_accum_word[(x) & 1])
325 #define accum(x) REGNAME (decode_accum[(x) & 1])
328 static const enum machine_registers decode_iregs
[] =
330 REG_I0
, REG_I1
, REG_I2
, REG_I3
,
333 #define iregs(x) REGNAME (decode_iregs[(x) & 3])
336 static const enum machine_registers decode_mregs
[] =
338 REG_M0
, REG_M1
, REG_M2
, REG_M3
,
341 #define mregs(x) REGNAME (decode_mregs[(x) & 3])
342 #define bregs(x) REGNAME (decode_bregs[(x) & 3])
343 #define lregs(x) REGNAME (decode_lregs[(x) & 3])
346 static const enum machine_registers decode_dpregs
[] =
348 REG_R0
, REG_R1
, REG_R2
, REG_R3
, REG_R4
, REG_R5
, REG_R6
, REG_R7
,
349 REG_P0
, REG_P1
, REG_P2
, REG_P3
, REG_P4
, REG_P5
, REG_SP
, REG_FP
,
352 #define dpregs(x) REGNAME (decode_dpregs[(x) & 15])
355 static const enum machine_registers decode_gregs
[] =
357 REG_R0
, REG_R1
, REG_R2
, REG_R3
, REG_R4
, REG_R5
, REG_R6
, REG_R7
,
358 REG_P0
, REG_P1
, REG_P2
, REG_P3
, REG_P4
, REG_P5
, REG_SP
, REG_FP
,
361 #define gregs(x,i) REGNAME (decode_gregs[((i) << 3)|x])
363 /* [dregs pregs (iregs mregs) (bregs lregs)]. */
364 static const enum machine_registers decode_regs
[] =
366 REG_R0
, REG_R1
, REG_R2
, REG_R3
, REG_R4
, REG_R5
, REG_R6
, REG_R7
,
367 REG_P0
, REG_P1
, REG_P2
, REG_P3
, REG_P4
, REG_P5
, REG_SP
, REG_FP
,
368 REG_I0
, REG_I1
, REG_I2
, REG_I3
, REG_M0
, REG_M1
, REG_M2
, REG_M3
,
369 REG_B0
, REG_B1
, REG_B2
, REG_B3
, REG_L0
, REG_L1
, REG_L2
, REG_L3
,
372 #define regs(x,i) REGNAME (decode_regs[((i) << 3)|x])
374 /* [dregs pregs (iregs mregs) (bregs lregs) Low Half]. */
375 static const enum machine_registers decode_regs_lo
[] =
377 REG_RL0
, REG_RL1
, REG_RL2
, REG_RL3
, REG_RL4
, REG_RL5
, REG_RL6
, REG_RL7
,
378 REG_PL0
, REG_PL1
, REG_PL2
, REG_PL3
, REG_PL4
, REG_PL5
, REG_SLP
, REG_FLP
,
379 REG_IL0
, REG_IL1
, REG_IL2
, REG_IL3
, REG_ML0
, REG_ML1
, REG_ML2
, REG_ML3
,
380 REG_BL0
, REG_BL1
, REG_BL2
, REG_BL3
, REG_LL0
, REG_LL1
, REG_LL2
, REG_LL3
,
383 #define regs_lo(x,i) REGNAME (decode_regs_lo[((i) << 3)|x])
384 /* [dregs pregs (iregs mregs) (bregs lregs) High Half]. */
385 static const enum machine_registers decode_regs_hi
[] =
387 REG_RH0
, REG_RH1
, REG_RH2
, REG_RH3
, REG_RH4
, REG_RH5
, REG_RH6
, REG_RH7
,
388 REG_PH0
, REG_PH1
, REG_PH2
, REG_PH3
, REG_PH4
, REG_PH5
, REG_SHP
, REG_FHP
,
389 REG_IH0
, REG_IH1
, REG_IH2
, REG_IH3
, REG_MH0
, REG_MH1
, REG_MH2
, REG_MH3
,
390 REG_BH0
, REG_BH1
, REG_BH2
, REG_BH3
, REG_LH0
, REG_LH1
, REG_LH2
, REG_LH3
,
393 #define regs_hi(x,i) REGNAME (decode_regs_hi[((i) << 3)|x])
395 static const enum machine_registers decode_statbits
[] =
397 REG_AZ
, REG_AN
, REG_AC0_COPY
, REG_V_COPY
,
398 REG_LASTREG
, REG_LASTREG
, REG_AQ
, REG_LASTREG
,
399 REG_RND_MOD
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
,
400 REG_AC0
, REG_AC1
, REG_LASTREG
, REG_LASTREG
,
401 REG_AV0
, REG_AV0S
, REG_AV1
, REG_AV1S
,
402 REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
,
403 REG_V
, REG_VS
, REG_LASTREG
, REG_LASTREG
,
404 REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
,
407 #define statbits(x) REGNAME (decode_statbits[(x) & 31])
410 static const enum machine_registers decode_counters
[] =
415 #define counters(x) REGNAME (decode_counters[(x) & 1])
416 #define dregs2_sysregs1(x) REGNAME (decode_dregs2_sysregs1[(x) & 7])
418 /* [dregs pregs (iregs mregs) (bregs lregs)
419 dregs2_sysregs1 open sysregs2 sysregs3]. */
420 static const enum machine_registers decode_allregs
[] =
422 REG_R0
, REG_R1
, REG_R2
, REG_R3
, REG_R4
, REG_R5
, REG_R6
, REG_R7
,
423 REG_P0
, REG_P1
, REG_P2
, REG_P3
, REG_P4
, REG_P5
, REG_SP
, REG_FP
,
424 REG_I0
, REG_I1
, REG_I2
, REG_I3
, REG_M0
, REG_M1
, REG_M2
, REG_M3
,
425 REG_B0
, REG_B1
, REG_B2
, REG_B3
, REG_L0
, REG_L1
, REG_L2
, REG_L3
,
426 REG_A0x
, REG_A0w
, REG_A1x
, REG_A1w
, REG_LASTREG
, REG_LASTREG
, REG_ASTAT
, REG_RETS
,
427 REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
,
428 REG_LC0
, REG_LT0
, REG_LB0
, REG_LC1
, REG_LT1
, REG_LB1
, REG_CYCLES
, REG_CYCLES2
,
429 REG_USP
, REG_SEQSTAT
, REG_SYSCFG
, REG_RETI
, REG_RETX
, REG_RETN
, REG_RETE
, REG_EMUDAT
,
433 #define IS_DREG(g,r) ((g) == 0 && (r) < 8)
434 #define IS_PREG(g,r) ((g) == 1 && (r) < 8)
435 #define IS_AREG(g,r) ((g) == 4 && (r) >= 0 && (r) < 4)
436 #define IS_GENREG(g,r) ((((g) == 0 || (g) == 1) && (r) < 8) || IS_AREG (g, r))
437 #define IS_DAGREG(g,r) (((g) == 2 || (g) == 3) && (r) < 8)
438 #define IS_SYSREG(g,r) \
439 (((g) == 4 && ((r) == 6 || (r) == 7)) || (g) == 6 || (g) == 7)
440 #define IS_RESERVEDREG(g,r) \
441 (((r) > 7) || ((g) == 4 && ((r) == 4 || (r) == 5)) || (g) == 5)
443 #define allreg(r,g) (!IS_RESERVEDREG (g, r))
444 #define mostreg(r,g) (!(IS_DREG (g, r) || IS_PREG (g, r) || IS_RESERVEDREG (g, r)))
446 #define allregs(x,i) REGNAME (decode_allregs[((i) << 3) | x])
447 #define uimm16s4(x) fmtconst (c_uimm16s4, x, 0, outf)
448 #define uimm16s4d(x) fmtconst (c_uimm16s4d, x, 0, outf)
449 #define pcrel4(x) fmtconst (c_pcrel4, x, pc, outf)
450 #define pcrel8(x) fmtconst (c_pcrel8, x, pc, outf)
451 #define pcrel8s4(x) fmtconst (c_pcrel8s4, x, pc, outf)
452 #define pcrel10(x) fmtconst (c_pcrel10, x, pc, outf)
453 #define pcrel12(x) fmtconst (c_pcrel12, x, pc, outf)
454 #define negimm5s4(x) fmtconst (c_negimm5s4, x, 0, outf)
455 #define rimm16(x) fmtconst (c_rimm16, x, 0, outf)
456 #define huimm16(x) fmtconst (c_huimm16, x, 0, outf)
457 #define imm16(x) fmtconst (c_imm16, x, 0, outf)
458 #define imm16d(x) fmtconst (c_imm16d, x, 0, outf)
459 #define uimm2(x) fmtconst (c_uimm2, x, 0, outf)
460 #define uimm3(x) fmtconst (c_uimm3, x, 0, outf)
461 #define luimm16(x) fmtconst (c_luimm16, x, 0, outf)
462 #define uimm4(x) fmtconst (c_uimm4, x, 0, outf)
463 #define uimm5(x) fmtconst (c_uimm5, x, 0, outf)
464 #define imm16s2(x) fmtconst (c_imm16s2, x, 0, outf)
465 #define uimm8(x) fmtconst (c_uimm8, x, 0, outf)
466 #define imm16s4(x) fmtconst (c_imm16s4, x, 0, outf)
467 #define uimm4s2(x) fmtconst (c_uimm4s2, x, 0, outf)
468 #define uimm4s4(x) fmtconst (c_uimm4s4, x, 0, outf)
469 #define uimm4s4d(x) fmtconst (c_uimm4s4d, x, 0, outf)
470 #define lppcrel10(x) fmtconst (c_lppcrel10, x, pc, outf)
471 #define imm3(x) fmtconst (c_imm3, x, 0, outf)
472 #define imm4(x) fmtconst (c_imm4, x, 0, outf)
473 #define uimm8s4(x) fmtconst (c_uimm8s4, x, 0, outf)
474 #define imm5(x) fmtconst (c_imm5, x, 0, outf)
475 #define imm5d(x) fmtconst (c_imm5d, x, 0, outf)
476 #define imm6(x) fmtconst (c_imm6, x, 0, outf)
477 #define imm7(x) fmtconst (c_imm7, x, 0, outf)
478 #define imm7d(x) fmtconst (c_imm7d, x, 0, outf)
479 #define imm8(x) fmtconst (c_imm8, x, 0, outf)
480 #define pcrel24(x) fmtconst (c_pcrel24, x, pc, outf)
481 #define uimm16(x) fmtconst (c_uimm16, x, 0, outf)
482 #define uimm32(x) fmtconst (c_uimm32, x, 0, outf)
483 #define imm32(x) fmtconst (c_imm32, x, 0, outf)
484 #define huimm32(x) fmtconst (c_huimm32, x, 0, outf)
485 #define huimm32e(x) fmtconst (c_huimm32e, x, 0, outf)
486 #define imm7_val(x) fmtconst_val (c_imm7, x, 0)
487 #define imm16_val(x) fmtconst_val (c_uimm16, x, 0)
488 #define luimm16_val(x) fmtconst_val (c_luimm16, x, 0)
490 /* (arch.pm)arch_disassembler_functions. */
492 #define OUTS(p, txt) ((p) ? (((txt)[0]) ? (p->fprintf_func)(p->stream, "%s", txt) :0) :0)
496 amod0 (int s0
, int x0
, disassemble_info
*outf
)
498 if (s0
== 1 && x0
== 0)
500 else if (s0
== 0 && x0
== 1)
501 OUTS (outf
, " (CO)");
502 else if (s0
== 1 && x0
== 1)
503 OUTS (outf
, " (SCO)");
507 amod1 (int s0
, int x0
, disassemble_info
*outf
)
509 if (s0
== 0 && x0
== 0)
510 OUTS (outf
, " (NS)");
511 else if (s0
== 1 && x0
== 0)
516 amod0amod2 (int s0
, int x0
, int aop0
, disassemble_info
*outf
)
518 if (s0
== 1 && x0
== 0 && aop0
== 0)
520 else if (s0
== 0 && x0
== 1 && aop0
== 0)
521 OUTS (outf
, " (CO)");
522 else if (s0
== 1 && x0
== 1 && aop0
== 0)
523 OUTS (outf
, " (SCO)");
524 else if (s0
== 0 && x0
== 0 && aop0
== 2)
525 OUTS (outf
, " (ASR)");
526 else if (s0
== 1 && x0
== 0 && aop0
== 2)
527 OUTS (outf
, " (S, ASR)");
528 else if (s0
== 0 && x0
== 1 && aop0
== 2)
529 OUTS (outf
, " (CO, ASR)");
530 else if (s0
== 1 && x0
== 1 && aop0
== 2)
531 OUTS (outf
, " (SCO, ASR)");
532 else if (s0
== 0 && x0
== 0 && aop0
== 3)
533 OUTS (outf
, " (ASL)");
534 else if (s0
== 1 && x0
== 0 && aop0
== 3)
535 OUTS (outf
, " (S, ASL)");
536 else if (s0
== 0 && x0
== 1 && aop0
== 3)
537 OUTS (outf
, " (CO, ASL)");
538 else if (s0
== 1 && x0
== 1 && aop0
== 3)
539 OUTS (outf
, " (SCO, ASL)");
543 searchmod (int r0
, disassemble_info
*outf
)
556 aligndir (int r0
, disassemble_info
*outf
)
563 decode_multfunc (int h0
, int h1
, int src0
, int src1
, disassemble_info
* outf
)
568 s0
= dregs_hi (src0
);
570 s0
= dregs_lo (src0
);
573 s1
= dregs_hi (src1
);
575 s1
= dregs_lo (src1
);
584 decode_macfunc (int which
, int op
, int h0
, int h1
, int src0
, int src1
, disassemble_info
* outf
)
587 const char *sop
= "<unknown op>";
602 case 0: sop
= " = "; break;
603 case 1: sop
= " += "; break;
604 case 2: sop
= " -= "; break;
610 decode_multfunc (h0
, h1
, src0
, src1
, outf
);
616 decode_optmode (int mod
, int MM
, disassemble_info
*outf
)
618 if (mod
== 0 && MM
== 0)
633 OUTS (outf
, "S2RND");
636 else if (mod
== M_W32
)
638 else if (mod
== M_FU
)
640 else if (mod
== M_TFU
)
642 else if (mod
== M_IS
)
644 else if (mod
== M_ISS2
)
646 else if (mod
== M_IH
)
648 else if (mod
== M_IU
)
658 bu32 dpregs
[16], iregs
[4], mregs
[4], bregs
[4], lregs
[4];
659 bu32 a0x
, a0w
, a1x
, a1w
;
660 bu32 lt
[2], lc
[2], lb
[2];
661 int ac0
, ac0_copy
, ac1
, an
, aq
;
662 int av0
, av0s
, av1
, av1s
, az
, cc
, v
, v_copy
, vs
;
672 int end_of_registers
;
675 unsigned char *memory
;
676 unsigned long bfd_mach
;
679 #define DREG(x) (saved_state.dpregs[x])
680 #define GREG(x,i) DPREG ((x) | (i << 3))
681 #define DPREG(x) (saved_state.dpregs[x])
682 #define DREG(x) (saved_state.dpregs[x])
683 #define PREG(x) (saved_state.dpregs[x + 8])
684 #define SPREG PREG (6)
685 #define FPREG PREG (7)
686 #define IREG(x) (saved_state.iregs[x])
687 #define MREG(x) (saved_state.mregs[x])
688 #define BREG(x) (saved_state.bregs[x])
689 #define LREG(x) (saved_state.lregs[x])
690 #define A0XREG (saved_state.a0x)
691 #define A0WREG (saved_state.a0w)
692 #define A1XREG (saved_state.a1x)
693 #define A1WREG (saved_state.a1w)
694 #define CCREG (saved_state.cc)
695 #define LC0REG (saved_state.lc[0])
696 #define LT0REG (saved_state.lt[0])
697 #define LB0REG (saved_state.lb[0])
698 #define LC1REG (saved_state.lc[1])
699 #define LT1REG (saved_state.lt[1])
700 #define LB1REG (saved_state.lb[1])
701 #define RETSREG (saved_state.rets)
702 #define PCREG (saved_state.pc)
705 get_allreg (int grp
, int reg
)
707 int fullreg
= (grp
<< 3) | reg
;
708 /* REG_R0, REG_R1, REG_R2, REG_R3, REG_R4, REG_R5, REG_R6, REG_R7,
709 REG_P0, REG_P1, REG_P2, REG_P3, REG_P4, REG_P5, REG_SP, REG_FP,
710 REG_I0, REG_I1, REG_I2, REG_I3, REG_M0, REG_M1, REG_M2, REG_M3,
711 REG_B0, REG_B1, REG_B2, REG_B3, REG_L0, REG_L1, REG_L2, REG_L3,
712 REG_A0x, REG_A0w, REG_A1x, REG_A1w, , , REG_ASTAT, REG_RETS,
714 REG_LC0, REG_LT0, REG_LB0, REG_LC1, REG_LT1, REG_LB1, REG_CYCLES,
716 REG_USP, REG_SEQSTAT, REG_SYSCFG, REG_RETI, REG_RETX, REG_RETN, REG_RETE,
718 switch (fullreg
>> 2)
720 case 0: case 1: return &DREG (reg
); break;
721 case 2: case 3: return &PREG (reg
); break;
722 case 4: return &IREG (reg
& 3); break;
723 case 5: return &MREG (reg
& 3); break;
724 case 6: return &BREG (reg
& 3); break;
725 case 7: return &LREG (reg
& 3); break;
729 case 32: return &saved_state
.a0x
;
730 case 33: return &saved_state
.a0w
;
731 case 34: return &saved_state
.a1x
;
732 case 35: return &saved_state
.a1w
;
733 case 39: return &saved_state
.rets
;
734 case 48: return &LC0REG
;
735 case 49: return <0REG
;
736 case 50: return &LB0REG
;
737 case 51: return &LC1REG
;
738 case 52: return <1REG
;
739 case 53: return &LB1REG
;
746 decode_ProgCtrl_0 (TIword iw0
, disassemble_info
*outf
)
749 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
750 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |.prgfunc.......|.poprnd........|
751 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
752 int poprnd
= ((iw0
>> ProgCtrl_poprnd_bits
) & ProgCtrl_poprnd_mask
);
753 int prgfunc
= ((iw0
>> ProgCtrl_prgfunc_bits
) & ProgCtrl_prgfunc_mask
);
755 if (prgfunc
== 0 && poprnd
== 0)
759 else if (prgfunc
== 1 && poprnd
== 0)
761 else if (prgfunc
== 1 && poprnd
== 1)
763 else if (prgfunc
== 1 && poprnd
== 2)
765 else if (prgfunc
== 1 && poprnd
== 3)
767 else if (prgfunc
== 1 && poprnd
== 4)
769 else if (prgfunc
== 2 && poprnd
== 0)
771 else if (prgfunc
== 2 && poprnd
== 3)
772 OUTS (outf
, "CSYNC");
773 else if (prgfunc
== 2 && poprnd
== 4)
774 OUTS (outf
, "SSYNC");
775 else if (prgfunc
== 2 && poprnd
== 5)
776 OUTS (outf
, "EMUEXCPT");
777 else if (prgfunc
== 3 && IS_DREG (0, poprnd
))
780 OUTS (outf
, dregs (poprnd
));
782 else if (prgfunc
== 4 && IS_DREG (0, poprnd
))
785 OUTS (outf
, dregs (poprnd
));
787 else if (prgfunc
== 5 && IS_PREG (1, poprnd
))
789 OUTS (outf
, "JUMP (");
790 OUTS (outf
, pregs (poprnd
));
793 else if (prgfunc
== 6 && IS_PREG (1, poprnd
))
795 OUTS (outf
, "CALL (");
796 OUTS (outf
, pregs (poprnd
));
799 else if (prgfunc
== 7 && IS_PREG (1, poprnd
))
801 OUTS (outf
, "CALL (PC + ");
802 OUTS (outf
, pregs (poprnd
));
805 else if (prgfunc
== 8 && IS_PREG (1, poprnd
))
807 OUTS (outf
, "JUMP (PC + ");
808 OUTS (outf
, pregs (poprnd
));
811 else if (prgfunc
== 9)
813 OUTS (outf
, "RAISE ");
814 OUTS (outf
, uimm4 (poprnd
));
816 else if (prgfunc
== 10)
818 OUTS (outf
, "EXCPT ");
819 OUTS (outf
, uimm4 (poprnd
));
821 else if (prgfunc
== 11 && IS_PREG (1, poprnd
) && poprnd
<= 5)
823 OUTS (outf
, "TESTSET (");
824 OUTS (outf
, pregs (poprnd
));
833 decode_CaCTRL_0 (TIword iw0
, disassemble_info
*outf
)
836 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
837 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 |.a.|.op....|.reg.......|
838 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
839 int a
= ((iw0
>> CaCTRL_a_bits
) & CaCTRL_a_mask
);
840 int op
= ((iw0
>> CaCTRL_op_bits
) & CaCTRL_op_mask
);
841 int reg
= ((iw0
>> CaCTRL_reg_bits
) & CaCTRL_reg_mask
);
846 if (a
== 0 && op
== 0)
848 OUTS (outf
, "PREFETCH[");
849 OUTS (outf
, pregs (reg
));
852 else if (a
== 0 && op
== 1)
854 OUTS (outf
, "FLUSHINV[");
855 OUTS (outf
, pregs (reg
));
858 else if (a
== 0 && op
== 2)
860 OUTS (outf
, "FLUSH[");
861 OUTS (outf
, pregs (reg
));
864 else if (a
== 0 && op
== 3)
866 OUTS (outf
, "IFLUSH[");
867 OUTS (outf
, pregs (reg
));
870 else if (a
== 1 && op
== 0)
872 OUTS (outf
, "PREFETCH[");
873 OUTS (outf
, pregs (reg
));
876 else if (a
== 1 && op
== 1)
878 OUTS (outf
, "FLUSHINV[");
879 OUTS (outf
, pregs (reg
));
882 else if (a
== 1 && op
== 2)
884 OUTS (outf
, "FLUSH[");
885 OUTS (outf
, pregs (reg
));
888 else if (a
== 1 && op
== 3)
890 OUTS (outf
, "IFLUSH[");
891 OUTS (outf
, pregs (reg
));
900 decode_PushPopReg_0 (TIword iw0
, disassemble_info
*outf
)
903 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
904 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |.W.|.grp.......|.reg.......|
905 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
906 int W
= ((iw0
>> PushPopReg_W_bits
) & PushPopReg_W_mask
);
907 int grp
= ((iw0
>> PushPopReg_grp_bits
) & PushPopReg_grp_mask
);
908 int reg
= ((iw0
>> PushPopReg_reg_bits
) & PushPopReg_reg_mask
);
913 if (W
== 0 && mostreg (reg
, grp
))
915 OUTS (outf
, allregs (reg
, grp
));
916 OUTS (outf
, " = [SP++]");
918 else if (W
== 1 && allreg (reg
, grp
) && !(grp
== 1 && reg
== 6))
920 OUTS (outf
, "[--SP] = ");
921 OUTS (outf
, allregs (reg
, grp
));
929 decode_PushPopMultiple_0 (TIword iw0
, disassemble_info
*outf
)
932 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
933 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |.d.|.p.|.W.|.dr........|.pr........|
934 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
935 int p
= ((iw0
>> PushPopMultiple_p_bits
) & PushPopMultiple_p_mask
);
936 int d
= ((iw0
>> PushPopMultiple_d_bits
) & PushPopMultiple_d_mask
);
937 int W
= ((iw0
>> PushPopMultiple_W_bits
) & PushPopMultiple_W_mask
);
938 int dr
= ((iw0
>> PushPopMultiple_dr_bits
) & PushPopMultiple_dr_mask
);
939 int pr
= ((iw0
>> PushPopMultiple_pr_bits
) & PushPopMultiple_pr_mask
);
947 if (W
== 1 && d
== 1 && p
== 1)
949 OUTS (outf
, "[--SP] = (R7:");
950 OUTS (outf
, imm5d (dr
));
951 OUTS (outf
, ", P5:");
952 OUTS (outf
, imm5d (pr
));
955 else if (W
== 1 && d
== 1 && p
== 0 && pr
== 0)
957 OUTS (outf
, "[--SP] = (R7:");
958 OUTS (outf
, imm5d (dr
));
961 else if (W
== 1 && d
== 0 && p
== 1 && dr
== 0)
963 OUTS (outf
, "[--SP] = (P5:");
964 OUTS (outf
, imm5d (pr
));
967 else if (W
== 0 && d
== 1 && p
== 1)
970 OUTS (outf
, imm5d (dr
));
971 OUTS (outf
, ", P5:");
972 OUTS (outf
, imm5d (pr
));
973 OUTS (outf
, ") = [SP++]");
975 else if (W
== 0 && d
== 1 && p
== 0 && pr
== 0)
978 OUTS (outf
, imm5d (dr
));
979 OUTS (outf
, ") = [SP++]");
981 else if (W
== 0 && d
== 0 && p
== 1 && dr
== 0)
984 OUTS (outf
, imm5d (pr
));
985 OUTS (outf
, ") = [SP++]");
993 decode_ccMV_0 (TIword iw0
, disassemble_info
*outf
)
996 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
997 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |.T.|.d.|.s.|.dst.......|.src.......|
998 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
999 int s
= ((iw0
>> CCmv_s_bits
) & CCmv_s_mask
);
1000 int d
= ((iw0
>> CCmv_d_bits
) & CCmv_d_mask
);
1001 int T
= ((iw0
>> CCmv_T_bits
) & CCmv_T_mask
);
1002 int src
= ((iw0
>> CCmv_src_bits
) & CCmv_src_mask
);
1003 int dst
= ((iw0
>> CCmv_dst_bits
) & CCmv_dst_mask
);
1010 OUTS (outf
, "IF CC ");
1011 OUTS (outf
, gregs (dst
, d
));
1013 OUTS (outf
, gregs (src
, s
));
1017 OUTS (outf
, "IF !CC ");
1018 OUTS (outf
, gregs (dst
, d
));
1020 OUTS (outf
, gregs (src
, s
));
1028 decode_CCflag_0 (TIword iw0
, disassemble_info
*outf
)
1031 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1032 | 0 | 0 | 0 | 0 | 1 |.I.|.opc.......|.G.|.y.........|.x.........|
1033 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1034 int x
= ((iw0
>> CCflag_x_bits
) & CCflag_x_mask
);
1035 int y
= ((iw0
>> CCflag_y_bits
) & CCflag_y_mask
);
1036 int I
= ((iw0
>> CCflag_I_bits
) & CCflag_I_mask
);
1037 int G
= ((iw0
>> CCflag_G_bits
) & CCflag_G_mask
);
1038 int opc
= ((iw0
>> CCflag_opc_bits
) & CCflag_opc_mask
);
1043 if (opc
== 0 && I
== 0 && G
== 0)
1045 OUTS (outf
, "CC = ");
1046 OUTS (outf
, dregs (x
));
1047 OUTS (outf
, " == ");
1048 OUTS (outf
, dregs (y
));
1050 else if (opc
== 1 && I
== 0 && G
== 0)
1052 OUTS (outf
, "CC = ");
1053 OUTS (outf
, dregs (x
));
1055 OUTS (outf
, dregs (y
));
1057 else if (opc
== 2 && I
== 0 && G
== 0)
1059 OUTS (outf
, "CC = ");
1060 OUTS (outf
, dregs (x
));
1061 OUTS (outf
, " <= ");
1062 OUTS (outf
, dregs (y
));
1064 else if (opc
== 3 && I
== 0 && G
== 0)
1066 OUTS (outf
, "CC = ");
1067 OUTS (outf
, dregs (x
));
1069 OUTS (outf
, dregs (y
));
1070 OUTS (outf
, " (IU)");
1072 else if (opc
== 4 && I
== 0 && G
== 0)
1074 OUTS (outf
, "CC = ");
1075 OUTS (outf
, dregs (x
));
1076 OUTS (outf
, " <= ");
1077 OUTS (outf
, dregs (y
));
1078 OUTS (outf
, " (IU)");
1080 else if (opc
== 0 && I
== 1 && G
== 0)
1082 OUTS (outf
, "CC = ");
1083 OUTS (outf
, dregs (x
));
1084 OUTS (outf
, " == ");
1085 OUTS (outf
, imm3 (y
));
1087 else if (opc
== 1 && I
== 1 && G
== 0)
1089 OUTS (outf
, "CC = ");
1090 OUTS (outf
, dregs (x
));
1092 OUTS (outf
, imm3 (y
));
1094 else if (opc
== 2 && I
== 1 && G
== 0)
1096 OUTS (outf
, "CC = ");
1097 OUTS (outf
, dregs (x
));
1098 OUTS (outf
, " <= ");
1099 OUTS (outf
, imm3 (y
));
1101 else if (opc
== 3 && I
== 1 && G
== 0)
1103 OUTS (outf
, "CC = ");
1104 OUTS (outf
, dregs (x
));
1106 OUTS (outf
, uimm3 (y
));
1107 OUTS (outf
, " (IU)");
1109 else if (opc
== 4 && I
== 1 && G
== 0)
1111 OUTS (outf
, "CC = ");
1112 OUTS (outf
, dregs (x
));
1113 OUTS (outf
, " <= ");
1114 OUTS (outf
, uimm3 (y
));
1115 OUTS (outf
, " (IU)");
1117 else if (opc
== 0 && I
== 0 && G
== 1)
1119 OUTS (outf
, "CC = ");
1120 OUTS (outf
, pregs (x
));
1121 OUTS (outf
, " == ");
1122 OUTS (outf
, pregs (y
));
1124 else if (opc
== 1 && I
== 0 && G
== 1)
1126 OUTS (outf
, "CC = ");
1127 OUTS (outf
, pregs (x
));
1129 OUTS (outf
, pregs (y
));
1131 else if (opc
== 2 && I
== 0 && G
== 1)
1133 OUTS (outf
, "CC = ");
1134 OUTS (outf
, pregs (x
));
1135 OUTS (outf
, " <= ");
1136 OUTS (outf
, pregs (y
));
1138 else if (opc
== 3 && I
== 0 && G
== 1)
1140 OUTS (outf
, "CC = ");
1141 OUTS (outf
, pregs (x
));
1143 OUTS (outf
, pregs (y
));
1144 OUTS (outf
, " (IU)");
1146 else if (opc
== 4 && I
== 0 && G
== 1)
1148 OUTS (outf
, "CC = ");
1149 OUTS (outf
, pregs (x
));
1150 OUTS (outf
, " <= ");
1151 OUTS (outf
, pregs (y
));
1152 OUTS (outf
, " (IU)");
1154 else if (opc
== 0 && I
== 1 && G
== 1)
1156 OUTS (outf
, "CC = ");
1157 OUTS (outf
, pregs (x
));
1158 OUTS (outf
, " == ");
1159 OUTS (outf
, imm3 (y
));
1161 else if (opc
== 1 && I
== 1 && G
== 1)
1163 OUTS (outf
, "CC = ");
1164 OUTS (outf
, pregs (x
));
1166 OUTS (outf
, imm3 (y
));
1168 else if (opc
== 2 && I
== 1 && G
== 1)
1170 OUTS (outf
, "CC = ");
1171 OUTS (outf
, pregs (x
));
1172 OUTS (outf
, " <= ");
1173 OUTS (outf
, imm3 (y
));
1175 else if (opc
== 3 && I
== 1 && G
== 1)
1177 OUTS (outf
, "CC = ");
1178 OUTS (outf
, pregs (x
));
1180 OUTS (outf
, uimm3 (y
));
1181 OUTS (outf
, " (IU)");
1183 else if (opc
== 4 && I
== 1 && G
== 1)
1185 OUTS (outf
, "CC = ");
1186 OUTS (outf
, pregs (x
));
1187 OUTS (outf
, " <= ");
1188 OUTS (outf
, uimm3 (y
));
1189 OUTS (outf
, " (IU)");
1191 else if (opc
== 5 && I
== 0 && G
== 0 && x
== 0 && y
== 0)
1192 OUTS (outf
, "CC = A0 == A1");
1194 else if (opc
== 6 && I
== 0 && G
== 0 && x
== 0 && y
== 0)
1195 OUTS (outf
, "CC = A0 < A1");
1197 else if (opc
== 7 && I
== 0 && G
== 0 && x
== 0 && y
== 0)
1198 OUTS (outf
, "CC = A0 <= A1");
1206 decode_CC2dreg_0 (TIword iw0
, disassemble_info
*outf
)
1209 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1210 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |.op....|.reg.......|
1211 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1212 int op
= ((iw0
>> CC2dreg_op_bits
) & CC2dreg_op_mask
);
1213 int reg
= ((iw0
>> CC2dreg_reg_bits
) & CC2dreg_reg_mask
);
1220 OUTS (outf
, dregs (reg
));
1221 OUTS (outf
, " = CC");
1225 OUTS (outf
, "CC = ");
1226 OUTS (outf
, dregs (reg
));
1228 else if (op
== 3 && reg
== 0)
1229 OUTS (outf
, "CC = !CC");
1237 decode_CC2stat_0 (TIword iw0
, disassemble_info
*outf
)
1240 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1241 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |.D.|.op....|.cbit..............|
1242 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1243 int D
= ((iw0
>> CC2stat_D_bits
) & CC2stat_D_mask
);
1244 int op
= ((iw0
>> CC2stat_op_bits
) & CC2stat_op_mask
);
1245 int cbit
= ((iw0
>> CC2stat_cbit_bits
) & CC2stat_cbit_mask
);
1247 const char *bitname
= statbits (cbit
);
1252 if (decode_statbits
[cbit
] == REG_LASTREG
)
1254 /* All ASTAT bits except CC may be operated on in hardware, but may
1255 not have a dedicated insn, so still decode "valid" insns. */
1256 static char bitnames
[64];
1258 sprintf (bitnames
, "ASTAT[%i /* unused bit */]", cbit
);
1265 if (op
== 0 && D
== 0)
1267 OUTS (outf
, "CC = ");
1268 OUTS (outf
, bitname
);
1270 else if (op
== 1 && D
== 0)
1272 OUTS (outf
, "CC |= ");
1273 OUTS (outf
, bitname
);
1275 else if (op
== 2 && D
== 0)
1277 OUTS (outf
, "CC &= ");
1278 OUTS (outf
, bitname
);
1280 else if (op
== 3 && D
== 0)
1282 OUTS (outf
, "CC ^= ");
1283 OUTS (outf
, bitname
);
1285 else if (op
== 0 && D
== 1)
1287 OUTS (outf
, bitname
);
1288 OUTS (outf
, " = CC");
1290 else if (op
== 1 && D
== 1)
1292 OUTS (outf
, bitname
);
1293 OUTS (outf
, " |= CC");
1295 else if (op
== 2 && D
== 1)
1297 OUTS (outf
, bitname
);
1298 OUTS (outf
, " &= CC");
1300 else if (op
== 3 && D
== 1)
1302 OUTS (outf
, bitname
);
1303 OUTS (outf
, " ^= CC");
1312 decode_BRCC_0 (TIword iw0
, bfd_vma pc
, disassemble_info
*outf
)
1315 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1316 | 0 | 0 | 0 | 1 |.T.|.B.|.offset................................|
1317 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1318 int B
= ((iw0
>> BRCC_B_bits
) & BRCC_B_mask
);
1319 int T
= ((iw0
>> BRCC_T_bits
) & BRCC_T_mask
);
1320 int offset
= ((iw0
>> BRCC_offset_bits
) & BRCC_offset_mask
);
1325 if (T
== 1 && B
== 1)
1327 OUTS (outf
, "IF CC JUMP 0x");
1328 OUTS (outf
, pcrel10 (offset
));
1329 OUTS (outf
, " (BP)");
1331 else if (T
== 0 && B
== 1)
1333 OUTS (outf
, "IF !CC JUMP 0x");
1334 OUTS (outf
, pcrel10 (offset
));
1335 OUTS (outf
, " (BP)");
1339 OUTS (outf
, "IF CC JUMP 0x");
1340 OUTS (outf
, pcrel10 (offset
));
1344 OUTS (outf
, "IF !CC JUMP 0x");
1345 OUTS (outf
, pcrel10 (offset
));
1354 decode_UJUMP_0 (TIword iw0
, bfd_vma pc
, disassemble_info
*outf
)
1357 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1358 | 0 | 0 | 1 | 0 |.offset........................................|
1359 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1360 int offset
= ((iw0
>> UJump_offset_bits
) & UJump_offset_mask
);
1365 OUTS (outf
, "JUMP.S 0x");
1366 OUTS (outf
, pcrel12 (offset
));
1371 decode_REGMV_0 (TIword iw0
, disassemble_info
*outf
)
1374 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1375 | 0 | 0 | 1 | 1 |.gd........|.gs........|.dst.......|.src.......|
1376 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1377 int gs
= ((iw0
>> RegMv_gs_bits
) & RegMv_gs_mask
);
1378 int gd
= ((iw0
>> RegMv_gd_bits
) & RegMv_gd_mask
);
1379 int src
= ((iw0
>> RegMv_src_bits
) & RegMv_src_mask
);
1380 int dst
= ((iw0
>> RegMv_dst_bits
) & RegMv_dst_mask
);
1382 /* Reserved slots cannot be a src/dst. */
1383 if (IS_RESERVEDREG (gs
, src
) || IS_RESERVEDREG (gd
, dst
))
1386 /* Standard register moves */
1387 if ((gs
< 2) || /* Dregs/Pregs as source */
1388 (gd
< 2) || /* Dregs/Pregs as dest */
1389 (gs
== 4 && src
< 4) || /* Accumulators as source */
1390 (gd
== 4 && dst
< 4 && (gs
< 4)) || /* Accumulators as dest */
1391 (gs
== 7 && src
== 7 && !(gd
== 4 && dst
< 4)) || /* EMUDAT as src */
1392 (gd
== 7 && dst
== 7)) /* EMUDAT as dest */
1395 /* dareg = dareg (IMBL) */
1396 if (gs
< 4 && gd
< 4)
1399 /* USP can be src to sysregs, but not dagregs. */
1400 if ((gs
== 7 && src
== 0) && (gd
>= 4))
1403 /* USP can move between genregs (only check Accumulators). */
1404 if (((gs
== 7 && src
== 0) && (gd
== 4 && dst
< 4)) ||
1405 ((gd
== 7 && dst
== 0) && (gs
== 4 && src
< 4)))
1408 /* Still here ? Invalid reg pair. */
1413 OUTS (outf
, allregs (dst
, gd
));
1415 OUTS (outf
, allregs (src
, gs
));
1420 decode_ALU2op_0 (TIword iw0
, disassemble_info
*outf
)
1423 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1424 | 0 | 1 | 0 | 0 | 0 | 0 |.opc...........|.src.......|.dst.......|
1425 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1426 int src
= ((iw0
>> ALU2op_src_bits
) & ALU2op_src_mask
);
1427 int opc
= ((iw0
>> ALU2op_opc_bits
) & ALU2op_opc_mask
);
1428 int dst
= ((iw0
>> ALU2op_dst_bits
) & ALU2op_dst_mask
);
1432 OUTS (outf
, dregs (dst
));
1433 OUTS (outf
, " >>>= ");
1434 OUTS (outf
, dregs (src
));
1438 OUTS (outf
, dregs (dst
));
1439 OUTS (outf
, " >>= ");
1440 OUTS (outf
, dregs (src
));
1444 OUTS (outf
, dregs (dst
));
1445 OUTS (outf
, " <<= ");
1446 OUTS (outf
, dregs (src
));
1450 OUTS (outf
, dregs (dst
));
1451 OUTS (outf
, " *= ");
1452 OUTS (outf
, dregs (src
));
1456 OUTS (outf
, dregs (dst
));
1457 OUTS (outf
, " = (");
1458 OUTS (outf
, dregs (dst
));
1460 OUTS (outf
, dregs (src
));
1461 OUTS (outf
, ") << 0x1");
1465 OUTS (outf
, dregs (dst
));
1466 OUTS (outf
, " = (");
1467 OUTS (outf
, dregs (dst
));
1469 OUTS (outf
, dregs (src
));
1470 OUTS (outf
, ") << 0x2");
1474 OUTS (outf
, "DIVQ (");
1475 OUTS (outf
, dregs (dst
));
1477 OUTS (outf
, dregs (src
));
1482 OUTS (outf
, "DIVS (");
1483 OUTS (outf
, dregs (dst
));
1485 OUTS (outf
, dregs (src
));
1490 OUTS (outf
, dregs (dst
));
1492 OUTS (outf
, dregs_lo (src
));
1493 OUTS (outf
, " (X)");
1497 OUTS (outf
, dregs (dst
));
1499 OUTS (outf
, dregs_lo (src
));
1500 OUTS (outf
, " (Z)");
1504 OUTS (outf
, dregs (dst
));
1506 OUTS (outf
, dregs_byte (src
));
1507 OUTS (outf
, " (X)");
1511 OUTS (outf
, dregs (dst
));
1513 OUTS (outf
, dregs_byte (src
));
1514 OUTS (outf
, " (Z)");
1518 OUTS (outf
, dregs (dst
));
1519 OUTS (outf
, " = -");
1520 OUTS (outf
, dregs (src
));
1524 OUTS (outf
, dregs (dst
));
1525 OUTS (outf
, " =~ ");
1526 OUTS (outf
, dregs (src
));
1535 decode_PTR2op_0 (TIword iw0
, disassemble_info
*outf
)
1538 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1539 | 0 | 1 | 0 | 0 | 0 | 1 | 0 |.opc.......|.src.......|.dst.......|
1540 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1541 int src
= ((iw0
>> PTR2op_src_bits
) & PTR2op_dst_mask
);
1542 int opc
= ((iw0
>> PTR2op_opc_bits
) & PTR2op_opc_mask
);
1543 int dst
= ((iw0
>> PTR2op_dst_bits
) & PTR2op_dst_mask
);
1547 OUTS (outf
, pregs (dst
));
1548 OUTS (outf
, " -= ");
1549 OUTS (outf
, pregs (src
));
1553 OUTS (outf
, pregs (dst
));
1555 OUTS (outf
, pregs (src
));
1556 OUTS (outf
, " << 0x2");
1560 OUTS (outf
, pregs (dst
));
1562 OUTS (outf
, pregs (src
));
1563 OUTS (outf
, " >> 0x2");
1567 OUTS (outf
, pregs (dst
));
1569 OUTS (outf
, pregs (src
));
1570 OUTS (outf
, " >> 0x1");
1574 OUTS (outf
, pregs (dst
));
1575 OUTS (outf
, " += ");
1576 OUTS (outf
, pregs (src
));
1577 OUTS (outf
, " (BREV)");
1581 OUTS (outf
, pregs (dst
));
1582 OUTS (outf
, " = (");
1583 OUTS (outf
, pregs (dst
));
1585 OUTS (outf
, pregs (src
));
1586 OUTS (outf
, ") << 0x1");
1590 OUTS (outf
, pregs (dst
));
1591 OUTS (outf
, " = (");
1592 OUTS (outf
, pregs (dst
));
1594 OUTS (outf
, pregs (src
));
1595 OUTS (outf
, ") << 0x2");
1604 decode_LOGI2op_0 (TIword iw0
, disassemble_info
*outf
)
1607 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1608 | 0 | 1 | 0 | 0 | 1 |.opc.......|.src...............|.dst.......|
1609 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1610 int src
= ((iw0
>> LOGI2op_src_bits
) & LOGI2op_src_mask
);
1611 int opc
= ((iw0
>> LOGI2op_opc_bits
) & LOGI2op_opc_mask
);
1612 int dst
= ((iw0
>> LOGI2op_dst_bits
) & LOGI2op_dst_mask
);
1619 OUTS (outf
, "CC = !BITTST (");
1620 OUTS (outf
, dregs (dst
));
1622 OUTS (outf
, uimm5 (src
));
1623 OUTS (outf
, ");\t\t/* bit");
1624 OUTS (outf
, imm7d (src
));
1630 OUTS (outf
, "CC = BITTST (");
1631 OUTS (outf
, dregs (dst
));
1633 OUTS (outf
, uimm5 (src
));
1634 OUTS (outf
, ");\t\t/* bit");
1635 OUTS (outf
, imm7d (src
));
1641 OUTS (outf
, "BITSET (");
1642 OUTS (outf
, dregs (dst
));
1644 OUTS (outf
, uimm5 (src
));
1645 OUTS (outf
, ");\t\t/* bit");
1646 OUTS (outf
, imm7d (src
));
1652 OUTS (outf
, "BITTGL (");
1653 OUTS (outf
, dregs (dst
));
1655 OUTS (outf
, uimm5 (src
));
1656 OUTS (outf
, ");\t\t/* bit");
1657 OUTS (outf
, imm7d (src
));
1663 OUTS (outf
, "BITCLR (");
1664 OUTS (outf
, dregs (dst
));
1666 OUTS (outf
, uimm5 (src
));
1667 OUTS (outf
, ");\t\t/* bit");
1668 OUTS (outf
, imm7d (src
));
1674 OUTS (outf
, dregs (dst
));
1675 OUTS (outf
, " >>>= ");
1676 OUTS (outf
, uimm5 (src
));
1680 OUTS (outf
, dregs (dst
));
1681 OUTS (outf
, " >>= ");
1682 OUTS (outf
, uimm5 (src
));
1686 OUTS (outf
, dregs (dst
));
1687 OUTS (outf
, " <<= ");
1688 OUTS (outf
, uimm5 (src
));
1697 decode_COMP3op_0 (TIword iw0
, disassemble_info
*outf
)
1700 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1701 | 0 | 1 | 0 | 1 |.opc.......|.dst.......|.src1......|.src0......|
1702 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1703 int opc
= ((iw0
>> COMP3op_opc_bits
) & COMP3op_opc_mask
);
1704 int dst
= ((iw0
>> COMP3op_dst_bits
) & COMP3op_dst_mask
);
1705 int src0
= ((iw0
>> COMP3op_src0_bits
) & COMP3op_src0_mask
);
1706 int src1
= ((iw0
>> COMP3op_src1_bits
) & COMP3op_src1_mask
);
1708 if (opc
== 5 && src1
== src0
)
1710 OUTS (outf
, pregs (dst
));
1712 OUTS (outf
, pregs (src0
));
1713 OUTS (outf
, " << 0x1");
1717 OUTS (outf
, dregs (dst
));
1719 OUTS (outf
, dregs (src0
));
1721 OUTS (outf
, dregs (src1
));
1725 OUTS (outf
, dregs (dst
));
1727 OUTS (outf
, dregs (src0
));
1729 OUTS (outf
, dregs (src1
));
1733 OUTS (outf
, dregs (dst
));
1735 OUTS (outf
, dregs (src0
));
1737 OUTS (outf
, dregs (src1
));
1741 OUTS (outf
, dregs (dst
));
1743 OUTS (outf
, dregs (src0
));
1745 OUTS (outf
, dregs (src1
));
1749 OUTS (outf
, pregs (dst
));
1751 OUTS (outf
, pregs (src0
));
1753 OUTS (outf
, pregs (src1
));
1757 OUTS (outf
, pregs (dst
));
1759 OUTS (outf
, pregs (src0
));
1760 OUTS (outf
, " + (");
1761 OUTS (outf
, pregs (src1
));
1762 OUTS (outf
, " << 0x1)");
1766 OUTS (outf
, pregs (dst
));
1768 OUTS (outf
, pregs (src0
));
1769 OUTS (outf
, " + (");
1770 OUTS (outf
, pregs (src1
));
1771 OUTS (outf
, " << 0x2)");
1775 OUTS (outf
, dregs (dst
));
1777 OUTS (outf
, dregs (src0
));
1779 OUTS (outf
, dregs (src1
));
1788 decode_COMPI2opD_0 (TIword iw0
, disassemble_info
*outf
)
1791 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1792 | 0 | 1 | 1 | 0 | 0 |.op|..src......................|.dst.......|
1793 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1794 int op
= ((iw0
>> COMPI2opD_op_bits
) & COMPI2opD_op_mask
);
1795 int dst
= ((iw0
>> COMPI2opD_dst_bits
) & COMPI2opD_dst_mask
);
1796 int src
= ((iw0
>> COMPI2opD_src_bits
) & COMPI2opD_src_mask
);
1798 bu32
*pval
= get_allreg (0, dst
);
1803 /* Since we don't have 32-bit immediate loads, we allow the disassembler
1804 to combine them, so it prints out the right values.
1805 Here we keep track of the registers. */
1808 *pval
= imm7_val (src
);
1810 *pval
|= 0xFFFFFF80;
1817 OUTS (outf
, dregs (dst
));
1819 OUTS (outf
, imm7 (src
));
1820 OUTS (outf
, " (X);\t\t/*\t\t");
1821 OUTS (outf
, dregs (dst
));
1823 OUTS (outf
, uimm32 (*pval
));
1825 OUTS (outf
, imm32 (*pval
));
1826 OUTS (outf
, ") */");
1831 OUTS (outf
, dregs (dst
));
1832 OUTS (outf
, " += ");
1833 OUTS (outf
, imm7 (src
));
1834 OUTS (outf
, ";\t\t/* (");
1835 OUTS (outf
, imm7d (src
));
1836 OUTS (outf
, ") */");
1846 decode_COMPI2opP_0 (TIword iw0
, disassemble_info
*outf
)
1849 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1850 | 0 | 1 | 1 | 0 | 1 |.op|.src.......................|.dst.......|
1851 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1852 int op
= ((iw0
>> COMPI2opP_op_bits
) & COMPI2opP_op_mask
);
1853 int src
= ((iw0
>> COMPI2opP_src_bits
) & COMPI2opP_src_mask
);
1854 int dst
= ((iw0
>> COMPI2opP_dst_bits
) & COMPI2opP_dst_mask
);
1856 bu32
*pval
= get_allreg (1, dst
);
1863 *pval
= imm7_val (src
);
1865 *pval
|= 0xFFFFFF80;
1872 OUTS (outf
, pregs (dst
));
1874 OUTS (outf
, imm7 (src
));
1875 OUTS (outf
, " (X);\t\t/*\t\t");
1876 OUTS (outf
, pregs (dst
));
1878 OUTS (outf
, uimm32 (*pval
));
1880 OUTS (outf
, imm32 (*pval
));
1881 OUTS (outf
, ") */");
1886 OUTS (outf
, pregs (dst
));
1887 OUTS (outf
, " += ");
1888 OUTS (outf
, imm7 (src
));
1889 OUTS (outf
, ";\t\t/* (");
1890 OUTS (outf
, imm7d (src
));
1891 OUTS (outf
, ") */");
1901 decode_LDSTpmod_0 (TIword iw0
, disassemble_info
*outf
)
1904 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1905 | 1 | 0 | 0 | 0 |.W.|.aop...|.reg.......|.idx.......|.ptr.......|
1906 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
1907 int W
= ((iw0
>> LDSTpmod_W_bits
) & LDSTpmod_W_mask
);
1908 int aop
= ((iw0
>> LDSTpmod_aop_bits
) & LDSTpmod_aop_mask
);
1909 int idx
= ((iw0
>> LDSTpmod_idx_bits
) & LDSTpmod_idx_mask
);
1910 int ptr
= ((iw0
>> LDSTpmod_ptr_bits
) & LDSTpmod_ptr_mask
);
1911 int reg
= ((iw0
>> LDSTpmod_reg_bits
) & LDSTpmod_reg_mask
);
1913 if (aop
== 1 && W
== 0 && idx
== ptr
)
1915 OUTS (outf
, dregs_lo (reg
));
1916 OUTS (outf
, " = W[");
1917 OUTS (outf
, pregs (ptr
));
1920 else if (aop
== 2 && W
== 0 && idx
== ptr
)
1922 OUTS (outf
, dregs_hi (reg
));
1923 OUTS (outf
, " = W[");
1924 OUTS (outf
, pregs (ptr
));
1927 else if (aop
== 1 && W
== 1 && idx
== ptr
)
1930 OUTS (outf
, pregs (ptr
));
1931 OUTS (outf
, "] = ");
1932 OUTS (outf
, dregs_lo (reg
));
1934 else if (aop
== 2 && W
== 1 && idx
== ptr
)
1937 OUTS (outf
, pregs (ptr
));
1938 OUTS (outf
, "] = ");
1939 OUTS (outf
, dregs_hi (reg
));
1941 else if (aop
== 0 && W
== 0)
1943 OUTS (outf
, dregs (reg
));
1944 OUTS (outf
, " = [");
1945 OUTS (outf
, pregs (ptr
));
1946 OUTS (outf
, " ++ ");
1947 OUTS (outf
, pregs (idx
));
1950 else if (aop
== 1 && W
== 0)
1952 OUTS (outf
, dregs_lo (reg
));
1953 OUTS (outf
, " = W[");
1954 OUTS (outf
, pregs (ptr
));
1955 OUTS (outf
, " ++ ");
1956 OUTS (outf
, pregs (idx
));
1959 else if (aop
== 2 && W
== 0)
1961 OUTS (outf
, dregs_hi (reg
));
1962 OUTS (outf
, " = W[");
1963 OUTS (outf
, pregs (ptr
));
1964 OUTS (outf
, " ++ ");
1965 OUTS (outf
, pregs (idx
));
1968 else if (aop
== 3 && W
== 0)
1970 OUTS (outf
, dregs (reg
));
1971 OUTS (outf
, " = W[");
1972 OUTS (outf
, pregs (ptr
));
1973 OUTS (outf
, " ++ ");
1974 OUTS (outf
, pregs (idx
));
1975 OUTS (outf
, "] (Z)");
1977 else if (aop
== 3 && W
== 1)
1979 OUTS (outf
, dregs (reg
));
1980 OUTS (outf
, " = W[");
1981 OUTS (outf
, pregs (ptr
));
1982 OUTS (outf
, " ++ ");
1983 OUTS (outf
, pregs (idx
));
1984 OUTS (outf
, "] (X)");
1986 else if (aop
== 0 && W
== 1)
1989 OUTS (outf
, pregs (ptr
));
1990 OUTS (outf
, " ++ ");
1991 OUTS (outf
, pregs (idx
));
1992 OUTS (outf
, "] = ");
1993 OUTS (outf
, dregs (reg
));
1995 else if (aop
== 1 && W
== 1)
1998 OUTS (outf
, pregs (ptr
));
1999 OUTS (outf
, " ++ ");
2000 OUTS (outf
, pregs (idx
));
2001 OUTS (outf
, "] = ");
2002 OUTS (outf
, dregs_lo (reg
));
2004 else if (aop
== 2 && W
== 1)
2007 OUTS (outf
, pregs (ptr
));
2008 OUTS (outf
, " ++ ");
2009 OUTS (outf
, pregs (idx
));
2010 OUTS (outf
, "] = ");
2011 OUTS (outf
, dregs_hi (reg
));
2020 decode_dagMODim_0 (TIword iw0
, disassemble_info
*outf
)
2023 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2024 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 0 |.br| 1 | 1 |.op|.m.....|.i.....|
2025 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2026 int i
= ((iw0
>> DagMODim_i_bits
) & DagMODim_i_mask
);
2027 int m
= ((iw0
>> DagMODim_m_bits
) & DagMODim_m_mask
);
2028 int br
= ((iw0
>> DagMODim_br_bits
) & DagMODim_br_mask
);
2029 int op
= ((iw0
>> DagMODim_op_bits
) & DagMODim_op_mask
);
2031 if (op
== 0 && br
== 1)
2033 OUTS (outf
, iregs (i
));
2034 OUTS (outf
, " += ");
2035 OUTS (outf
, mregs (m
));
2036 OUTS (outf
, " (BREV)");
2040 OUTS (outf
, iregs (i
));
2041 OUTS (outf
, " += ");
2042 OUTS (outf
, mregs (m
));
2044 else if (op
== 1 && br
== 0)
2046 OUTS (outf
, iregs (i
));
2047 OUTS (outf
, " -= ");
2048 OUTS (outf
, mregs (m
));
2057 decode_dagMODik_0 (TIword iw0
, disassemble_info
*outf
)
2060 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2061 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 0 |.op....|.i.....|
2062 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2063 int i
= ((iw0
>> DagMODik_i_bits
) & DagMODik_i_mask
);
2064 int op
= ((iw0
>> DagMODik_op_bits
) & DagMODik_op_mask
);
2068 OUTS (outf
, iregs (i
));
2069 OUTS (outf
, " += 0x2");
2073 OUTS (outf
, iregs (i
));
2074 OUTS (outf
, " -= 0x2");
2078 OUTS (outf
, iregs (i
));
2079 OUTS (outf
, " += 0x4");
2083 OUTS (outf
, iregs (i
));
2084 OUTS (outf
, " -= 0x4");
2091 OUTS (outf
, ";\t\t/* ( ");
2092 if (op
== 0 || op
== 1)
2094 else if (op
== 2 || op
== 3)
2096 OUTS (outf
, ") */");
2104 decode_dspLDST_0 (TIword iw0
, disassemble_info
*outf
)
2107 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2108 | 1 | 0 | 0 | 1 | 1 | 1 |.W.|.aop...|.m.....|.i.....|.reg.......|
2109 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2110 int i
= ((iw0
>> DspLDST_i_bits
) & DspLDST_i_mask
);
2111 int m
= ((iw0
>> DspLDST_m_bits
) & DspLDST_m_mask
);
2112 int W
= ((iw0
>> DspLDST_W_bits
) & DspLDST_W_mask
);
2113 int aop
= ((iw0
>> DspLDST_aop_bits
) & DspLDST_aop_mask
);
2114 int reg
= ((iw0
>> DspLDST_reg_bits
) & DspLDST_reg_mask
);
2116 if (aop
== 0 && W
== 0 && m
== 0)
2118 OUTS (outf
, dregs (reg
));
2119 OUTS (outf
, " = [");
2120 OUTS (outf
, iregs (i
));
2123 else if (aop
== 0 && W
== 0 && m
== 1)
2125 OUTS (outf
, dregs_lo (reg
));
2126 OUTS (outf
, " = W[");
2127 OUTS (outf
, iregs (i
));
2130 else if (aop
== 0 && W
== 0 && m
== 2)
2132 OUTS (outf
, dregs_hi (reg
));
2133 OUTS (outf
, " = W[");
2134 OUTS (outf
, iregs (i
));
2137 else if (aop
== 1 && W
== 0 && m
== 0)
2139 OUTS (outf
, dregs (reg
));
2140 OUTS (outf
, " = [");
2141 OUTS (outf
, iregs (i
));
2144 else if (aop
== 1 && W
== 0 && m
== 1)
2146 OUTS (outf
, dregs_lo (reg
));
2147 OUTS (outf
, " = W[");
2148 OUTS (outf
, iregs (i
));
2151 else if (aop
== 1 && W
== 0 && m
== 2)
2153 OUTS (outf
, dregs_hi (reg
));
2154 OUTS (outf
, " = W[");
2155 OUTS (outf
, iregs (i
));
2158 else if (aop
== 2 && W
== 0 && m
== 0)
2160 OUTS (outf
, dregs (reg
));
2161 OUTS (outf
, " = [");
2162 OUTS (outf
, iregs (i
));
2165 else if (aop
== 2 && W
== 0 && m
== 1)
2167 OUTS (outf
, dregs_lo (reg
));
2168 OUTS (outf
, " = W[");
2169 OUTS (outf
, iregs (i
));
2172 else if (aop
== 2 && W
== 0 && m
== 2)
2174 OUTS (outf
, dregs_hi (reg
));
2175 OUTS (outf
, " = W[");
2176 OUTS (outf
, iregs (i
));
2179 else if (aop
== 0 && W
== 1 && m
== 0)
2182 OUTS (outf
, iregs (i
));
2183 OUTS (outf
, "++] = ");
2184 OUTS (outf
, dregs (reg
));
2186 else if (aop
== 0 && W
== 1 && m
== 1)
2189 OUTS (outf
, iregs (i
));
2190 OUTS (outf
, "++] = ");
2191 OUTS (outf
, dregs_lo (reg
));
2193 else if (aop
== 0 && W
== 1 && m
== 2)
2196 OUTS (outf
, iregs (i
));
2197 OUTS (outf
, "++] = ");
2198 OUTS (outf
, dregs_hi (reg
));
2200 else if (aop
== 1 && W
== 1 && m
== 0)
2203 OUTS (outf
, iregs (i
));
2204 OUTS (outf
, "--] = ");
2205 OUTS (outf
, dregs (reg
));
2207 else if (aop
== 1 && W
== 1 && m
== 1)
2210 OUTS (outf
, iregs (i
));
2211 OUTS (outf
, "--] = ");
2212 OUTS (outf
, dregs_lo (reg
));
2214 else if (aop
== 1 && W
== 1 && m
== 2)
2217 OUTS (outf
, iregs (i
));
2218 OUTS (outf
, "--] = ");
2219 OUTS (outf
, dregs_hi (reg
));
2221 else if (aop
== 2 && W
== 1 && m
== 0)
2224 OUTS (outf
, iregs (i
));
2225 OUTS (outf
, "] = ");
2226 OUTS (outf
, dregs (reg
));
2228 else if (aop
== 2 && W
== 1 && m
== 1)
2231 OUTS (outf
, iregs (i
));
2232 OUTS (outf
, "] = ");
2233 OUTS (outf
, dregs_lo (reg
));
2235 else if (aop
== 2 && W
== 1 && m
== 2)
2238 OUTS (outf
, iregs (i
));
2239 OUTS (outf
, "] = ");
2240 OUTS (outf
, dregs_hi (reg
));
2242 else if (aop
== 3 && W
== 0)
2244 OUTS (outf
, dregs (reg
));
2245 OUTS (outf
, " = [");
2246 OUTS (outf
, iregs (i
));
2247 OUTS (outf
, " ++ ");
2248 OUTS (outf
, mregs (m
));
2251 else if (aop
== 3 && W
== 1)
2254 OUTS (outf
, iregs (i
));
2255 OUTS (outf
, " ++ ");
2256 OUTS (outf
, mregs (m
));
2257 OUTS (outf
, "] = ");
2258 OUTS (outf
, dregs (reg
));
2267 decode_LDST_0 (TIword iw0
, disassemble_info
*outf
)
2270 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2271 | 1 | 0 | 0 | 1 |.sz....|.W.|.aop...|.Z.|.ptr.......|.reg.......|
2272 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2273 int Z
= ((iw0
>> LDST_Z_bits
) & LDST_Z_mask
);
2274 int W
= ((iw0
>> LDST_W_bits
) & LDST_W_mask
);
2275 int sz
= ((iw0
>> LDST_sz_bits
) & LDST_sz_mask
);
2276 int aop
= ((iw0
>> LDST_aop_bits
) & LDST_aop_mask
);
2277 int reg
= ((iw0
>> LDST_reg_bits
) & LDST_reg_mask
);
2278 int ptr
= ((iw0
>> LDST_ptr_bits
) & LDST_ptr_mask
);
2280 if (aop
== 0 && sz
== 0 && Z
== 0 && W
== 0)
2282 OUTS (outf
, dregs (reg
));
2283 OUTS (outf
, " = [");
2284 OUTS (outf
, pregs (ptr
));
2287 else if (aop
== 0 && sz
== 0 && Z
== 1 && W
== 0 && reg
!= ptr
)
2289 OUTS (outf
, pregs (reg
));
2290 OUTS (outf
, " = [");
2291 OUTS (outf
, pregs (ptr
));
2294 else if (aop
== 0 && sz
== 1 && Z
== 0 && W
== 0)
2296 OUTS (outf
, dregs (reg
));
2297 OUTS (outf
, " = W[");
2298 OUTS (outf
, pregs (ptr
));
2299 OUTS (outf
, "++] (Z)");
2301 else if (aop
== 0 && sz
== 1 && Z
== 1 && W
== 0)
2303 OUTS (outf
, dregs (reg
));
2304 OUTS (outf
, " = W[");
2305 OUTS (outf
, pregs (ptr
));
2306 OUTS (outf
, "++] (X)");
2308 else if (aop
== 0 && sz
== 2 && Z
== 0 && W
== 0)
2310 OUTS (outf
, dregs (reg
));
2311 OUTS (outf
, " = B[");
2312 OUTS (outf
, pregs (ptr
));
2313 OUTS (outf
, "++] (Z)");
2315 else if (aop
== 0 && sz
== 2 && Z
== 1 && W
== 0)
2317 OUTS (outf
, dregs (reg
));
2318 OUTS (outf
, " = B[");
2319 OUTS (outf
, pregs (ptr
));
2320 OUTS (outf
, "++] (X)");
2322 else if (aop
== 1 && sz
== 0 && Z
== 0 && W
== 0)
2324 OUTS (outf
, dregs (reg
));
2325 OUTS (outf
, " = [");
2326 OUTS (outf
, pregs (ptr
));
2329 else if (aop
== 1 && sz
== 0 && Z
== 1 && W
== 0 && reg
!= ptr
)
2331 OUTS (outf
, pregs (reg
));
2332 OUTS (outf
, " = [");
2333 OUTS (outf
, pregs (ptr
));
2336 else if (aop
== 1 && sz
== 1 && Z
== 0 && W
== 0)
2338 OUTS (outf
, dregs (reg
));
2339 OUTS (outf
, " = W[");
2340 OUTS (outf
, pregs (ptr
));
2341 OUTS (outf
, "--] (Z)");
2343 else if (aop
== 1 && sz
== 1 && Z
== 1 && W
== 0)
2345 OUTS (outf
, dregs (reg
));
2346 OUTS (outf
, " = W[");
2347 OUTS (outf
, pregs (ptr
));
2348 OUTS (outf
, "--] (X)");
2350 else if (aop
== 1 && sz
== 2 && Z
== 0 && W
== 0)
2352 OUTS (outf
, dregs (reg
));
2353 OUTS (outf
, " = B[");
2354 OUTS (outf
, pregs (ptr
));
2355 OUTS (outf
, "--] (Z)");
2357 else if (aop
== 1 && sz
== 2 && Z
== 1 && W
== 0)
2359 OUTS (outf
, dregs (reg
));
2360 OUTS (outf
, " = B[");
2361 OUTS (outf
, pregs (ptr
));
2362 OUTS (outf
, "--] (X)");
2364 else if (aop
== 2 && sz
== 0 && Z
== 0 && W
== 0)
2366 OUTS (outf
, dregs (reg
));
2367 OUTS (outf
, " = [");
2368 OUTS (outf
, pregs (ptr
));
2371 else if (aop
== 2 && sz
== 0 && Z
== 1 && W
== 0)
2373 OUTS (outf
, pregs (reg
));
2374 OUTS (outf
, " = [");
2375 OUTS (outf
, pregs (ptr
));
2378 else if (aop
== 2 && sz
== 1 && Z
== 0 && W
== 0)
2380 OUTS (outf
, dregs (reg
));
2381 OUTS (outf
, " = W[");
2382 OUTS (outf
, pregs (ptr
));
2383 OUTS (outf
, "] (Z)");
2385 else if (aop
== 2 && sz
== 1 && Z
== 1 && W
== 0)
2387 OUTS (outf
, dregs (reg
));
2388 OUTS (outf
, " = W[");
2389 OUTS (outf
, pregs (ptr
));
2390 OUTS (outf
, "] (X)");
2392 else if (aop
== 2 && sz
== 2 && Z
== 0 && W
== 0)
2394 OUTS (outf
, dregs (reg
));
2395 OUTS (outf
, " = B[");
2396 OUTS (outf
, pregs (ptr
));
2397 OUTS (outf
, "] (Z)");
2399 else if (aop
== 2 && sz
== 2 && Z
== 1 && W
== 0)
2401 OUTS (outf
, dregs (reg
));
2402 OUTS (outf
, " = B[");
2403 OUTS (outf
, pregs (ptr
));
2404 OUTS (outf
, "] (X)");
2406 else if (aop
== 0 && sz
== 0 && Z
== 0 && W
== 1)
2409 OUTS (outf
, pregs (ptr
));
2410 OUTS (outf
, "++] = ");
2411 OUTS (outf
, dregs (reg
));
2413 else if (aop
== 0 && sz
== 0 && Z
== 1 && W
== 1)
2416 OUTS (outf
, pregs (ptr
));
2417 OUTS (outf
, "++] = ");
2418 OUTS (outf
, pregs (reg
));
2420 else if (aop
== 0 && sz
== 1 && Z
== 0 && W
== 1)
2423 OUTS (outf
, pregs (ptr
));
2424 OUTS (outf
, "++] = ");
2425 OUTS (outf
, dregs (reg
));
2427 else if (aop
== 0 && sz
== 2 && Z
== 0 && W
== 1)
2430 OUTS (outf
, pregs (ptr
));
2431 OUTS (outf
, "++] = ");
2432 OUTS (outf
, dregs (reg
));
2434 else if (aop
== 1 && sz
== 0 && Z
== 0 && W
== 1)
2437 OUTS (outf
, pregs (ptr
));
2438 OUTS (outf
, "--] = ");
2439 OUTS (outf
, dregs (reg
));
2441 else if (aop
== 1 && sz
== 0 && Z
== 1 && W
== 1)
2444 OUTS (outf
, pregs (ptr
));
2445 OUTS (outf
, "--] = ");
2446 OUTS (outf
, pregs (reg
));
2448 else if (aop
== 1 && sz
== 1 && Z
== 0 && W
== 1)
2451 OUTS (outf
, pregs (ptr
));
2452 OUTS (outf
, "--] = ");
2453 OUTS (outf
, dregs (reg
));
2455 else if (aop
== 1 && sz
== 2 && Z
== 0 && W
== 1)
2458 OUTS (outf
, pregs (ptr
));
2459 OUTS (outf
, "--] = ");
2460 OUTS (outf
, dregs (reg
));
2462 else if (aop
== 2 && sz
== 0 && Z
== 0 && W
== 1)
2465 OUTS (outf
, pregs (ptr
));
2466 OUTS (outf
, "] = ");
2467 OUTS (outf
, dregs (reg
));
2469 else if (aop
== 2 && sz
== 0 && Z
== 1 && W
== 1)
2472 OUTS (outf
, pregs (ptr
));
2473 OUTS (outf
, "] = ");
2474 OUTS (outf
, pregs (reg
));
2476 else if (aop
== 2 && sz
== 1 && Z
== 0 && W
== 1)
2479 OUTS (outf
, pregs (ptr
));
2480 OUTS (outf
, "] = ");
2481 OUTS (outf
, dregs (reg
));
2483 else if (aop
== 2 && sz
== 2 && Z
== 0 && W
== 1)
2486 OUTS (outf
, pregs (ptr
));
2487 OUTS (outf
, "] = ");
2488 OUTS (outf
, dregs (reg
));
2497 decode_LDSTiiFP_0 (TIword iw0
, disassemble_info
*outf
)
2500 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2501 | 1 | 0 | 1 | 1 | 1 | 0 |.W.|.offset............|.reg...........|
2502 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2503 int reg
= ((iw0
>> LDSTiiFP_reg_bits
) & LDSTiiFP_reg_mask
);
2504 int offset
= ((iw0
>> LDSTiiFP_offset_bits
) & LDSTiiFP_offset_mask
);
2505 int W
= ((iw0
>> LDSTiiFP_W_bits
) & LDSTiiFP_W_mask
);
2509 OUTS (outf
, dpregs (reg
));
2510 OUTS (outf
, " = [FP ");
2511 OUTS (outf
, negimm5s4 (offset
));
2516 OUTS (outf
, "[FP ");
2517 OUTS (outf
, negimm5s4 (offset
));
2518 OUTS (outf
, "] = ");
2519 OUTS (outf
, dpregs (reg
));
2528 decode_LDSTii_0 (TIword iw0
, disassemble_info
*outf
)
2531 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2532 | 1 | 0 | 1 |.W.|.op....|.offset........|.ptr.......|.reg.......|
2533 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2534 int reg
= ((iw0
>> LDSTii_reg_bit
) & LDSTii_reg_mask
);
2535 int ptr
= ((iw0
>> LDSTii_ptr_bit
) & LDSTii_ptr_mask
);
2536 int offset
= ((iw0
>> LDSTii_offset_bit
) & LDSTii_offset_mask
);
2537 int op
= ((iw0
>> LDSTii_op_bit
) & LDSTii_op_mask
);
2538 int W
= ((iw0
>> LDSTii_W_bit
) & LDSTii_W_mask
);
2540 if (W
== 0 && op
== 0)
2542 OUTS (outf
, dregs (reg
));
2543 OUTS (outf
, " = [");
2544 OUTS (outf
, pregs (ptr
));
2546 OUTS (outf
, uimm4s4 (offset
));
2549 else if (W
== 0 && op
== 1)
2551 OUTS (outf
, dregs (reg
));
2552 OUTS (outf
, " = W[");
2553 OUTS (outf
, pregs (ptr
));
2555 OUTS (outf
, uimm4s2 (offset
));
2556 OUTS (outf
, "] (Z)");
2558 else if (W
== 0 && op
== 2)
2560 OUTS (outf
, dregs (reg
));
2561 OUTS (outf
, " = W[");
2562 OUTS (outf
, pregs (ptr
));
2564 OUTS (outf
, uimm4s2 (offset
));
2565 OUTS (outf
, "] (X)");
2567 else if (W
== 0 && op
== 3)
2569 OUTS (outf
, pregs (reg
));
2570 OUTS (outf
, " = [");
2571 OUTS (outf
, pregs (ptr
));
2573 OUTS (outf
, uimm4s4 (offset
));
2576 else if (W
== 1 && op
== 0)
2579 OUTS (outf
, pregs (ptr
));
2581 OUTS (outf
, uimm4s4 (offset
));
2582 OUTS (outf
, "] = ");
2583 OUTS (outf
, dregs (reg
));
2585 else if (W
== 1 && op
== 1)
2588 OUTS (outf
, pregs (ptr
));
2590 OUTS (outf
, uimm4s2 (offset
));
2591 OUTS (outf
, "] = ");
2592 OUTS (outf
, dregs (reg
));
2594 else if (W
== 1 && op
== 3)
2597 OUTS (outf
, pregs (ptr
));
2599 OUTS (outf
, uimm4s4 (offset
));
2600 OUTS (outf
, "] = ");
2601 OUTS (outf
, pregs (reg
));
2610 decode_LoopSetup_0 (TIword iw0
, TIword iw1
, bfd_vma pc
, disassemble_info
*outf
)
2613 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2614 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 |.rop...|.c.|.soffset.......|
2615 |.reg...........| - | - |.eoffset...............................|
2616 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2617 int c
= ((iw0
>> (LoopSetup_c_bits
- 16)) & LoopSetup_c_mask
);
2618 int reg
= ((iw1
>> LoopSetup_reg_bits
) & LoopSetup_reg_mask
);
2619 int rop
= ((iw0
>> (LoopSetup_rop_bits
- 16)) & LoopSetup_rop_mask
);
2620 int soffset
= ((iw0
>> (LoopSetup_soffset_bits
- 16)) & LoopSetup_soffset_mask
);
2621 int eoffset
= ((iw1
>> LoopSetup_eoffset_bits
) & LoopSetup_eoffset_mask
);
2628 OUTS (outf
, "LSETUP");
2630 OUTS (outf
, pcrel4 (soffset
));
2631 OUTS (outf
, ", 0x");
2632 OUTS (outf
, lppcrel10 (eoffset
));
2634 OUTS (outf
, counters (c
));
2638 OUTS (outf
, "LSETUP");
2640 OUTS (outf
, pcrel4 (soffset
));
2641 OUTS (outf
, ", 0x");
2642 OUTS (outf
, lppcrel10 (eoffset
));
2644 OUTS (outf
, counters (c
));
2646 OUTS (outf
, pregs (reg
));
2650 OUTS (outf
, "LSETUP");
2652 OUTS (outf
, pcrel4 (soffset
));
2653 OUTS (outf
, ", 0x");
2654 OUTS (outf
, lppcrel10 (eoffset
));
2656 OUTS (outf
, counters (c
));
2658 OUTS (outf
, pregs (reg
));
2659 OUTS (outf
, " >> 0x1");
2668 decode_LDIMMhalf_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
2671 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2672 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 1 |.Z.|.H.|.S.|.grp...|.reg.......|
2673 |.hword.........................................................|
2674 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2675 int H
= ((iw0
>> (LDIMMhalf_H_bits
- 16)) & LDIMMhalf_H_mask
);
2676 int Z
= ((iw0
>> (LDIMMhalf_Z_bits
- 16)) & LDIMMhalf_Z_mask
);
2677 int S
= ((iw0
>> (LDIMMhalf_S_bits
- 16)) & LDIMMhalf_S_mask
);
2678 int reg
= ((iw0
>> (LDIMMhalf_reg_bits
- 16)) & LDIMMhalf_reg_mask
);
2679 int grp
= ((iw0
>> (LDIMMhalf_grp_bits
- 16)) & LDIMMhalf_grp_mask
);
2680 int hword
= ((iw1
>> LDIMMhalf_hword_bits
) & LDIMMhalf_hword_mask
);
2682 bu32
*pval
= get_allreg (grp
, reg
);
2687 /* Since we don't have 32-bit immediate loads, we allow the disassembler
2688 to combine them, so it prints out the right values.
2689 Here we keep track of the registers. */
2690 if (H
== 0 && S
== 1 && Z
== 0)
2692 /* regs = imm16 (x) */
2693 *pval
= imm16_val (hword
);
2695 *pval
|= 0xFFFF0000;
2699 else if (H
== 0 && S
== 0 && Z
== 1)
2701 /* regs = luimm16 (Z) */
2702 *pval
= luimm16_val (hword
);
2705 else if (H
== 0 && S
== 0 && Z
== 0)
2707 /* regs_lo = luimm16 */
2708 *pval
&= 0xFFFF0000;
2709 *pval
|= luimm16_val (hword
);
2711 else if (H
== 1 && S
== 0 && Z
== 0)
2713 /* regs_hi = huimm16 */
2715 *pval
|= luimm16_val (hword
) << 16;
2718 /* Here we do the disassembly */
2719 if (grp
== 0 && H
== 0 && S
== 0 && Z
== 0)
2721 OUTS (outf
, dregs_lo (reg
));
2723 OUTS (outf
, uimm16 (hword
));
2725 else if (grp
== 0 && H
== 1 && S
== 0 && Z
== 0)
2727 OUTS (outf
, dregs_hi (reg
));
2729 OUTS (outf
, uimm16 (hword
));
2731 else if (grp
== 0 && H
== 0 && S
== 1 && Z
== 0)
2733 OUTS (outf
, dregs (reg
));
2735 OUTS (outf
, imm16 (hword
));
2736 OUTS (outf
, " (X)");
2738 else if (H
== 0 && S
== 1 && Z
== 0)
2740 OUTS (outf
, regs (reg
, grp
));
2742 OUTS (outf
, imm16 (hword
));
2743 OUTS (outf
, " (X)");
2745 else if (H
== 0 && S
== 0 && Z
== 1)
2747 OUTS (outf
, regs (reg
, grp
));
2749 OUTS (outf
, uimm16 (hword
));
2750 OUTS (outf
, " (Z)");
2752 else if (H
== 0 && S
== 0 && Z
== 0)
2754 OUTS (outf
, regs_lo (reg
, grp
));
2756 OUTS (outf
, uimm16 (hword
));
2758 else if (H
== 1 && S
== 0 && Z
== 0)
2760 OUTS (outf
, regs_hi (reg
, grp
));
2762 OUTS (outf
, uimm16 (hword
));
2767 /* And we print out the 32-bit value if it is a pointer. */
2768 if (S
== 0 && Z
== 0)
2770 OUTS (outf
, ";\t\t/* (");
2771 OUTS (outf
, imm16d (hword
));
2774 /* If it is an MMR, don't print the symbol. */
2775 if (*pval
< 0xFFC00000 && grp
== 1)
2777 OUTS (outf
, regs (reg
, grp
));
2779 OUTS (outf
, huimm32e (*pval
));
2783 OUTS (outf
, regs (reg
, grp
));
2785 OUTS (outf
, huimm32e (*pval
));
2787 OUTS (outf
, imm32 (*pval
));
2794 if (S
== 1 || Z
== 1)
2796 OUTS (outf
, ";\t\t/*\t\t");
2797 OUTS (outf
, regs (reg
, grp
));
2799 OUTS (outf
, huimm32e (*pval
));
2801 OUTS (outf
, imm32 (*pval
));
2802 OUTS (outf
, ") */");
2809 decode_CALLa_0 (TIword iw0
, TIword iw1
, bfd_vma pc
, disassemble_info
*outf
)
2812 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2813 | 1 | 1 | 1 | 0 | 0 | 0 | 1 |.S.|.msw...........................|
2814 |.lsw...........................................................|
2815 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2816 int S
= ((iw0
>> (CALLa_S_bits
- 16)) & CALLa_S_mask
);
2817 int lsw
= ((iw1
>> 0) & 0xffff);
2818 int msw
= ((iw0
>> 0) & 0xff);
2824 OUTS (outf
, "CALL 0x");
2826 OUTS (outf
, "JUMP.L 0x");
2830 OUTS (outf
, pcrel24 (((msw
) << 16) | (lsw
)));
2835 decode_LDSTidxI_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
2838 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2839 | 1 | 1 | 1 | 0 | 0 | 1 |.W.|.Z.|.sz....|.ptr.......|.reg.......|
2840 |.offset........................................................|
2841 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2842 int Z
= ((iw0
>> (LDSTidxI_Z_bits
- 16)) & LDSTidxI_Z_mask
);
2843 int W
= ((iw0
>> (LDSTidxI_W_bits
- 16)) & LDSTidxI_W_mask
);
2844 int sz
= ((iw0
>> (LDSTidxI_sz_bits
- 16)) & LDSTidxI_sz_mask
);
2845 int reg
= ((iw0
>> (LDSTidxI_reg_bits
- 16)) & LDSTidxI_reg_mask
);
2846 int ptr
= ((iw0
>> (LDSTidxI_ptr_bits
- 16)) & LDSTidxI_ptr_mask
);
2847 int offset
= ((iw1
>> LDSTidxI_offset_bits
) & LDSTidxI_offset_mask
);
2849 if (W
== 0 && sz
== 0 && Z
== 0)
2851 OUTS (outf
, dregs (reg
));
2852 OUTS (outf
, " = [");
2853 OUTS (outf
, pregs (ptr
));
2855 OUTS (outf
, imm16s4 (offset
));
2858 else if (W
== 0 && sz
== 0 && Z
== 1)
2860 OUTS (outf
, pregs (reg
));
2861 OUTS (outf
, " = [");
2862 OUTS (outf
, pregs (ptr
));
2864 OUTS (outf
, imm16s4 (offset
));
2867 else if (W
== 0 && sz
== 1 && Z
== 0)
2869 OUTS (outf
, dregs (reg
));
2870 OUTS (outf
, " = W[");
2871 OUTS (outf
, pregs (ptr
));
2873 OUTS (outf
, imm16s2 (offset
));
2874 OUTS (outf
, "] (Z)");
2876 else if (W
== 0 && sz
== 1 && Z
== 1)
2878 OUTS (outf
, dregs (reg
));
2879 OUTS (outf
, " = W[");
2880 OUTS (outf
, pregs (ptr
));
2882 OUTS (outf
, imm16s2 (offset
));
2883 OUTS (outf
, "] (X)");
2885 else if (W
== 0 && sz
== 2 && Z
== 0)
2887 OUTS (outf
, dregs (reg
));
2888 OUTS (outf
, " = B[");
2889 OUTS (outf
, pregs (ptr
));
2891 OUTS (outf
, imm16 (offset
));
2892 OUTS (outf
, "] (Z)");
2894 else if (W
== 0 && sz
== 2 && Z
== 1)
2896 OUTS (outf
, dregs (reg
));
2897 OUTS (outf
, " = B[");
2898 OUTS (outf
, pregs (ptr
));
2900 OUTS (outf
, imm16 (offset
));
2901 OUTS (outf
, "] (X)");
2903 else if (W
== 1 && sz
== 0 && Z
== 0)
2906 OUTS (outf
, pregs (ptr
));
2908 OUTS (outf
, imm16s4 (offset
));
2909 OUTS (outf
, "] = ");
2910 OUTS (outf
, dregs (reg
));
2912 else if (W
== 1 && sz
== 0 && Z
== 1)
2915 OUTS (outf
, pregs (ptr
));
2917 OUTS (outf
, imm16s4 (offset
));
2918 OUTS (outf
, "] = ");
2919 OUTS (outf
, pregs (reg
));
2921 else if (W
== 1 && sz
== 1 && Z
== 0)
2924 OUTS (outf
, pregs (ptr
));
2926 OUTS (outf
, imm16s2 (offset
));
2927 OUTS (outf
, "] = ");
2928 OUTS (outf
, dregs (reg
));
2930 else if (W
== 1 && sz
== 2 && Z
== 0)
2933 OUTS (outf
, pregs (ptr
));
2935 OUTS (outf
, imm16 (offset
));
2936 OUTS (outf
, "] = ");
2937 OUTS (outf
, dregs (reg
));
2946 decode_linkage_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
2949 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2950 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |.R.|
2951 |.framesize.....................................................|
2952 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2953 int R
= ((iw0
>> (Linkage_R_bits
- 16)) & Linkage_R_mask
);
2954 int framesize
= ((iw1
>> Linkage_framesize_bits
) & Linkage_framesize_mask
);
2961 OUTS (outf
, "LINK ");
2962 OUTS (outf
, uimm16s4 (framesize
));
2963 OUTS (outf
, ";\t\t/* (");
2964 OUTS (outf
, uimm16s4d (framesize
));
2965 OUTS (outf
, ") */");
2969 OUTS (outf
, "UNLINK");
2977 decode_dsp32mac_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
2980 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2981 | 1 | 1 | 0 | 0 |.M.| 0 | 0 |.mmod..........|.MM|.P.|.w1|.op1...|
2982 |.h01|.h11|.w0|.op0...|.h00|.h10|.dst.......|.src0......|.src1..|
2983 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2984 int op1
= ((iw0
>> (DSP32Mac_op1_bits
- 16)) & DSP32Mac_op1_mask
);
2985 int w1
= ((iw0
>> (DSP32Mac_w1_bits
- 16)) & DSP32Mac_w1_mask
);
2986 int P
= ((iw0
>> (DSP32Mac_p_bits
- 16)) & DSP32Mac_p_mask
);
2987 int MM
= ((iw0
>> (DSP32Mac_MM_bits
- 16)) & DSP32Mac_MM_mask
);
2988 int mmod
= ((iw0
>> (DSP32Mac_mmod_bits
- 16)) & DSP32Mac_mmod_mask
);
2989 int w0
= ((iw1
>> DSP32Mac_w0_bits
) & DSP32Mac_w0_mask
);
2990 int src0
= ((iw1
>> DSP32Mac_src0_bits
) & DSP32Mac_src0_mask
);
2991 int src1
= ((iw1
>> DSP32Mac_src1_bits
) & DSP32Mac_src1_mask
);
2992 int dst
= ((iw1
>> DSP32Mac_dst_bits
) & DSP32Mac_dst_mask
);
2993 int h10
= ((iw1
>> DSP32Mac_h10_bits
) & DSP32Mac_h10_mask
);
2994 int h00
= ((iw1
>> DSP32Mac_h00_bits
) & DSP32Mac_h00_mask
);
2995 int op0
= ((iw1
>> DSP32Mac_op0_bits
) & DSP32Mac_op0_mask
);
2996 int h11
= ((iw1
>> DSP32Mac_h11_bits
) & DSP32Mac_h11_mask
);
2997 int h01
= ((iw1
>> DSP32Mac_h01_bits
) & DSP32Mac_h01_mask
);
2999 if (w0
== 0 && w1
== 0 && op1
== 3 && op0
== 3)
3005 if ((w1
|| w0
) && mmod
== M_W32
)
3008 if (((1 << mmod
) & (P
? 0x131b : 0x1b5f)) == 0)
3011 if (w1
== 1 || op1
!= 3)
3014 OUTS (outf
, P
? dregs (dst
+ 1) : dregs_hi (dst
));
3017 OUTS (outf
, " = A1");
3021 OUTS (outf
, " = (");
3022 decode_macfunc (1, op1
, h01
, h11
, src0
, src1
, outf
);
3027 if (w0
== 1 || op0
!= 3)
3030 OUTS (outf
, " (M)");
3036 if (w0
== 1 || op0
!= 3)
3039 OUTS (outf
, P
? dregs (dst
) : dregs_lo (dst
));
3042 OUTS (outf
, " = A0");
3046 OUTS (outf
, " = (");
3047 decode_macfunc (0, op0
, h00
, h10
, src0
, src1
, outf
);
3053 decode_optmode (mmod
, MM
, outf
);
3059 decode_dsp32mult_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
3062 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
3063 | 1 | 1 | 0 | 0 |.M.| 0 | 1 |.mmod..........|.MM|.P.|.w1|.op1...|
3064 |.h01|.h11|.w0|.op0...|.h00|.h10|.dst.......|.src0......|.src1..|
3065 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
3066 int w1
= ((iw0
>> (DSP32Mac_w1_bits
- 16)) & DSP32Mac_w1_mask
);
3067 int P
= ((iw0
>> (DSP32Mac_p_bits
- 16)) & DSP32Mac_p_mask
);
3068 int MM
= ((iw0
>> (DSP32Mac_MM_bits
- 16)) & DSP32Mac_MM_mask
);
3069 int mmod
= ((iw0
>> (DSP32Mac_mmod_bits
- 16)) & DSP32Mac_mmod_mask
);
3070 int w0
= ((iw1
>> DSP32Mac_w0_bits
) & DSP32Mac_w0_mask
);
3071 int src0
= ((iw1
>> DSP32Mac_src0_bits
) & DSP32Mac_src0_mask
);
3072 int src1
= ((iw1
>> DSP32Mac_src1_bits
) & DSP32Mac_src1_mask
);
3073 int dst
= ((iw1
>> DSP32Mac_dst_bits
) & DSP32Mac_dst_mask
);
3074 int h10
= ((iw1
>> DSP32Mac_h10_bits
) & DSP32Mac_h10_mask
);
3075 int h00
= ((iw1
>> DSP32Mac_h00_bits
) & DSP32Mac_h00_mask
);
3076 int h11
= ((iw1
>> DSP32Mac_h11_bits
) & DSP32Mac_h11_mask
);
3077 int h01
= ((iw1
>> DSP32Mac_h01_bits
) & DSP32Mac_h01_mask
);
3079 if (w1
== 0 && w0
== 0)
3082 if (((1 << mmod
) & (P
? 0x313 : 0x1b57)) == 0)
3087 OUTS (outf
, P
? dregs (dst
+ 1) : dregs_hi (dst
));
3089 decode_multfunc (h01
, h11
, src0
, src1
, outf
);
3094 OUTS (outf
, " (M)");
3102 OUTS (outf
, P
? dregs (dst
) : dregs_lo (dst
));
3104 decode_multfunc (h00
, h10
, src0
, src1
, outf
);
3107 decode_optmode (mmod
, MM
, outf
);
3112 decode_dsp32alu_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
3115 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
3116 | 1 | 1 | 0 | 0 |.M.| 1 | 0 | - | - | - |.HL|.aopcde............|
3117 |.aop...|.s.|.x.|.dst0......|.dst1......|.src0......|.src1......|
3118 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
3119 int s
= ((iw1
>> DSP32Alu_s_bits
) & DSP32Alu_s_mask
);
3120 int x
= ((iw1
>> DSP32Alu_x_bits
) & DSP32Alu_x_mask
);
3121 int aop
= ((iw1
>> DSP32Alu_aop_bits
) & DSP32Alu_aop_mask
);
3122 int src0
= ((iw1
>> DSP32Alu_src0_bits
) & DSP32Alu_src0_mask
);
3123 int src1
= ((iw1
>> DSP32Alu_src1_bits
) & DSP32Alu_src1_mask
);
3124 int dst0
= ((iw1
>> DSP32Alu_dst0_bits
) & DSP32Alu_dst0_mask
);
3125 int dst1
= ((iw1
>> DSP32Alu_dst1_bits
) & DSP32Alu_dst1_mask
);
3126 int HL
= ((iw0
>> (DSP32Alu_HL_bits
- 16)) & DSP32Alu_HL_mask
);
3127 int aopcde
= ((iw0
>> (DSP32Alu_aopcde_bits
- 16)) & DSP32Alu_aopcde_mask
);
3129 if (aop
== 0 && aopcde
== 9 && HL
== 0 && s
== 0)
3131 OUTS (outf
, "A0.L = ");
3132 OUTS (outf
, dregs_lo (src0
));
3134 else if (aop
== 2 && aopcde
== 9 && HL
== 1 && s
== 0)
3136 OUTS (outf
, "A1.H = ");
3137 OUTS (outf
, dregs_hi (src0
));
3139 else if (aop
== 2 && aopcde
== 9 && HL
== 0 && s
== 0)
3141 OUTS (outf
, "A1.L = ");
3142 OUTS (outf
, dregs_lo (src0
));
3144 else if (aop
== 0 && aopcde
== 9 && HL
== 1 && s
== 0)
3146 OUTS (outf
, "A0.H = ");
3147 OUTS (outf
, dregs_hi (src0
));
3149 else if (x
== 1 && HL
== 1 && aop
== 3 && aopcde
== 5)
3151 OUTS (outf
, dregs_hi (dst0
));
3153 OUTS (outf
, dregs (src0
));
3155 OUTS (outf
, dregs (src1
));
3156 OUTS (outf
, " (RND20)");
3158 else if (x
== 1 && HL
== 1 && aop
== 2 && aopcde
== 5)
3160 OUTS (outf
, dregs_hi (dst0
));
3162 OUTS (outf
, dregs (src0
));
3164 OUTS (outf
, dregs (src1
));
3165 OUTS (outf
, " (RND20)");
3167 else if (x
== 0 && HL
== 0 && aop
== 1 && aopcde
== 5)
3169 OUTS (outf
, dregs_lo (dst0
));
3171 OUTS (outf
, dregs (src0
));
3173 OUTS (outf
, dregs (src1
));
3174 OUTS (outf
, " (RND12)");
3176 else if (x
== 0 && HL
== 0 && aop
== 0 && aopcde
== 5)
3178 OUTS (outf
, dregs_lo (dst0
));
3180 OUTS (outf
, dregs (src0
));
3182 OUTS (outf
, dregs (src1
));
3183 OUTS (outf
, " (RND12)");
3185 else if (x
== 1 && HL
== 0 && aop
== 3 && aopcde
== 5)
3187 OUTS (outf
, dregs_lo (dst0
));
3189 OUTS (outf
, dregs (src0
));
3191 OUTS (outf
, dregs (src1
));
3192 OUTS (outf
, " (RND20)");
3194 else if (x
== 0 && HL
== 1 && aop
== 0 && aopcde
== 5)
3196 OUTS (outf
, dregs_hi (dst0
));
3198 OUTS (outf
, dregs (src0
));
3200 OUTS (outf
, dregs (src1
));
3201 OUTS (outf
, " (RND12)");
3203 else if (x
== 1 && HL
== 0 && aop
== 2 && aopcde
== 5)
3205 OUTS (outf
, dregs_lo (dst0
));
3207 OUTS (outf
, dregs (src0
));
3209 OUTS (outf
, dregs (src1
));
3210 OUTS (outf
, " (RND20)");
3212 else if (x
== 0 && HL
== 1 && aop
== 1 && aopcde
== 5)
3214 OUTS (outf
, dregs_hi (dst0
));
3216 OUTS (outf
, dregs (src0
));
3218 OUTS (outf
, dregs (src1
));
3219 OUTS (outf
, " (RND12)");
3221 else if (HL
== 1 && aop
== 0 && aopcde
== 2)
3223 OUTS (outf
, dregs_hi (dst0
));
3225 OUTS (outf
, dregs_lo (src0
));
3227 OUTS (outf
, dregs_lo (src1
));
3230 else if (HL
== 1 && aop
== 1 && aopcde
== 2)
3232 OUTS (outf
, dregs_hi (dst0
));
3234 OUTS (outf
, dregs_lo (src0
));
3236 OUTS (outf
, dregs_hi (src1
));
3239 else if (HL
== 1 && aop
== 2 && aopcde
== 2)
3241 OUTS (outf
, dregs_hi (dst0
));
3243 OUTS (outf
, dregs_hi (src0
));
3245 OUTS (outf
, dregs_lo (src1
));
3248 else if (HL
== 1 && aop
== 3 && aopcde
== 2)
3250 OUTS (outf
, dregs_hi (dst0
));
3252 OUTS (outf
, dregs_hi (src0
));
3254 OUTS (outf
, dregs_hi (src1
));
3257 else if (HL
== 0 && aop
== 0 && aopcde
== 3)
3259 OUTS (outf
, dregs_lo (dst0
));
3261 OUTS (outf
, dregs_lo (src0
));
3263 OUTS (outf
, dregs_lo (src1
));
3266 else if (HL
== 0 && aop
== 1 && aopcde
== 3)
3268 OUTS (outf
, dregs_lo (dst0
));
3270 OUTS (outf
, dregs_lo (src0
));
3272 OUTS (outf
, dregs_hi (src1
));
3275 else if (HL
== 0 && aop
== 3 && aopcde
== 2)
3277 OUTS (outf
, dregs_lo (dst0
));
3279 OUTS (outf
, dregs_hi (src0
));
3281 OUTS (outf
, dregs_hi (src1
));
3284 else if (HL
== 1 && aop
== 0 && aopcde
== 3)
3286 OUTS (outf
, dregs_hi (dst0
));
3288 OUTS (outf
, dregs_lo (src0
));
3290 OUTS (outf
, dregs_lo (src1
));
3293 else if (HL
== 1 && aop
== 1 && aopcde
== 3)
3295 OUTS (outf
, dregs_hi (dst0
));
3297 OUTS (outf
, dregs_lo (src0
));
3299 OUTS (outf
, dregs_hi (src1
));
3302 else if (HL
== 1 && aop
== 2 && aopcde
== 3)
3304 OUTS (outf
, dregs_hi (dst0
));
3306 OUTS (outf
, dregs_hi (src0
));
3308 OUTS (outf
, dregs_lo (src1
));
3311 else if (HL
== 1 && aop
== 3 && aopcde
== 3)
3313 OUTS (outf
, dregs_hi (dst0
));
3315 OUTS (outf
, dregs_hi (src0
));
3317 OUTS (outf
, dregs_hi (src1
));
3320 else if (HL
== 0 && aop
== 2 && aopcde
== 2)
3322 OUTS (outf
, dregs_lo (dst0
));
3324 OUTS (outf
, dregs_hi (src0
));
3326 OUTS (outf
, dregs_lo (src1
));
3329 else if (HL
== 0 && aop
== 1 && aopcde
== 2)
3331 OUTS (outf
, dregs_lo (dst0
));
3333 OUTS (outf
, dregs_lo (src0
));
3335 OUTS (outf
, dregs_hi (src1
));
3338 else if (HL
== 0 && aop
== 2 && aopcde
== 3)
3340 OUTS (outf
, dregs_lo (dst0
));
3342 OUTS (outf
, dregs_hi (src0
));
3344 OUTS (outf
, dregs_lo (src1
));
3347 else if (HL
== 0 && aop
== 3 && aopcde
== 3)
3349 OUTS (outf
, dregs_lo (dst0
));
3351 OUTS (outf
, dregs_hi (src0
));
3353 OUTS (outf
, dregs_hi (src1
));
3356 else if (HL
== 0 && aop
== 0 && aopcde
== 2)
3358 OUTS (outf
, dregs_lo (dst0
));
3360 OUTS (outf
, dregs_lo (src0
));
3362 OUTS (outf
, dregs_lo (src1
));
3365 else if (aop
== 0 && aopcde
== 9 && s
== 1)
3367 OUTS (outf
, "A0 = ");
3368 OUTS (outf
, dregs (src0
));
3370 else if (aop
== 3 && aopcde
== 11 && s
== 0)
3371 OUTS (outf
, "A0 -= A1");
3373 else if (aop
== 3 && aopcde
== 11 && s
== 1)
3374 OUTS (outf
, "A0 -= A1 (W32)");
3376 else if (aop
== 1 && aopcde
== 22 && HL
== 1)
3378 OUTS (outf
, dregs (dst0
));
3379 OUTS (outf
, " = BYTEOP2P (");
3380 OUTS (outf
, dregs (src0
+ 1));
3382 OUTS (outf
, imm5d (src0
));
3384 OUTS (outf
, dregs (src1
+ 1));
3386 OUTS (outf
, imm5d (src1
));
3387 OUTS (outf
, ") (TH");
3389 OUTS (outf
, ", R)");
3393 else if (aop
== 1 && aopcde
== 22 && HL
== 0)
3395 OUTS (outf
, dregs (dst0
));
3396 OUTS (outf
, " = BYTEOP2P (");
3397 OUTS (outf
, dregs (src0
+ 1));
3399 OUTS (outf
, imm5d (src0
));
3401 OUTS (outf
, dregs (src1
+ 1));
3403 OUTS (outf
, imm5d (src1
));
3404 OUTS (outf
, ") (TL");
3406 OUTS (outf
, ", R)");
3410 else if (aop
== 0 && aopcde
== 22 && HL
== 1)
3412 OUTS (outf
, dregs (dst0
));
3413 OUTS (outf
, " = BYTEOP2P (");
3414 OUTS (outf
, dregs (src0
+ 1));
3416 OUTS (outf
, imm5d (src0
));
3418 OUTS (outf
, dregs (src1
+ 1));
3420 OUTS (outf
, imm5d (src1
));
3421 OUTS (outf
, ") (RNDH");
3423 OUTS (outf
, ", R)");
3427 else if (aop
== 0 && aopcde
== 22 && HL
== 0)
3429 OUTS (outf
, dregs (dst0
));
3430 OUTS (outf
, " = BYTEOP2P (");
3431 OUTS (outf
, dregs (src0
+ 1));
3433 OUTS (outf
, imm5d (src0
));
3435 OUTS (outf
, dregs (src1
+ 1));
3437 OUTS (outf
, imm5d (src1
));
3438 OUTS (outf
, ") (RNDL");
3440 OUTS (outf
, ", R)");
3444 else if (aop
== 0 && s
== 0 && aopcde
== 8)
3445 OUTS (outf
, "A0 = 0");
3447 else if (aop
== 0 && s
== 1 && aopcde
== 8)
3448 OUTS (outf
, "A0 = A0 (S)");
3450 else if (aop
== 1 && s
== 0 && aopcde
== 8)
3451 OUTS (outf
, "A1 = 0");
3453 else if (aop
== 1 && s
== 1 && aopcde
== 8)
3454 OUTS (outf
, "A1 = A1 (S)");
3456 else if (aop
== 2 && s
== 0 && aopcde
== 8)
3457 OUTS (outf
, "A1 = A0 = 0");
3459 else if (aop
== 2 && s
== 1 && aopcde
== 8)
3460 OUTS (outf
, "A1 = A1 (S), A0 = A0 (S)");
3462 else if (aop
== 3 && s
== 0 && aopcde
== 8)
3463 OUTS (outf
, "A0 = A1");
3465 else if (aop
== 3 && s
== 1 && aopcde
== 8)
3466 OUTS (outf
, "A1 = A0");
3468 else if (aop
== 1 && aopcde
== 9 && s
== 0)
3470 OUTS (outf
, "A0.X = ");
3471 OUTS (outf
, dregs_lo (src0
));
3473 else if (aop
== 1 && HL
== 0 && aopcde
== 11)
3475 OUTS (outf
, dregs_lo (dst0
));
3476 OUTS (outf
, " = (A0 += A1)");
3478 else if (aop
== 3 && HL
== 0 && aopcde
== 16)
3479 OUTS (outf
, "A1 = ABS A0, A0 = ABS A0");
3481 else if (aop
== 0 && aopcde
== 23 && HL
== 1)
3483 OUTS (outf
, dregs (dst0
));
3484 OUTS (outf
, " = BYTEOP3P (");
3485 OUTS (outf
, dregs (src0
+ 1));
3487 OUTS (outf
, imm5d (src0
));
3489 OUTS (outf
, dregs (src1
+ 1));
3491 OUTS (outf
, imm5d (src1
));
3492 OUTS (outf
, ") (HI");
3494 OUTS (outf
, ", R)");
3498 else if (aop
== 3 && aopcde
== 9 && s
== 0)
3500 OUTS (outf
, "A1.X = ");
3501 OUTS (outf
, dregs_lo (src0
));
3503 else if (aop
== 1 && HL
== 1 && aopcde
== 16)
3504 OUTS (outf
, "A1 = ABS A1");
3506 else if (aop
== 0 && HL
== 1 && aopcde
== 16)
3507 OUTS (outf
, "A1 = ABS A0");
3509 else if (aop
== 2 && aopcde
== 9 && s
== 1)
3511 OUTS (outf
, "A1 = ");
3512 OUTS (outf
, dregs (src0
));
3514 else if (HL
== 0 && aop
== 3 && aopcde
== 12)
3516 OUTS (outf
, dregs_lo (dst0
));
3518 OUTS (outf
, dregs (src0
));
3519 OUTS (outf
, " (RND)");
3521 else if (aop
== 1 && HL
== 0 && aopcde
== 16)
3522 OUTS (outf
, "A0 = ABS A1");
3524 else if (aop
== 0 && HL
== 0 && aopcde
== 16)
3525 OUTS (outf
, "A0 = ABS A0");
3527 else if (aop
== 3 && HL
== 0 && aopcde
== 15)
3529 OUTS (outf
, dregs (dst0
));
3530 OUTS (outf
, " = -");
3531 OUTS (outf
, dregs (src0
));
3532 OUTS (outf
, " (V)");
3534 else if (aop
== 3 && s
== 1 && HL
== 0 && aopcde
== 7)
3536 OUTS (outf
, dregs (dst0
));
3537 OUTS (outf
, " = -");
3538 OUTS (outf
, dregs (src0
));
3539 OUTS (outf
, " (S)");
3541 else if (aop
== 3 && s
== 0 && HL
== 0 && aopcde
== 7)
3543 OUTS (outf
, dregs (dst0
));
3544 OUTS (outf
, " = -");
3545 OUTS (outf
, dregs (src0
));
3546 OUTS (outf
, " (NS)");
3548 else if (aop
== 1 && HL
== 1 && aopcde
== 11)
3550 OUTS (outf
, dregs_hi (dst0
));
3551 OUTS (outf
, " = (A0 += A1)");
3553 else if (aop
== 2 && aopcde
== 11 && s
== 0)
3554 OUTS (outf
, "A0 += A1");
3556 else if (aop
== 2 && aopcde
== 11 && s
== 1)
3557 OUTS (outf
, "A0 += A1 (W32)");
3559 else if (aop
== 3 && HL
== 0 && aopcde
== 14)
3560 OUTS (outf
, "A1 = -A1, A0 = -A0");
3562 else if (HL
== 1 && aop
== 3 && aopcde
== 12)
3564 OUTS (outf
, dregs_hi (dst0
));
3566 OUTS (outf
, dregs (src0
));
3567 OUTS (outf
, " (RND)");
3569 else if (aop
== 0 && aopcde
== 23 && HL
== 0)
3571 OUTS (outf
, dregs (dst0
));
3572 OUTS (outf
, " = BYTEOP3P (");
3573 OUTS (outf
, dregs (src0
+ 1));
3575 OUTS (outf
, imm5d (src0
));
3577 OUTS (outf
, dregs (src1
+ 1));
3579 OUTS (outf
, imm5d (src1
));
3580 OUTS (outf
, ") (LO");
3582 OUTS (outf
, ", R)");
3586 else if (aop
== 0 && HL
== 0 && aopcde
== 14)
3587 OUTS (outf
, "A0 = -A0");
3589 else if (aop
== 1 && HL
== 0 && aopcde
== 14)
3590 OUTS (outf
, "A0 = -A1");
3592 else if (aop
== 0 && HL
== 1 && aopcde
== 14)
3593 OUTS (outf
, "A1 = -A0");
3595 else if (aop
== 1 && HL
== 1 && aopcde
== 14)
3596 OUTS (outf
, "A1 = -A1");
3598 else if (aop
== 0 && aopcde
== 12)
3600 OUTS (outf
, dregs_hi (dst0
));
3602 OUTS (outf
, dregs_lo (dst0
));
3603 OUTS (outf
, " = SIGN (");
3604 OUTS (outf
, dregs_hi (src0
));
3605 OUTS (outf
, ") * ");
3606 OUTS (outf
, dregs_hi (src1
));
3607 OUTS (outf
, " + SIGN (");
3608 OUTS (outf
, dregs_lo (src0
));
3609 OUTS (outf
, ") * ");
3610 OUTS (outf
, dregs_lo (src1
));
3612 else if (aop
== 2 && aopcde
== 0)
3614 OUTS (outf
, dregs (dst0
));
3616 OUTS (outf
, dregs (src0
));
3617 OUTS (outf
, " -|+ ");
3618 OUTS (outf
, dregs (src1
));
3621 else if (aop
== 1 && aopcde
== 12)
3623 OUTS (outf
, dregs (dst1
));
3624 OUTS (outf
, " = A1.L + A1.H, ");
3625 OUTS (outf
, dregs (dst0
));
3626 OUTS (outf
, " = A0.L + A0.H");
3628 else if (aop
== 2 && aopcde
== 4)
3630 OUTS (outf
, dregs (dst1
));
3632 OUTS (outf
, dregs (src0
));
3634 OUTS (outf
, dregs (src1
));
3636 OUTS (outf
, dregs (dst0
));
3638 OUTS (outf
, dregs (src0
));
3640 OUTS (outf
, dregs (src1
));
3643 else if (HL
== 0 && aopcde
== 1)
3645 OUTS (outf
, dregs (dst1
));
3647 OUTS (outf
, dregs (src0
));
3648 OUTS (outf
, " +|+ ");
3649 OUTS (outf
, dregs (src1
));
3651 OUTS (outf
, dregs (dst0
));
3653 OUTS (outf
, dregs (src0
));
3654 OUTS (outf
, " -|- ");
3655 OUTS (outf
, dregs (src1
));
3656 amod0amod2 (s
, x
, aop
, outf
);
3658 else if (aop
== 0 && aopcde
== 11)
3660 OUTS (outf
, dregs (dst0
));
3661 OUTS (outf
, " = (A0 += A1)");
3663 else if (aop
== 0 && aopcde
== 10)
3665 OUTS (outf
, dregs_lo (dst0
));
3666 OUTS (outf
, " = A0.X");
3668 else if (aop
== 1 && aopcde
== 10)
3670 OUTS (outf
, dregs_lo (dst0
));
3671 OUTS (outf
, " = A1.X");
3673 else if (aop
== 1 && aopcde
== 0)
3675 OUTS (outf
, dregs (dst0
));
3677 OUTS (outf
, dregs (src0
));
3678 OUTS (outf
, " +|- ");
3679 OUTS (outf
, dregs (src1
));
3682 else if (aop
== 3 && aopcde
== 0)
3684 OUTS (outf
, dregs (dst0
));
3686 OUTS (outf
, dregs (src0
));
3687 OUTS (outf
, " -|- ");
3688 OUTS (outf
, dregs (src1
));
3691 else if (aop
== 1 && aopcde
== 4)
3693 OUTS (outf
, dregs (dst0
));
3695 OUTS (outf
, dregs (src0
));
3697 OUTS (outf
, dregs (src1
));
3700 else if (aop
== 0 && aopcde
== 17)
3702 OUTS (outf
, dregs (dst1
));
3703 OUTS (outf
, " = A1 + A0, ");
3704 OUTS (outf
, dregs (dst0
));
3705 OUTS (outf
, " = A1 - A0");
3708 else if (aop
== 1 && aopcde
== 17)
3710 OUTS (outf
, dregs (dst1
));
3711 OUTS (outf
, " = A0 + A1, ");
3712 OUTS (outf
, dregs (dst0
));
3713 OUTS (outf
, " = A0 - A1");
3716 else if (aop
== 0 && aopcde
== 18)
3718 OUTS (outf
, "SAA (");
3719 OUTS (outf
, dregs (src0
+ 1));
3721 OUTS (outf
, imm5d (src0
));
3723 OUTS (outf
, dregs (src1
+ 1));
3725 OUTS (outf
, imm5d (src1
));
3729 else if (aop
== 3 && aopcde
== 18)
3730 OUTS (outf
, "DISALGNEXCPT");
3732 else if (aop
== 0 && aopcde
== 20)
3734 OUTS (outf
, dregs (dst0
));
3735 OUTS (outf
, " = BYTEOP1P (");
3736 OUTS (outf
, dregs (src0
+ 1));
3738 OUTS (outf
, imm5d (src0
));
3740 OUTS (outf
, dregs (src1
+ 1));
3742 OUTS (outf
, imm5d (src1
));
3746 else if (aop
== 1 && aopcde
== 20)
3748 OUTS (outf
, dregs (dst0
));
3749 OUTS (outf
, " = BYTEOP1P (");
3750 OUTS (outf
, dregs (src0
+ 1));
3752 OUTS (outf
, imm5d (src0
));
3754 OUTS (outf
, dregs (src1
+ 1));
3756 OUTS (outf
, imm5d (src1
));
3757 OUTS (outf
, ") (T");
3759 OUTS (outf
, ", R)");
3763 else if (aop
== 0 && aopcde
== 21)
3766 OUTS (outf
, dregs (dst1
));
3768 OUTS (outf
, dregs (dst0
));
3769 OUTS (outf
, ") = BYTEOP16P (");
3770 OUTS (outf
, dregs (src0
+ 1));
3772 OUTS (outf
, imm5d (src0
));
3774 OUTS (outf
, dregs (src1
+ 1));
3776 OUTS (outf
, imm5d (src1
));
3780 else if (aop
== 1 && aopcde
== 21)
3783 OUTS (outf
, dregs (dst1
));
3785 OUTS (outf
, dregs (dst0
));
3786 OUTS (outf
, ") = BYTEOP16M (");
3787 OUTS (outf
, dregs (src0
+ 1));
3789 OUTS (outf
, imm5d (src0
));
3791 OUTS (outf
, dregs (src1
+ 1));
3793 OUTS (outf
, imm5d (src1
));
3797 else if (aop
== 2 && aopcde
== 7)
3799 OUTS (outf
, dregs (dst0
));
3800 OUTS (outf
, " = ABS ");
3801 OUTS (outf
, dregs (src0
));
3803 else if (aop
== 1 && aopcde
== 7)
3805 OUTS (outf
, dregs (dst0
));
3806 OUTS (outf
, " = MIN (");
3807 OUTS (outf
, dregs (src0
));
3809 OUTS (outf
, dregs (src1
));
3812 else if (aop
== 0 && aopcde
== 7)
3814 OUTS (outf
, dregs (dst0
));
3815 OUTS (outf
, " = MAX (");
3816 OUTS (outf
, dregs (src0
));
3818 OUTS (outf
, dregs (src1
));
3821 else if (aop
== 2 && aopcde
== 6)
3823 OUTS (outf
, dregs (dst0
));
3824 OUTS (outf
, " = ABS ");
3825 OUTS (outf
, dregs (src0
));
3826 OUTS (outf
, " (V)");
3828 else if (aop
== 1 && aopcde
== 6)
3830 OUTS (outf
, dregs (dst0
));
3831 OUTS (outf
, " = MIN (");
3832 OUTS (outf
, dregs (src0
));
3834 OUTS (outf
, dregs (src1
));
3835 OUTS (outf
, ") (V)");
3837 else if (aop
== 0 && aopcde
== 6)
3839 OUTS (outf
, dregs (dst0
));
3840 OUTS (outf
, " = MAX (");
3841 OUTS (outf
, dregs (src0
));
3843 OUTS (outf
, dregs (src1
));
3844 OUTS (outf
, ") (V)");
3846 else if (HL
== 1 && aopcde
== 1)
3848 OUTS (outf
, dregs (dst1
));
3850 OUTS (outf
, dregs (src0
));
3851 OUTS (outf
, " +|- ");
3852 OUTS (outf
, dregs (src1
));
3854 OUTS (outf
, dregs (dst0
));
3856 OUTS (outf
, dregs (src0
));
3857 OUTS (outf
, " -|+ ");
3858 OUTS (outf
, dregs (src1
));
3859 amod0amod2 (s
, x
, aop
, outf
);
3861 else if (aop
== 0 && aopcde
== 4)
3863 OUTS (outf
, dregs (dst0
));
3865 OUTS (outf
, dregs (src0
));
3867 OUTS (outf
, dregs (src1
));
3870 else if (aop
== 0 && aopcde
== 0)
3872 OUTS (outf
, dregs (dst0
));
3874 OUTS (outf
, dregs (src0
));
3875 OUTS (outf
, " +|+ ");
3876 OUTS (outf
, dregs (src1
));
3879 else if (aop
== 0 && aopcde
== 24)
3881 OUTS (outf
, dregs (dst0
));
3882 OUTS (outf
, " = BYTEPACK (");
3883 OUTS (outf
, dregs (src0
));
3885 OUTS (outf
, dregs (src1
));
3888 else if (aop
== 1 && aopcde
== 24)
3891 OUTS (outf
, dregs (dst1
));
3893 OUTS (outf
, dregs (dst0
));
3894 OUTS (outf
, ") = BYTEUNPACK ");
3895 OUTS (outf
, dregs (src0
+ 1));
3897 OUTS (outf
, imm5d (src0
));
3900 else if (aopcde
== 13)
3903 OUTS (outf
, dregs (dst1
));
3905 OUTS (outf
, dregs (dst0
));
3906 OUTS (outf
, ") = SEARCH ");
3907 OUTS (outf
, dregs (src0
));
3909 searchmod (aop
, outf
);
3919 decode_dsp32shift_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
3922 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
3923 | 1 | 1 | 0 | 0 |.M.| 1 | 1 | 0 | 0 | - | - |.sopcde............|
3924 |.sop...|.HLs...|.dst0......| - | - | - |.src0......|.src1......|
3925 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
3926 int HLs
= ((iw1
>> DSP32Shift_HLs_bits
) & DSP32Shift_HLs_mask
);
3927 int sop
= ((iw1
>> DSP32Shift_sop_bits
) & DSP32Shift_sop_mask
);
3928 int src0
= ((iw1
>> DSP32Shift_src0_bits
) & DSP32Shift_src0_mask
);
3929 int src1
= ((iw1
>> DSP32Shift_src1_bits
) & DSP32Shift_src1_mask
);
3930 int dst0
= ((iw1
>> DSP32Shift_dst0_bits
) & DSP32Shift_dst0_mask
);
3931 int sopcde
= ((iw0
>> (DSP32Shift_sopcde_bits
- 16)) & DSP32Shift_sopcde_mask
);
3932 const char *acc01
= (HLs
& 1) == 0 ? "A0" : "A1";
3934 if (HLs
== 0 && sop
== 0 && sopcde
== 0)
3936 OUTS (outf
, dregs_lo (dst0
));
3937 OUTS (outf
, " = ASHIFT ");
3938 OUTS (outf
, dregs_lo (src1
));
3939 OUTS (outf
, " BY ");
3940 OUTS (outf
, dregs_lo (src0
));
3942 else if (HLs
== 1 && sop
== 0 && sopcde
== 0)
3944 OUTS (outf
, dregs_lo (dst0
));
3945 OUTS (outf
, " = ASHIFT ");
3946 OUTS (outf
, dregs_hi (src1
));
3947 OUTS (outf
, " BY ");
3948 OUTS (outf
, dregs_lo (src0
));
3950 else if (HLs
== 2 && sop
== 0 && sopcde
== 0)
3952 OUTS (outf
, dregs_hi (dst0
));
3953 OUTS (outf
, " = ASHIFT ");
3954 OUTS (outf
, dregs_lo (src1
));
3955 OUTS (outf
, " BY ");
3956 OUTS (outf
, dregs_lo (src0
));
3958 else if (HLs
== 3 && sop
== 0 && sopcde
== 0)
3960 OUTS (outf
, dregs_hi (dst0
));
3961 OUTS (outf
, " = ASHIFT ");
3962 OUTS (outf
, dregs_hi (src1
));
3963 OUTS (outf
, " BY ");
3964 OUTS (outf
, dregs_lo (src0
));
3966 else if (HLs
== 0 && sop
== 1 && sopcde
== 0)
3968 OUTS (outf
, dregs_lo (dst0
));
3969 OUTS (outf
, " = ASHIFT ");
3970 OUTS (outf
, dregs_lo (src1
));
3971 OUTS (outf
, " BY ");
3972 OUTS (outf
, dregs_lo (src0
));
3973 OUTS (outf
, " (S)");
3975 else if (HLs
== 1 && sop
== 1 && sopcde
== 0)
3977 OUTS (outf
, dregs_lo (dst0
));
3978 OUTS (outf
, " = ASHIFT ");
3979 OUTS (outf
, dregs_hi (src1
));
3980 OUTS (outf
, " BY ");
3981 OUTS (outf
, dregs_lo (src0
));
3982 OUTS (outf
, " (S)");
3984 else if (HLs
== 2 && sop
== 1 && sopcde
== 0)
3986 OUTS (outf
, dregs_hi (dst0
));
3987 OUTS (outf
, " = ASHIFT ");
3988 OUTS (outf
, dregs_lo (src1
));
3989 OUTS (outf
, " BY ");
3990 OUTS (outf
, dregs_lo (src0
));
3991 OUTS (outf
, " (S)");
3993 else if (HLs
== 3 && sop
== 1 && sopcde
== 0)
3995 OUTS (outf
, dregs_hi (dst0
));
3996 OUTS (outf
, " = ASHIFT ");
3997 OUTS (outf
, dregs_hi (src1
));
3998 OUTS (outf
, " BY ");
3999 OUTS (outf
, dregs_lo (src0
));
4000 OUTS (outf
, " (S)");
4002 else if (sop
== 2 && sopcde
== 0)
4004 OUTS (outf
, (HLs
& 2) == 0 ? dregs_lo (dst0
) : dregs_hi (dst0
));
4005 OUTS (outf
, " = LSHIFT ");
4006 OUTS (outf
, (HLs
& 1) == 0 ? dregs_lo (src1
) : dregs_hi (src1
));
4007 OUTS (outf
, " BY ");
4008 OUTS (outf
, dregs_lo (src0
));
4010 else if (sop
== 0 && sopcde
== 3)
4013 OUTS (outf
, " = ASHIFT ");
4015 OUTS (outf
, " BY ");
4016 OUTS (outf
, dregs_lo (src0
));
4018 else if (sop
== 1 && sopcde
== 3)
4021 OUTS (outf
, " = LSHIFT ");
4023 OUTS (outf
, " BY ");
4024 OUTS (outf
, dregs_lo (src0
));
4026 else if (sop
== 2 && sopcde
== 3)
4029 OUTS (outf
, " = ROT ");
4031 OUTS (outf
, " BY ");
4032 OUTS (outf
, dregs_lo (src0
));
4034 else if (sop
== 3 && sopcde
== 3)
4036 OUTS (outf
, dregs (dst0
));
4037 OUTS (outf
, " = ROT ");
4038 OUTS (outf
, dregs (src1
));
4039 OUTS (outf
, " BY ");
4040 OUTS (outf
, dregs_lo (src0
));
4042 else if (sop
== 1 && sopcde
== 1)
4044 OUTS (outf
, dregs (dst0
));
4045 OUTS (outf
, " = ASHIFT ");
4046 OUTS (outf
, dregs (src1
));
4047 OUTS (outf
, " BY ");
4048 OUTS (outf
, dregs_lo (src0
));
4049 OUTS (outf
, " (V, S)");
4051 else if (sop
== 0 && sopcde
== 1)
4053 OUTS (outf
, dregs (dst0
));
4054 OUTS (outf
, " = ASHIFT ");
4055 OUTS (outf
, dregs (src1
));
4056 OUTS (outf
, " BY ");
4057 OUTS (outf
, dregs_lo (src0
));
4058 OUTS (outf
, " (V)");
4060 else if (sop
== 0 && sopcde
== 2)
4062 OUTS (outf
, dregs (dst0
));
4063 OUTS (outf
, " = ASHIFT ");
4064 OUTS (outf
, dregs (src1
));
4065 OUTS (outf
, " BY ");
4066 OUTS (outf
, dregs_lo (src0
));
4068 else if (sop
== 1 && sopcde
== 2)
4070 OUTS (outf
, dregs (dst0
));
4071 OUTS (outf
, " = ASHIFT ");
4072 OUTS (outf
, dregs (src1
));
4073 OUTS (outf
, " BY ");
4074 OUTS (outf
, dregs_lo (src0
));
4075 OUTS (outf
, " (S)");
4077 else if (sop
== 2 && sopcde
== 2)
4079 OUTS (outf
, dregs (dst0
));
4080 OUTS (outf
, " = LSHIFT ");
4081 OUTS (outf
, dregs (src1
));
4082 OUTS (outf
, " BY ");
4083 OUTS (outf
, dregs_lo (src0
));
4085 else if (sop
== 3 && sopcde
== 2)
4087 OUTS (outf
, dregs (dst0
));
4088 OUTS (outf
, " = ROT ");
4089 OUTS (outf
, dregs (src1
));
4090 OUTS (outf
, " BY ");
4091 OUTS (outf
, dregs_lo (src0
));
4093 else if (sop
== 2 && sopcde
== 1)
4095 OUTS (outf
, dregs (dst0
));
4096 OUTS (outf
, " = LSHIFT ");
4097 OUTS (outf
, dregs (src1
));
4098 OUTS (outf
, " BY ");
4099 OUTS (outf
, dregs_lo (src0
));
4100 OUTS (outf
, " (V)");
4102 else if (sop
== 0 && sopcde
== 4)
4104 OUTS (outf
, dregs (dst0
));
4105 OUTS (outf
, " = PACK (");
4106 OUTS (outf
, dregs_lo (src1
));
4108 OUTS (outf
, dregs_lo (src0
));
4111 else if (sop
== 1 && sopcde
== 4)
4113 OUTS (outf
, dregs (dst0
));
4114 OUTS (outf
, " = PACK (");
4115 OUTS (outf
, dregs_lo (src1
));
4117 OUTS (outf
, dregs_hi (src0
));
4120 else if (sop
== 2 && sopcde
== 4)
4122 OUTS (outf
, dregs (dst0
));
4123 OUTS (outf
, " = PACK (");
4124 OUTS (outf
, dregs_hi (src1
));
4126 OUTS (outf
, dregs_lo (src0
));
4129 else if (sop
== 3 && sopcde
== 4)
4131 OUTS (outf
, dregs (dst0
));
4132 OUTS (outf
, " = PACK (");
4133 OUTS (outf
, dregs_hi (src1
));
4135 OUTS (outf
, dregs_hi (src0
));
4138 else if (sop
== 0 && sopcde
== 5)
4140 OUTS (outf
, dregs_lo (dst0
));
4141 OUTS (outf
, " = SIGNBITS ");
4142 OUTS (outf
, dregs (src1
));
4144 else if (sop
== 1 && sopcde
== 5)
4146 OUTS (outf
, dregs_lo (dst0
));
4147 OUTS (outf
, " = SIGNBITS ");
4148 OUTS (outf
, dregs_lo (src1
));
4150 else if (sop
== 2 && sopcde
== 5)
4152 OUTS (outf
, dregs_lo (dst0
));
4153 OUTS (outf
, " = SIGNBITS ");
4154 OUTS (outf
, dregs_hi (src1
));
4156 else if (sop
== 0 && sopcde
== 6)
4158 OUTS (outf
, dregs_lo (dst0
));
4159 OUTS (outf
, " = SIGNBITS A0");
4161 else if (sop
== 1 && sopcde
== 6)
4163 OUTS (outf
, dregs_lo (dst0
));
4164 OUTS (outf
, " = SIGNBITS A1");
4166 else if (sop
== 3 && sopcde
== 6)
4168 OUTS (outf
, dregs_lo (dst0
));
4169 OUTS (outf
, " = ONES ");
4170 OUTS (outf
, dregs (src1
));
4172 else if (sop
== 0 && sopcde
== 7)
4174 OUTS (outf
, dregs_lo (dst0
));
4175 OUTS (outf
, " = EXPADJ (");
4176 OUTS (outf
, dregs (src1
));
4178 OUTS (outf
, dregs_lo (src0
));
4181 else if (sop
== 1 && sopcde
== 7)
4183 OUTS (outf
, dregs_lo (dst0
));
4184 OUTS (outf
, " = EXPADJ (");
4185 OUTS (outf
, dregs (src1
));
4187 OUTS (outf
, dregs_lo (src0
));
4188 OUTS (outf
, ") (V)");
4190 else if (sop
== 2 && sopcde
== 7)
4192 OUTS (outf
, dregs_lo (dst0
));
4193 OUTS (outf
, " = EXPADJ (");
4194 OUTS (outf
, dregs_lo (src1
));
4196 OUTS (outf
, dregs_lo (src0
));
4199 else if (sop
== 3 && sopcde
== 7)
4201 OUTS (outf
, dregs_lo (dst0
));
4202 OUTS (outf
, " = EXPADJ (");
4203 OUTS (outf
, dregs_hi (src1
));
4205 OUTS (outf
, dregs_lo (src0
));
4208 else if (sop
== 0 && sopcde
== 8)
4210 OUTS (outf
, "BITMUX (");
4211 OUTS (outf
, dregs (src0
));
4213 OUTS (outf
, dregs (src1
));
4214 OUTS (outf
, ", A0) (ASR)");
4216 else if (sop
== 1 && sopcde
== 8)
4218 OUTS (outf
, "BITMUX (");
4219 OUTS (outf
, dregs (src0
));
4221 OUTS (outf
, dregs (src1
));
4222 OUTS (outf
, ", A0) (ASL)");
4224 else if (sop
== 0 && sopcde
== 9)
4226 OUTS (outf
, dregs_lo (dst0
));
4227 OUTS (outf
, " = VIT_MAX (");
4228 OUTS (outf
, dregs (src1
));
4229 OUTS (outf
, ") (ASL)");
4231 else if (sop
== 1 && sopcde
== 9)
4233 OUTS (outf
, dregs_lo (dst0
));
4234 OUTS (outf
, " = VIT_MAX (");
4235 OUTS (outf
, dregs (src1
));
4236 OUTS (outf
, ") (ASR)");
4238 else if (sop
== 2 && sopcde
== 9)
4240 OUTS (outf
, dregs (dst0
));
4241 OUTS (outf
, " = VIT_MAX (");
4242 OUTS (outf
, dregs (src1
));
4244 OUTS (outf
, dregs (src0
));
4245 OUTS (outf
, ") (ASL)");
4247 else if (sop
== 3 && sopcde
== 9)
4249 OUTS (outf
, dregs (dst0
));
4250 OUTS (outf
, " = VIT_MAX (");
4251 OUTS (outf
, dregs (src1
));
4253 OUTS (outf
, dregs (src0
));
4254 OUTS (outf
, ") (ASR)");
4256 else if (sop
== 0 && sopcde
== 10)
4258 OUTS (outf
, dregs (dst0
));
4259 OUTS (outf
, " = EXTRACT (");
4260 OUTS (outf
, dregs (src1
));
4262 OUTS (outf
, dregs_lo (src0
));
4263 OUTS (outf
, ") (Z)");
4265 else if (sop
== 1 && sopcde
== 10)
4267 OUTS (outf
, dregs (dst0
));
4268 OUTS (outf
, " = EXTRACT (");
4269 OUTS (outf
, dregs (src1
));
4271 OUTS (outf
, dregs_lo (src0
));
4272 OUTS (outf
, ") (X)");
4274 else if (sop
== 2 && sopcde
== 10)
4276 OUTS (outf
, dregs (dst0
));
4277 OUTS (outf
, " = DEPOSIT (");
4278 OUTS (outf
, dregs (src1
));
4280 OUTS (outf
, dregs (src0
));
4283 else if (sop
== 3 && sopcde
== 10)
4285 OUTS (outf
, dregs (dst0
));
4286 OUTS (outf
, " = DEPOSIT (");
4287 OUTS (outf
, dregs (src1
));
4289 OUTS (outf
, dregs (src0
));
4290 OUTS (outf
, ") (X)");
4292 else if (sop
== 0 && sopcde
== 11)
4294 OUTS (outf
, dregs_lo (dst0
));
4295 OUTS (outf
, " = CC = BXORSHIFT (A0, ");
4296 OUTS (outf
, dregs (src0
));
4299 else if (sop
== 1 && sopcde
== 11)
4301 OUTS (outf
, dregs_lo (dst0
));
4302 OUTS (outf
, " = CC = BXOR (A0, ");
4303 OUTS (outf
, dregs (src0
));
4306 else if (sop
== 0 && sopcde
== 12)
4307 OUTS (outf
, "A0 = BXORSHIFT (A0, A1, CC)");
4309 else if (sop
== 1 && sopcde
== 12)
4311 OUTS (outf
, dregs_lo (dst0
));
4312 OUTS (outf
, " = CC = BXOR (A0, A1, CC)");
4314 else if (sop
== 0 && sopcde
== 13)
4316 OUTS (outf
, dregs (dst0
));
4317 OUTS (outf
, " = ALIGN8 (");
4318 OUTS (outf
, dregs (src1
));
4320 OUTS (outf
, dregs (src0
));
4323 else if (sop
== 1 && sopcde
== 13)
4325 OUTS (outf
, dregs (dst0
));
4326 OUTS (outf
, " = ALIGN16 (");
4327 OUTS (outf
, dregs (src1
));
4329 OUTS (outf
, dregs (src0
));
4332 else if (sop
== 2 && sopcde
== 13)
4334 OUTS (outf
, dregs (dst0
));
4335 OUTS (outf
, " = ALIGN24 (");
4336 OUTS (outf
, dregs (src1
));
4338 OUTS (outf
, dregs (src0
));
4348 decode_dsp32shiftimm_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
4351 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
4352 | 1 | 1 | 0 | 0 |.M.| 1 | 1 | 0 | 1 | - | - |.sopcde............|
4353 |.sop...|.HLs...|.dst0......|.immag.................|.src1......|
4354 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4355 int src1
= ((iw1
>> DSP32ShiftImm_src1_bits
) & DSP32ShiftImm_src1_mask
);
4356 int sop
= ((iw1
>> DSP32ShiftImm_sop_bits
) & DSP32ShiftImm_sop_mask
);
4357 int bit8
= ((iw1
>> 8) & 0x1);
4358 int immag
= ((iw1
>> DSP32ShiftImm_immag_bits
) & DSP32ShiftImm_immag_mask
);
4359 int newimmag
= (-(iw1
>> DSP32ShiftImm_immag_bits
) & DSP32ShiftImm_immag_mask
);
4360 int dst0
= ((iw1
>> DSP32ShiftImm_dst0_bits
) & DSP32ShiftImm_dst0_mask
);
4361 int sopcde
= ((iw0
>> (DSP32ShiftImm_sopcde_bits
- 16)) & DSP32ShiftImm_sopcde_mask
);
4362 int HLs
= ((iw1
>> DSP32ShiftImm_HLs_bits
) & DSP32ShiftImm_HLs_mask
);
4365 if (sop
== 0 && sopcde
== 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 (newimmag
));
4373 else if (sop
== 1 && sopcde
== 0 && bit8
== 0)
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 (immag
));
4380 OUTS (outf
, " (S)");
4382 else if (sop
== 1 && sopcde
== 0 && bit8
== 1)
4384 OUTS (outf
, (HLs
& 2) ? dregs_hi (dst0
) : dregs_lo (dst0
));
4386 OUTS (outf
, (HLs
& 1) ? dregs_hi (src1
) : dregs_lo (src1
));
4387 OUTS (outf
, " >>> ");
4388 OUTS (outf
, uimm4 (newimmag
));
4389 OUTS (outf
, " (S)");
4391 else if (sop
== 2 && sopcde
== 0 && bit8
== 0)
4393 OUTS (outf
, (HLs
& 2) ? dregs_hi (dst0
) : dregs_lo (dst0
));
4395 OUTS (outf
, (HLs
& 1) ? dregs_hi (src1
) : dregs_lo (src1
));
4396 OUTS (outf
, " << ");
4397 OUTS (outf
, uimm4 (immag
));
4399 else if (sop
== 2 && sopcde
== 0 && bit8
== 1)
4401 OUTS (outf
, (HLs
& 2) ? dregs_hi (dst0
) : dregs_lo (dst0
));
4403 OUTS (outf
, (HLs
& 1) ? dregs_hi (src1
) : dregs_lo (src1
));
4404 OUTS (outf
, " >> ");
4405 OUTS (outf
, uimm4 (newimmag
));
4407 else if (sop
== 2 && sopcde
== 3 && HLs
== 1)
4409 OUTS (outf
, "A1 = ROT A1 BY ");
4410 OUTS (outf
, imm6 (immag
));
4412 else if (sop
== 0 && sopcde
== 3 && HLs
== 0 && bit8
== 0)
4414 OUTS (outf
, "A0 = A0 << ");
4415 OUTS (outf
, uimm5 (immag
));
4417 else if (sop
== 0 && sopcde
== 3 && HLs
== 0 && bit8
== 1)
4419 OUTS (outf
, "A0 = A0 >>> ");
4420 OUTS (outf
, uimm5 (newimmag
));
4422 else if (sop
== 0 && sopcde
== 3 && HLs
== 1 && bit8
== 0)
4424 OUTS (outf
, "A1 = A1 << ");
4425 OUTS (outf
, uimm5 (immag
));
4427 else if (sop
== 0 && sopcde
== 3 && HLs
== 1 && bit8
== 1)
4429 OUTS (outf
, "A1 = A1 >>> ");
4430 OUTS (outf
, uimm5 (newimmag
));
4432 else if (sop
== 1 && sopcde
== 3 && HLs
== 0)
4434 OUTS (outf
, "A0 = A0 >> ");
4435 OUTS (outf
, uimm5 (newimmag
));
4437 else if (sop
== 1 && sopcde
== 3 && HLs
== 1)
4439 OUTS (outf
, "A1 = A1 >> ");
4440 OUTS (outf
, uimm5 (newimmag
));
4442 else if (sop
== 2 && sopcde
== 3 && HLs
== 0)
4444 OUTS (outf
, "A0 = ROT A0 BY ");
4445 OUTS (outf
, imm6 (immag
));
4447 else if (sop
== 1 && sopcde
== 1 && bit8
== 0)
4449 OUTS (outf
, dregs (dst0
));
4451 OUTS (outf
, dregs (src1
));
4452 OUTS (outf
, " << ");
4453 OUTS (outf
, uimm5 (immag
));
4454 OUTS (outf
, " (V, S)");
4456 else if (sop
== 1 && sopcde
== 1 && bit8
== 1)
4458 OUTS (outf
, dregs (dst0
));
4460 OUTS (outf
, dregs (src1
));
4461 OUTS (outf
, " >>> ");
4462 OUTS (outf
, imm5 (-immag
));
4463 OUTS (outf
, " (V, S)");
4465 else if (sop
== 2 && sopcde
== 1 && bit8
== 1)
4467 OUTS (outf
, dregs (dst0
));
4469 OUTS (outf
, dregs (src1
));
4470 OUTS (outf
, " >> ");
4471 OUTS (outf
, uimm5 (newimmag
));
4472 OUTS (outf
, " (V)");
4474 else if (sop
== 2 && sopcde
== 1 && bit8
== 0)
4476 OUTS (outf
, dregs (dst0
));
4478 OUTS (outf
, dregs (src1
));
4479 OUTS (outf
, " << ");
4480 OUTS (outf
, imm5 (immag
));
4481 OUTS (outf
, " (V)");
4483 else if (sop
== 0 && sopcde
== 1)
4485 OUTS (outf
, dregs (dst0
));
4487 OUTS (outf
, dregs (src1
));
4488 OUTS (outf
, " >>> ");
4489 OUTS (outf
, uimm5 (newimmag
));
4490 OUTS (outf
, " (V)");
4492 else if (sop
== 1 && sopcde
== 2)
4494 OUTS (outf
, dregs (dst0
));
4496 OUTS (outf
, dregs (src1
));
4497 OUTS (outf
, " << ");
4498 OUTS (outf
, uimm5 (immag
));
4499 OUTS (outf
, " (S)");
4501 else if (sop
== 2 && sopcde
== 2 && bit8
== 1)
4503 OUTS (outf
, dregs (dst0
));
4505 OUTS (outf
, dregs (src1
));
4506 OUTS (outf
, " >> ");
4507 OUTS (outf
, uimm5 (newimmag
));
4509 else if (sop
== 2 && sopcde
== 2 && bit8
== 0)
4511 OUTS (outf
, dregs (dst0
));
4513 OUTS (outf
, dregs (src1
));
4514 OUTS (outf
, " << ");
4515 OUTS (outf
, uimm5 (immag
));
4517 else if (sop
== 3 && sopcde
== 2)
4519 OUTS (outf
, dregs (dst0
));
4520 OUTS (outf
, " = ROT ");
4521 OUTS (outf
, dregs (src1
));
4522 OUTS (outf
, " BY ");
4523 OUTS (outf
, imm6 (immag
));
4525 else if (sop
== 0 && sopcde
== 2)
4527 OUTS (outf
, dregs (dst0
));
4529 OUTS (outf
, dregs (src1
));
4530 OUTS (outf
, " >>> ");
4531 OUTS (outf
, uimm5 (newimmag
));
4540 decode_pseudoDEBUG_0 (TIword iw0
, disassemble_info
*outf
)
4543 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
4544 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 |.fn....|.grp.......|.reg.......|
4545 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4546 int fn
= ((iw0
>> PseudoDbg_fn_bits
) & PseudoDbg_fn_mask
);
4547 int grp
= ((iw0
>> PseudoDbg_grp_bits
) & PseudoDbg_grp_mask
);
4548 int reg
= ((iw0
>> PseudoDbg_reg_bits
) & PseudoDbg_reg_mask
);
4553 if (reg
== 0 && fn
== 3)
4554 OUTS (outf
, "DBG A0");
4556 else if (reg
== 1 && fn
== 3)
4557 OUTS (outf
, "DBG A1");
4559 else if (reg
== 3 && fn
== 3)
4560 OUTS (outf
, "ABORT");
4562 else if (reg
== 4 && fn
== 3)
4565 else if (reg
== 5 && fn
== 3)
4566 OUTS (outf
, "DBGHALT");
4568 else if (reg
== 6 && fn
== 3)
4570 OUTS (outf
, "DBGCMPLX (");
4571 OUTS (outf
, dregs (grp
));
4574 else if (reg
== 7 && fn
== 3)
4577 else if (grp
== 0 && fn
== 2)
4579 OUTS (outf
, "OUTC ");
4580 OUTS (outf
, dregs (reg
));
4584 OUTS (outf
, "DBG ");
4585 OUTS (outf
, allregs (reg
, grp
));
4589 OUTS (outf
, "PRNT ");
4590 OUTS (outf
, allregs (reg
, grp
));
4599 decode_pseudoOChar_0 (TIword iw0
, disassemble_info
*outf
)
4602 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
4603 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 1 |.ch............................|
4604 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4605 int ch
= ((iw0
>> PseudoChr_ch_bits
) & PseudoChr_ch_mask
);
4610 OUTS (outf
, "OUTC ");
4611 OUTS (outf
, uimm8 (ch
));
4617 decode_pseudodbg_assert_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
4620 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
4621 | 1 | 1 | 1 | 1 | 0 | - | - | - | dbgop |.grp.......|.regtest...|
4622 |.expected......................................................|
4623 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4624 int expected
= ((iw1
>> PseudoDbg_Assert_expected_bits
) & PseudoDbg_Assert_expected_mask
);
4625 int dbgop
= ((iw0
>> (PseudoDbg_Assert_dbgop_bits
- 16)) & PseudoDbg_Assert_dbgop_mask
);
4626 int grp
= ((iw0
>> (PseudoDbg_Assert_grp_bits
- 16)) & PseudoDbg_Assert_grp_mask
);
4627 int regtest
= ((iw0
>> (PseudoDbg_Assert_regtest_bits
- 16)) & PseudoDbg_Assert_regtest_mask
);
4634 OUTS (outf
, "DBGA (");
4635 OUTS (outf
, regs_lo (regtest
, grp
));
4637 OUTS (outf
, uimm16 (expected
));
4640 else if (dbgop
== 1)
4642 OUTS (outf
, "DBGA (");
4643 OUTS (outf
, regs_hi (regtest
, grp
));
4645 OUTS (outf
, uimm16 (expected
));
4648 else if (dbgop
== 2)
4650 OUTS (outf
, "DBGAL (");
4651 OUTS (outf
, allregs (regtest
, grp
));
4653 OUTS (outf
, uimm16 (expected
));
4656 else if (dbgop
== 3)
4658 OUTS (outf
, "DBGAH (");
4659 OUTS (outf
, allregs (regtest
, grp
));
4661 OUTS (outf
, uimm16 (expected
));
4670 _print_insn_bfin (bfd_vma pc
, disassemble_info
*outf
)
4678 status
= (*outf
->read_memory_func
) (pc
& ~0x1, buf
, 2, outf
);
4681 status
= (*outf
->read_memory_func
) ((pc
+ 2) & ~0x1, buf
+ 2, 2, outf
);
4685 iw0
= bfd_getl16 (buf
);
4686 iw1
= bfd_getl16 (buf
+ 2);
4688 if ((iw0
& 0xf7ff) == 0xc003 && iw1
== 0x1800)
4692 OUTS (outf
, "ILLEGAL");
4695 OUTS (outf
, "MNOP");
4698 else if ((iw0
& 0xff00) == 0x0000)
4699 rv
= decode_ProgCtrl_0 (iw0
, outf
);
4700 else if ((iw0
& 0xffc0) == 0x0240)
4701 rv
= decode_CaCTRL_0 (iw0
, outf
);
4702 else if ((iw0
& 0xff80) == 0x0100)
4703 rv
= decode_PushPopReg_0 (iw0
, outf
);
4704 else if ((iw0
& 0xfe00) == 0x0400)
4705 rv
= decode_PushPopMultiple_0 (iw0
, outf
);
4706 else if ((iw0
& 0xfe00) == 0x0600)
4707 rv
= decode_ccMV_0 (iw0
, outf
);
4708 else if ((iw0
& 0xf800) == 0x0800)
4709 rv
= decode_CCflag_0 (iw0
, outf
);
4710 else if ((iw0
& 0xffe0) == 0x0200)
4711 rv
= decode_CC2dreg_0 (iw0
, outf
);
4712 else if ((iw0
& 0xff00) == 0x0300)
4713 rv
= decode_CC2stat_0 (iw0
, outf
);
4714 else if ((iw0
& 0xf000) == 0x1000)
4715 rv
= decode_BRCC_0 (iw0
, pc
, outf
);
4716 else if ((iw0
& 0xf000) == 0x2000)
4717 rv
= decode_UJUMP_0 (iw0
, pc
, outf
);
4718 else if ((iw0
& 0xf000) == 0x3000)
4719 rv
= decode_REGMV_0 (iw0
, outf
);
4720 else if ((iw0
& 0xfc00) == 0x4000)
4721 rv
= decode_ALU2op_0 (iw0
, outf
);
4722 else if ((iw0
& 0xfe00) == 0x4400)
4723 rv
= decode_PTR2op_0 (iw0
, outf
);
4724 else if ((iw0
& 0xf800) == 0x4800)
4725 rv
= decode_LOGI2op_0 (iw0
, outf
);
4726 else if ((iw0
& 0xf000) == 0x5000)
4727 rv
= decode_COMP3op_0 (iw0
, outf
);
4728 else if ((iw0
& 0xf800) == 0x6000)
4729 rv
= decode_COMPI2opD_0 (iw0
, outf
);
4730 else if ((iw0
& 0xf800) == 0x6800)
4731 rv
= decode_COMPI2opP_0 (iw0
, outf
);
4732 else if ((iw0
& 0xf000) == 0x8000)
4733 rv
= decode_LDSTpmod_0 (iw0
, outf
);
4734 else if ((iw0
& 0xff60) == 0x9e60)
4735 rv
= decode_dagMODim_0 (iw0
, outf
);
4736 else if ((iw0
& 0xfff0) == 0x9f60)
4737 rv
= decode_dagMODik_0 (iw0
, outf
);
4738 else if ((iw0
& 0xfc00) == 0x9c00)
4739 rv
= decode_dspLDST_0 (iw0
, outf
);
4740 else if ((iw0
& 0xf000) == 0x9000)
4741 rv
= decode_LDST_0 (iw0
, outf
);
4742 else if ((iw0
& 0xfc00) == 0xb800)
4743 rv
= decode_LDSTiiFP_0 (iw0
, outf
);
4744 else if ((iw0
& 0xe000) == 0xA000)
4745 rv
= decode_LDSTii_0 (iw0
, outf
);
4746 else if ((iw0
& 0xff80) == 0xe080 && (iw1
& 0x0C00) == 0x0000)
4747 rv
= decode_LoopSetup_0 (iw0
, iw1
, pc
, outf
);
4748 else if ((iw0
& 0xff00) == 0xe100 && (iw1
& 0x0000) == 0x0000)
4749 rv
= decode_LDIMMhalf_0 (iw0
, iw1
, outf
);
4750 else if ((iw0
& 0xfe00) == 0xe200 && (iw1
& 0x0000) == 0x0000)
4751 rv
= decode_CALLa_0 (iw0
, iw1
, pc
, outf
);
4752 else if ((iw0
& 0xfc00) == 0xe400 && (iw1
& 0x0000) == 0x0000)
4753 rv
= decode_LDSTidxI_0 (iw0
, iw1
, outf
);
4754 else if ((iw0
& 0xfffe) == 0xe800 && (iw1
& 0x0000) == 0x0000)
4755 rv
= decode_linkage_0 (iw0
, iw1
, outf
);
4756 else if ((iw0
& 0xf600) == 0xc000 && (iw1
& 0x0000) == 0x0000)
4757 rv
= decode_dsp32mac_0 (iw0
, iw1
, outf
);
4758 else if ((iw0
& 0xf600) == 0xc200 && (iw1
& 0x0000) == 0x0000)
4759 rv
= decode_dsp32mult_0 (iw0
, iw1
, outf
);
4760 else if ((iw0
& 0xf7c0) == 0xc400 && (iw1
& 0x0000) == 0x0000)
4761 rv
= decode_dsp32alu_0 (iw0
, iw1
, outf
);
4762 else if ((iw0
& 0xf780) == 0xc600 && (iw1
& 0x01c0) == 0x0000)
4763 rv
= decode_dsp32shift_0 (iw0
, iw1
, outf
);
4764 else if ((iw0
& 0xf780) == 0xc680 && (iw1
& 0x0000) == 0x0000)
4765 rv
= decode_dsp32shiftimm_0 (iw0
, iw1
, outf
);
4766 else if ((iw0
& 0xff00) == 0xf800)
4767 rv
= decode_pseudoDEBUG_0 (iw0
, outf
);
4768 else if ((iw0
& 0xFF00) == 0xF900)
4769 rv
= decode_pseudoOChar_0 (iw0
, outf
);
4770 else if ((iw0
& 0xFF00) == 0xf000 && (iw1
& 0x0000) == 0x0000)
4771 rv
= decode_pseudodbg_assert_0 (iw0
, iw1
, outf
);
4774 OUTS (outf
, "ILLEGAL");
4781 print_insn_bfin (bfd_vma pc
, disassemble_info
*outf
)
4788 status
= (*outf
->read_memory_func
) (pc
& ~0x01, buf
, 2, outf
);
4791 iw0
= bfd_getl16 (buf
);
4793 count
+= _print_insn_bfin (pc
, outf
);
4795 /* Proper display of multiple issue instructions. */
4797 if (count
== 4 && (iw0
& 0xc000) == 0xc000 && (iw0
& BIT_MULTI_INS
)
4798 && ((iw0
& 0xe800) != 0xe800 /* Not Linkage. */ ))
4804 outf
->fprintf_func (outf
->stream
, " || ");
4805 len
= _print_insn_bfin (pc
+ 4, outf
);
4806 outf
->fprintf_func (outf
->stream
, " || ");
4809 len
= _print_insn_bfin (pc
+ 6, outf
);
4817 outf
->fprintf_func (outf
->stream
, ";\t\t/* ILLEGAL PARALLEL INSTRUCTION */");
4825 outf
->fprintf_func (outf
->stream
, ";");