]> git.ipfire.org Git - thirdparty/binutils-gdb.git/blame - opcodes/bfin-dis.c
* config/bfin-defs.h (F_REG_ALL): Remove macro.
[thirdparty/binutils-gdb.git] / opcodes / bfin-dis.c
CommitLineData
4b7f6baa 1/* Disassemble ADI Blackfin Instructions.
aa820537 2 Copyright 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc.
4b7f6baa 3
9b201bb5
NC
4 This file is part of libopcodes.
5
6 This library is free software; you can redistribute it and/or modify
4b7f6baa 7 it under the terms of the GNU General Public License as published by
9b201bb5
NC
8 the Free Software Foundation; either version 3, or (at your option)
9 any later version.
4b7f6baa 10
9b201bb5
NC
11 It is distributed in the hope that it will be useful, but WITHOUT
12 ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
13 or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public
14 License for more details.
4b7f6baa
CM
15
16 You should have received a copy of the GNU General Public License
17 along with this program; if not, write to the Free Software
18 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
19 MA 02110-1301, USA. */
20
21#include <stdio.h>
22#include <stdlib.h>
23#include <string.h>
24
25#include "opcode/bfin.h"
26
27#define M_S2RND 1
28#define M_T 2
29#define M_W32 3
30#define M_FU 4
31#define M_TFU 6
32#define M_IS 8
33#define M_ISS2 9
34#define M_IH 11
35#define M_IU 12
36
37#ifndef PRINTF
38#define PRINTF printf
39#endif
40
41#ifndef EXIT
42#define EXIT exit
43#endif
44
45typedef long TIword;
46
b7d48530
NC
47#define HOST_LONG_WORD_SIZE (sizeof (long) * 8)
48#define XFIELD(w,p,s) (((w) & ((1 << (s)) - 1) << (p)) >> (p))
49#define SIGNEXTEND(v, n) ((v << (HOST_LONG_WORD_SIZE - (n))) >> (HOST_LONG_WORD_SIZE - (n)))
50#define MASKBITS(val, bits) (val & ((1 << bits) - 1))
4b7f6baa
CM
51
52#include "dis-asm.h"
b7d48530 53
b21c9cb4
BS
54typedef unsigned int bu32;
55
4b7f6baa
CM
56typedef enum
57{
58 c_0, c_1, c_4, c_2, c_uimm2, c_uimm3, c_imm3, c_pcrel4,
086134ec
BS
59 c_imm4, c_uimm4s4, c_uimm4s4d, c_uimm4, c_uimm4s2, c_negimm5s4, c_imm5, c_imm5d, c_uimm5, c_imm6,
60 c_imm7, c_imm7d, c_imm8, c_uimm8, c_pcrel8, c_uimm8s4, c_pcrel8s4, c_lppcrel10, c_pcrel10,
61 c_pcrel12, c_imm16s4, c_luimm16, c_imm16, c_imm16d, c_huimm16, c_rimm16, c_imm16s2, c_uimm16s4,
62 c_uimm16s4d, c_uimm16, c_pcrel24, c_uimm32, c_imm32, c_huimm32, c_huimm32e,
4b7f6baa
CM
63} const_forms_t;
64
65static struct
66{
67 char *name;
68 int nbits;
69 char reloc;
70 char issigned;
71 char pcrel;
72 char scale;
73 char offset;
74 char negative;
75 char positive;
086134ec
BS
76 char decimal;
77 char leading;
78 char exact;
4b7f6baa
CM
79} constant_formats[] =
80{
086134ec
BS
81 { "0", 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
82 { "1", 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
83 { "4", 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
84 { "2", 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
85 { "uimm2", 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
86 { "uimm3", 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
87 { "imm3", 3, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
88 { "pcrel4", 4, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0},
89 { "imm4", 4, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
90 { "uimm4s4", 4, 0, 0, 0, 2, 0, 0, 1, 0, 0, 0},
91 { "uimm4s4d", 4, 0, 0, 0, 2, 0, 0, 1, 1, 0, 0},
92 { "uimm4", 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
93 { "uimm4s2", 4, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0},
94 { "negimm5s4", 5, 0, 1, 0, 2, 0, 1, 0, 0, 0, 0},
95 { "imm5", 5, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
96 { "imm5d", 5, 0, 1, 0, 0, 0, 0, 0, 1, 0, 0},
97 { "uimm5", 5, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
98 { "imm6", 6, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
99 { "imm7", 7, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
100 { "imm7d", 7, 0, 1, 0, 0, 0, 0, 0, 1, 3, 0},
101 { "imm8", 8, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
102 { "uimm8", 8, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
103 { "pcrel8", 8, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0},
104 { "uimm8s4", 8, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0},
105 { "pcrel8s4", 8, 1, 1, 1, 2, 0, 0, 0, 0, 0, 0},
106 { "lppcrel10", 10, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0},
107 { "pcrel10", 10, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0},
108 { "pcrel12", 12, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0},
109 { "imm16s4", 16, 0, 1, 0, 2, 0, 0, 0, 0, 0, 0},
110 { "luimm16", 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
111 { "imm16", 16, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0},
112 { "imm16d", 16, 0, 1, 0, 0, 0, 0, 0, 1, 3, 0},
113 { "huimm16", 16, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
114 { "rimm16", 16, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0},
115 { "imm16s2", 16, 0, 1, 0, 1, 0, 0, 0, 0, 0, 0},
116 { "uimm16s4", 16, 0, 0, 0, 2, 0, 0, 0, 0, 0, 0},
117 { "uimm16s4d", 16, 0, 0, 0, 2, 0, 0, 0, 1, 0, 0},
118 { "uimm16", 16, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
119 { "pcrel24", 24, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0},
120 { "uimm32", 32, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0},
121 { "imm32", 32, 0, 1, 0, 0, 0, 0, 0, 1, 3, 0},
122 { "huimm32", 32, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0},
123 { "huimm32e", 32, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1},
4b7f6baa
CM
124};
125
126int _print_insn_bfin (bfd_vma pc, disassemble_info * outf);
127int print_insn_bfin (bfd_vma pc, disassemble_info * outf);
128
086134ec
BS
129static char comment = 0;
130static char parallel = 0;
131
4b7f6baa
CM
132static char *
133fmtconst (const_forms_t cf, TIword x, bfd_vma pc, disassemble_info * outf)
134{
135 static char buf[60];
136
137 if (constant_formats[cf].reloc)
138 {
139 bfd_vma ea = (((constant_formats[cf].pcrel ? SIGNEXTEND (x, constant_formats[cf].nbits)
140 : x) + constant_formats[cf].offset) << constant_formats[cf].scale);
141 if (constant_formats[cf].pcrel)
142 ea += pc;
143
086134ec
BS
144 if (outf->symbol_at_address_func (ea, outf) || !constant_formats[cf].exact)
145 {
146 outf->print_address_func (ea, outf);
147 return "";
148 }
149 else
150 {
0af1713e 151 sprintf (buf, "%lx", (unsigned long) x);
086134ec
BS
152 return buf;
153 }
4b7f6baa
CM
154 }
155
156 /* Negative constants have an implied sign bit. */
157 if (constant_formats[cf].negative)
158 {
159 int nb = constant_formats[cf].nbits + 1;
b7d48530 160
4b7f6baa
CM
161 x = x | (1 << constant_formats[cf].nbits);
162 x = SIGNEXTEND (x, nb);
163 }
164 else
165 x = constant_formats[cf].issigned ? SIGNEXTEND (x, constant_formats[cf].nbits) : x;
166
167 if (constant_formats[cf].offset)
168 x += constant_formats[cf].offset;
169
170 if (constant_formats[cf].scale)
171 x <<= constant_formats[cf].scale;
172
086134ec
BS
173 if (constant_formats[cf].decimal)
174 {
175 if (constant_formats[cf].leading)
176 {
177 char ps[10];
178 sprintf (ps, "%%%ii", constant_formats[cf].leading);
179 sprintf (buf, ps, x);
180 }
181 else
182 sprintf (buf, "%li", x);
183 }
4b7f6baa 184 else
086134ec
BS
185 {
186 if (constant_formats[cf].issigned && x < 0)
187 sprintf (buf, "-0x%x", abs (x));
188 else
0af1713e 189 sprintf (buf, "0x%lx", (unsigned long) x);
086134ec 190 }
4b7f6baa
CM
191
192 return buf;
193}
194
b21c9cb4
BS
195static bu32
196fmtconst_val (const_forms_t cf, unsigned int x, unsigned int pc)
197{
198 if (0 && constant_formats[cf].reloc)
199 {
200 bu32 ea = (((constant_formats[cf].pcrel
086134ec
BS
201 ? SIGNEXTEND (x, constant_formats[cf].nbits)
202 : x) + constant_formats[cf].offset)
203 << constant_formats[cf].scale);
b21c9cb4 204 if (constant_formats[cf].pcrel)
086134ec 205 ea += pc;
b21c9cb4
BS
206
207 return ea;
208 }
209
210 /* Negative constants have an implied sign bit. */
211 if (constant_formats[cf].negative)
212 {
213 int nb = constant_formats[cf].nbits + 1;
214 x = x | (1 << constant_formats[cf].nbits);
215 x = SIGNEXTEND (x, nb);
216 }
217 else if (constant_formats[cf].issigned)
218 x = SIGNEXTEND (x, constant_formats[cf].nbits);
219
220 x += constant_formats[cf].offset;
221 x <<= constant_formats[cf].scale;
222
223 return x;
224}
225
4b7f6baa
CM
226enum machine_registers
227{
228 REG_RL0, REG_RL1, REG_RL2, REG_RL3, REG_RL4, REG_RL5, REG_RL6, REG_RL7,
229 REG_RH0, REG_RH1, REG_RH2, REG_RH3, REG_RH4, REG_RH5, REG_RH6, REG_RH7,
230 REG_R0, REG_R1, REG_R2, REG_R3, REG_R4, REG_R5, REG_R6, REG_R7,
231 REG_R1_0, REG_R3_2, REG_R5_4, REG_R7_6, REG_P0, REG_P1, REG_P2, REG_P3,
232 REG_P4, REG_P5, REG_SP, REG_FP, REG_A0x, REG_A1x, REG_A0w, REG_A1w,
233 REG_A0, REG_A1, REG_I0, REG_I1, REG_I2, REG_I3, REG_M0, REG_M1,
234 REG_M2, REG_M3, REG_B0, REG_B1, REG_B2, REG_B3, REG_L0, REG_L1,
235 REG_L2, REG_L3,
236 REG_AZ, REG_AN, REG_AC0, REG_AC1, REG_AV0, REG_AV1, REG_AV0S, REG_AV1S,
237 REG_AQ, REG_V, REG_VS,
238 REG_sftreset, REG_omode, REG_excause, REG_emucause, REG_idle_req, REG_hwerrcause, REG_CC, REG_LC0,
239 REG_LC1, REG_GP, REG_ASTAT, REG_RETS, REG_LT0, REG_LB0, REG_LT1, REG_LB1,
240 REG_CYCLES, REG_CYCLES2, REG_USP, REG_SEQSTAT, REG_SYSCFG, REG_RETI, REG_RETX, REG_RETN,
241 REG_RETE, REG_EMUDAT, REG_BR0, REG_BR1, REG_BR2, REG_BR3, REG_BR4, REG_BR5, REG_BR6,
242 REG_BR7, REG_PL0, REG_PL1, REG_PL2, REG_PL3, REG_PL4, REG_PL5, REG_SLP, REG_FLP,
243 REG_PH0, REG_PH1, REG_PH2, REG_PH3, REG_PH4, REG_PH5, REG_SHP, REG_FHP,
244 REG_IL0, REG_IL1, REG_IL2, REG_IL3, REG_ML0, REG_ML1, REG_ML2, REG_ML3,
245 REG_BL0, REG_BL1, REG_BL2, REG_BL3, REG_LL0, REG_LL1, REG_LL2, REG_LL3,
246 REG_IH0, REG_IH1, REG_IH2, REG_IH3, REG_MH0, REG_MH1, REG_MH2, REG_MH3,
247 REG_BH0, REG_BH1, REG_BH2, REG_BH3, REG_LH0, REG_LH1, REG_LH2, REG_LH3,
248 REG_LASTREG,
249};
250
251enum reg_class
252{
253 rc_dregs_lo, rc_dregs_hi, rc_dregs, rc_dregs_pair, rc_pregs, rc_spfp, rc_dregs_hilo, rc_accum_ext,
254 rc_accum_word, rc_accum, rc_iregs, rc_mregs, rc_bregs, rc_lregs, rc_dpregs, rc_gregs,
255 rc_regs, rc_statbits, rc_ignore_bits, rc_ccstat, rc_counters, rc_dregs2_sysregs1, rc_open, rc_sysregs2,
256 rc_sysregs3, rc_allregs,
257 LIM_REG_CLASSES
258};
259
260static char *reg_names[] =
261{
262 "R0.L", "R1.L", "R2.L", "R3.L", "R4.L", "R5.L", "R6.L", "R7.L",
263 "R0.H", "R1.H", "R2.H", "R3.H", "R4.H", "R5.H", "R6.H", "R7.H",
264 "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7",
265 "R1:0", "R3:2", "R5:4", "R7:6", "P0", "P1", "P2", "P3",
086134ec 266 "P4", "P5", "SP", "FP", "A0.X", "A1.X", "A0.W", "A1.W",
4b7f6baa
CM
267 "A0", "A1", "I0", "I1", "I2", "I3", "M0", "M1",
268 "M2", "M3", "B0", "B1", "B2", "B3", "L0", "L1",
269 "L2", "L3",
270 "AZ", "AN", "AC0", "AC1", "AV0", "AV1", "AV0S", "AV1S",
271 "AQ", "V", "VS",
272 "sftreset", "omode", "excause", "emucause", "idle_req", "hwerrcause", "CC", "LC0",
273 "LC1", "GP", "ASTAT", "RETS", "LT0", "LB0", "LT1", "LB1",
274 "CYCLES", "CYCLES2", "USP", "SEQSTAT", "SYSCFG", "RETI", "RETX", "RETN",
275 "RETE", "EMUDAT",
276 "R0.B", "R1.B", "R2.B", "R3.B", "R4.B", "R5.B", "R6.B", "R7.B",
277 "P0.L", "P1.L", "P2.L", "P3.L", "P4.L", "P5.L", "SP.L", "FP.L",
278 "P0.H", "P1.H", "P2.H", "P3.H", "P4.H", "P5.H", "SP.H", "FP.H",
279 "I0.L", "I1.L", "I2.L", "I3.L", "M0.L", "M1.L", "M2.L", "M3.L",
280 "B0.L", "B1.L", "B2.L", "B3.L", "L0.L", "L1.L", "L2.L", "L3.L",
281 "I0.H", "I1.H", "I2.H", "I3.H", "M0.H", "M1.H", "M2.H", "M3.H",
282 "B0.H", "B1.H", "B2.H", "B3.H", "L0.H", "L1.H", "L2.H", "L3.H",
283 "LASTREG",
284 0
285};
286
287#define REGNAME(x) ((x) < REG_LASTREG ? (reg_names[x]) : "...... Illegal register .......")
288
289/* RL(0..7). */
290static enum machine_registers decode_dregs_lo[] =
291{
292 REG_RL0, REG_RL1, REG_RL2, REG_RL3, REG_RL4, REG_RL5, REG_RL6, REG_RL7,
293};
294
b7d48530 295#define dregs_lo(x) REGNAME (decode_dregs_lo[(x) & 7])
4b7f6baa
CM
296
297/* RH(0..7). */
298static enum machine_registers decode_dregs_hi[] =
299{
300 REG_RH0, REG_RH1, REG_RH2, REG_RH3, REG_RH4, REG_RH5, REG_RH6, REG_RH7,
301};
302
b7d48530 303#define dregs_hi(x) REGNAME (decode_dregs_hi[(x) & 7])
4b7f6baa
CM
304
305/* R(0..7). */
306static enum machine_registers decode_dregs[] =
307{
308 REG_R0, REG_R1, REG_R2, REG_R3, REG_R4, REG_R5, REG_R6, REG_R7,
309};
310
b7d48530 311#define dregs(x) REGNAME (decode_dregs[(x) & 7])
4b7f6baa
CM
312
313/* R BYTE(0..7). */
314static enum machine_registers decode_dregs_byte[] =
315{
316 REG_BR0, REG_BR1, REG_BR2, REG_BR3, REG_BR4, REG_BR5, REG_BR6, REG_BR7,
317};
318
b7d48530
NC
319#define dregs_byte(x) REGNAME (decode_dregs_byte[(x) & 7])
320#define dregs_pair(x) REGNAME (decode_dregs_pair[(x) & 7])
4b7f6baa
CM
321
322/* P(0..5) SP FP. */
323static enum machine_registers decode_pregs[] =
324{
325 REG_P0, REG_P1, REG_P2, REG_P3, REG_P4, REG_P5, REG_SP, REG_FP,
326};
327
b7d48530
NC
328#define pregs(x) REGNAME (decode_pregs[(x) & 7])
329#define spfp(x) REGNAME (decode_spfp[(x) & 1])
330#define dregs_hilo(x,i) REGNAME (decode_dregs_hilo[((i) << 3)|x])
331#define accum_ext(x) REGNAME (decode_accum_ext[(x) & 1])
332#define accum_word(x) REGNAME (decode_accum_word[(x) & 1])
333#define accum(x) REGNAME (decode_accum[(x) & 1])
4b7f6baa
CM
334
335/* I(0..3). */
336static enum machine_registers decode_iregs[] =
337{
338 REG_I0, REG_I1, REG_I2, REG_I3,
339};
340
b7d48530 341#define iregs(x) REGNAME (decode_iregs[(x) & 3])
4b7f6baa
CM
342
343/* M(0..3). */
344static enum machine_registers decode_mregs[] =
345{
346 REG_M0, REG_M1, REG_M2, REG_M3,
347};
348
b7d48530
NC
349#define mregs(x) REGNAME (decode_mregs[(x) & 3])
350#define bregs(x) REGNAME (decode_bregs[(x) & 3])
351#define lregs(x) REGNAME (decode_lregs[(x) & 3])
4b7f6baa
CM
352
353/* dregs pregs. */
354static enum machine_registers decode_dpregs[] =
355{
356 REG_R0, REG_R1, REG_R2, REG_R3, REG_R4, REG_R5, REG_R6, REG_R7,
357 REG_P0, REG_P1, REG_P2, REG_P3, REG_P4, REG_P5, REG_SP, REG_FP,
358};
359
b7d48530 360#define dpregs(x) REGNAME (decode_dpregs[(x) & 15])
4b7f6baa
CM
361
362/* [dregs pregs]. */
363static enum machine_registers decode_gregs[] =
364{
365 REG_R0, REG_R1, REG_R2, REG_R3, REG_R4, REG_R5, REG_R6, REG_R7,
366 REG_P0, REG_P1, REG_P2, REG_P3, REG_P4, REG_P5, REG_SP, REG_FP,
367};
368
b7d48530 369#define gregs(x,i) REGNAME (decode_gregs[((i) << 3)|x])
4b7f6baa
CM
370
371/* [dregs pregs (iregs mregs) (bregs lregs)]. */
372static enum machine_registers decode_regs[] =
373{
374 REG_R0, REG_R1, REG_R2, REG_R3, REG_R4, REG_R5, REG_R6, REG_R7,
375 REG_P0, REG_P1, REG_P2, REG_P3, REG_P4, REG_P5, REG_SP, REG_FP,
376 REG_I0, REG_I1, REG_I2, REG_I3, REG_M0, REG_M1, REG_M2, REG_M3,
377 REG_B0, REG_B1, REG_B2, REG_B3, REG_L0, REG_L1, REG_L2, REG_L3,
378};
379
b7d48530 380#define regs(x,i) REGNAME (decode_regs[((i) << 3)|x])
4b7f6baa
CM
381
382/* [dregs pregs (iregs mregs) (bregs lregs) Low Half]. */
383static enum machine_registers decode_regs_lo[] =
384{
385 REG_RL0, REG_RL1, REG_RL2, REG_RL3, REG_RL4, REG_RL5, REG_RL6, REG_RL7,
386 REG_PL0, REG_PL1, REG_PL2, REG_PL3, REG_PL4, REG_PL5, REG_SLP, REG_FLP,
387 REG_IL0, REG_IL1, REG_IL2, REG_IL3, REG_ML0, REG_ML1, REG_ML2, REG_ML3,
388 REG_BL0, REG_BL1, REG_BL2, REG_BL3, REG_LL0, REG_LL1, REG_LL2, REG_LL3,
389};
390
b7d48530 391#define regs_lo(x,i) REGNAME (decode_regs_lo[((i) << 3)|x])
4b7f6baa
CM
392/* [dregs pregs (iregs mregs) (bregs lregs) High Half]. */
393static enum machine_registers decode_regs_hi[] =
394{
395 REG_RH0, REG_RH1, REG_RH2, REG_RH3, REG_RH4, REG_RH5, REG_RH6, REG_RH7,
396 REG_PH0, REG_PH1, REG_PH2, REG_PH3, REG_PH4, REG_PH5, REG_SHP, REG_FHP,
397 REG_IH0, REG_IH1, REG_IH2, REG_IH3, REG_MH0, REG_MH1, REG_LH2, REG_MH3,
398 REG_BH0, REG_BH1, REG_BH2, REG_BH3, REG_LH0, REG_LH1, REG_LH2, REG_LH3,
399};
400
b7d48530 401#define regs_hi(x,i) REGNAME (decode_regs_hi[((i) << 3)|x])
4b7f6baa
CM
402
403static enum machine_registers decode_statbits[] =
404{
405 REG_AZ, REG_AN, REG_LASTREG, REG_LASTREG, REG_LASTREG, REG_LASTREG, REG_AQ, REG_LASTREG,
406 REG_LASTREG, REG_LASTREG, REG_LASTREG, REG_LASTREG, REG_AC0, REG_AC1, REG_LASTREG, REG_LASTREG,
407 REG_AV0, REG_AV0S, REG_AV1, REG_AV1S, REG_LASTREG, REG_LASTREG, REG_LASTREG, REG_LASTREG,
408 REG_V, REG_VS, REG_LASTREG, REG_LASTREG, REG_LASTREG, REG_LASTREG, REG_LASTREG, REG_LASTREG,
409};
410
b7d48530
NC
411#define statbits(x) REGNAME (decode_statbits[(x) & 31])
412#define ignore_bits(x) REGNAME (decode_ignore_bits[(x) & 7])
413#define ccstat(x) REGNAME (decode_ccstat[(x) & 0])
4b7f6baa
CM
414
415/* LC0 LC1. */
416static enum machine_registers decode_counters[] =
417{
418 REG_LC0, REG_LC1,
419};
420
b7d48530
NC
421#define counters(x) REGNAME (decode_counters[(x) & 1])
422#define dregs2_sysregs1(x) REGNAME (decode_dregs2_sysregs1[(x) & 7])
4b7f6baa
CM
423
424/* [dregs pregs (iregs mregs) (bregs lregs)
425 dregs2_sysregs1 open sysregs2 sysregs3]. */
426static enum machine_registers decode_allregs[] =
427{
428 REG_R0, REG_R1, REG_R2, REG_R3, REG_R4, REG_R5, REG_R6, REG_R7,
429 REG_P0, REG_P1, REG_P2, REG_P3, REG_P4, REG_P5, REG_SP, REG_FP,
430 REG_I0, REG_I1, REG_I2, REG_I3, REG_M0, REG_M1, REG_M2, REG_M3,
431 REG_B0, REG_B1, REG_B2, REG_B3, REG_L0, REG_L1, REG_L2, REG_L3,
432 REG_A0x, REG_A0w, REG_A1x, REG_A1w, REG_GP, REG_LASTREG, REG_ASTAT, REG_RETS,
433 REG_LASTREG, REG_LASTREG, REG_LASTREG, REG_LASTREG, REG_LASTREG, REG_LASTREG, REG_LASTREG, REG_LASTREG,
434 REG_LC0, REG_LT0, REG_LB0, REG_LC1, REG_LT1, REG_LB1, REG_CYCLES, REG_CYCLES2,
c958a8a8
JZ
435 REG_USP, REG_SEQSTAT, REG_SYSCFG, REG_RETI, REG_RETX, REG_RETN, REG_RETE, REG_EMUDAT,
436 REG_LASTREG,
4b7f6baa
CM
437};
438
c958a8a8
JZ
439#define IS_DREG(g,r) ((g) == 0)
440#define IS_PREG(g,r) ((g) == 1)
441#define IS_AREG(g,r) ((g) == 4 && (r) >= 0 && (r) < 4)
442#define IS_GENREG(g,r) ((g) == 0 || (g) == 1 || IS_AREG (g, r))
443#define IS_DAGREG(g,r) ((g) == 2 || (g) == 3)
444#define IS_SYSREG(g,r) \
445 (((g) == 4 && ((r) == 6 || (r) == 7)) || (g) == 6 || (g) == 7)
446
b7d48530
NC
447#define allregs(x,i) REGNAME (decode_allregs[((i) << 3) | x])
448#define uimm16s4(x) fmtconst (c_uimm16s4, x, 0, outf)
086134ec 449#define uimm16s4d(x) fmtconst (c_uimm16s4d, x, 0, outf)
b7d48530
NC
450#define pcrel4(x) fmtconst (c_pcrel4, x, pc, outf)
451#define pcrel8(x) fmtconst (c_pcrel8, x, pc, outf)
452#define pcrel8s4(x) fmtconst (c_pcrel8s4, x, pc, outf)
453#define pcrel10(x) fmtconst (c_pcrel10, x, pc, outf)
454#define pcrel12(x) fmtconst (c_pcrel12, x, pc, outf)
455#define negimm5s4(x) fmtconst (c_negimm5s4, x, 0, outf)
456#define rimm16(x) fmtconst (c_rimm16, x, 0, outf)
457#define huimm16(x) fmtconst (c_huimm16, x, 0, outf)
458#define imm16(x) fmtconst (c_imm16, x, 0, outf)
086134ec 459#define imm16d(x) fmtconst (c_imm16d, x, 0, outf)
b7d48530
NC
460#define uimm2(x) fmtconst (c_uimm2, x, 0, outf)
461#define uimm3(x) fmtconst (c_uimm3, x, 0, outf)
462#define luimm16(x) fmtconst (c_luimm16, x, 0, outf)
463#define uimm4(x) fmtconst (c_uimm4, x, 0, outf)
464#define uimm5(x) fmtconst (c_uimm5, x, 0, outf)
465#define imm16s2(x) fmtconst (c_imm16s2, x, 0, outf)
466#define uimm8(x) fmtconst (c_uimm8, x, 0, outf)
467#define imm16s4(x) fmtconst (c_imm16s4, x, 0, outf)
468#define uimm4s2(x) fmtconst (c_uimm4s2, x, 0, outf)
469#define uimm4s4(x) fmtconst (c_uimm4s4, x, 0, outf)
086134ec 470#define uimm4s4d(x) fmtconst (c_uimm4s4d, x, 0, outf)
b7d48530
NC
471#define lppcrel10(x) fmtconst (c_lppcrel10, x, pc, outf)
472#define imm3(x) fmtconst (c_imm3, x, 0, outf)
473#define imm4(x) fmtconst (c_imm4, x, 0, outf)
474#define uimm8s4(x) fmtconst (c_uimm8s4, x, 0, outf)
475#define imm5(x) fmtconst (c_imm5, x, 0, outf)
086134ec 476#define imm5d(x) fmtconst (c_imm5d, x, 0, outf)
b7d48530
NC
477#define imm6(x) fmtconst (c_imm6, x, 0, outf)
478#define imm7(x) fmtconst (c_imm7, x, 0, outf)
086134ec 479#define imm7d(x) fmtconst (c_imm7d, x, 0, outf)
b7d48530
NC
480#define imm8(x) fmtconst (c_imm8, x, 0, outf)
481#define pcrel24(x) fmtconst (c_pcrel24, x, pc, outf)
482#define uimm16(x) fmtconst (c_uimm16, x, 0, outf)
b21c9cb4 483#define uimm32(x) fmtconst (c_uimm32, x, 0, outf)
086134ec 484#define imm32(x) fmtconst (c_imm32, x, 0, outf)
b21c9cb4 485#define huimm32(x) fmtconst (c_huimm32, x, 0, outf)
086134ec
BS
486#define huimm32e(x) fmtconst (c_huimm32e, x, 0, outf)
487#define imm7_val(x) fmtconst_val (c_imm7, x, 0)
b21c9cb4
BS
488#define imm16_val(x) fmtconst_val (c_uimm16, x, 0)
489#define luimm16_val(x) fmtconst_val (c_luimm16, x, 0)
4b7f6baa
CM
490
491/* (arch.pm)arch_disassembler_functions. */
4b7f6baa 492#ifndef OUTS
4ca47a51 493#define OUTS(p, txt) ((p) ? (((txt)[0]) ? (p->fprintf_func)(p->stream, "%s", txt) :0) :0)
4b7f6baa
CM
494#endif
495
4b7f6baa
CM
496static void
497amod0 (int s0, int x0, disassemble_info *outf)
498{
b7d48530 499 if (s0 == 1 && x0 == 0)
086134ec 500 OUTS (outf, " (S)");
4b7f6baa 501 else if (s0 == 0 && x0 == 1)
086134ec 502 OUTS (outf, " (CO)");
4b7f6baa 503 else if (s0 == 1 && x0 == 1)
086134ec 504 OUTS (outf, " (SCO)");
4b7f6baa
CM
505}
506
507static void
508amod1 (int s0, int x0, disassemble_info *outf)
509{
510 if (s0 == 0 && x0 == 0)
086134ec 511 OUTS (outf, " (NS)");
4b7f6baa 512 else if (s0 == 1 && x0 == 0)
086134ec 513 OUTS (outf, " (S)");
4b7f6baa
CM
514}
515
516static void
517amod0amod2 (int s0, int x0, int aop0, disassemble_info *outf)
518{
b7d48530 519 if (s0 == 1 && x0 == 0 && aop0 == 0)
086134ec 520 OUTS (outf, " (S)");
4b7f6baa 521 else if (s0 == 0 && x0 == 1 && aop0 == 0)
086134ec 522 OUTS (outf, " (CO)");
4b7f6baa 523 else if (s0 == 1 && x0 == 1 && aop0 == 0)
086134ec 524 OUTS (outf, " (SCO)");
4b7f6baa 525 else if (s0 == 0 && x0 == 0 && aop0 == 2)
086134ec 526 OUTS (outf, " (ASR)");
4b7f6baa 527 else if (s0 == 1 && x0 == 0 && aop0 == 2)
086134ec 528 OUTS (outf, " (S, ASR)");
4b7f6baa 529 else if (s0 == 0 && x0 == 1 && aop0 == 2)
086134ec 530 OUTS (outf, " (CO, ASR)");
4b7f6baa 531 else if (s0 == 1 && x0 == 1 && aop0 == 2)
086134ec 532 OUTS (outf, " (SCO, ASR)");
4b7f6baa 533 else if (s0 == 0 && x0 == 0 && aop0 == 3)
086134ec 534 OUTS (outf, " (ASL)");
4b7f6baa 535 else if (s0 == 1 && x0 == 0 && aop0 == 3)
086134ec 536 OUTS (outf, " (S, ASL)");
4b7f6baa 537 else if (s0 == 0 && x0 == 1 && aop0 == 3)
086134ec 538 OUTS (outf, " (CO, ASL)");
4b7f6baa 539 else if (s0 == 1 && x0 == 1 && aop0 == 3)
086134ec 540 OUTS (outf, " (SCO, ASL)");
4b7f6baa
CM
541}
542
543static void
544searchmod (int r0, disassemble_info *outf)
545{
b7d48530
NC
546 if (r0 == 0)
547 OUTS (outf, "GT");
548 else if (r0 == 1)
549 OUTS (outf, "GE");
550 else if (r0 == 2)
551 OUTS (outf, "LT");
552 else if (r0 == 3)
553 OUTS (outf, "LE");
4b7f6baa
CM
554}
555
556static void
557aligndir (int r0, disassemble_info *outf)
558{
b7d48530 559 if (r0 == 1)
086134ec 560 OUTS (outf, " (R)");
4b7f6baa
CM
561}
562
563static int
564decode_multfunc (int h0, int h1, int src0, int src1, disassemble_info * outf)
565{
566 char *s0, *s1;
567
568 if (h0)
569 s0 = dregs_hi (src0);
570 else
571 s0 = dregs_lo (src0);
572
573 if (h1)
574 s1 = dregs_hi (src1);
575 else
576 s1 = dregs_lo (src1);
577
578 OUTS (outf, s0);
579 OUTS (outf, " * ");
580 OUTS (outf, s1);
581 return 0;
582}
583
584static int
585decode_macfunc (int which, int op, int h0, int h1, int src0, int src1, disassemble_info * outf)
586{
587 char *a;
588 char *sop = "<unknown op>";
589
590 if (which)
086134ec 591 a = "A1";
4b7f6baa 592 else
086134ec 593 a = "A0";
4b7f6baa
CM
594
595 if (op == 3)
596 {
597 OUTS (outf, a);
598 return 0;
599 }
600
601 switch (op)
602 {
086134ec
BS
603 case 0: sop = " = "; break;
604 case 1: sop = " += "; break;
605 case 2: sop = " -= "; break;
b7d48530 606 default: break;
4b7f6baa
CM
607 }
608
609 OUTS (outf, a);
4b7f6baa 610 OUTS (outf, sop);
4b7f6baa
CM
611 decode_multfunc (h0, h1, src0, src1, outf);
612
613 return 0;
614}
615
616static void
617decode_optmode (int mod, int MM, disassemble_info *outf)
618{
619 if (mod == 0 && MM == 0)
620 return;
621
622 OUTS (outf, " (");
623
624 if (MM && !mod)
625 {
626 OUTS (outf, "M)");
627 return;
628 }
629
630 if (MM)
631 OUTS (outf, "M, ");
b7d48530 632
4b7f6baa
CM
633 if (mod == M_S2RND)
634 OUTS (outf, "S2RND");
635 else if (mod == M_T)
636 OUTS (outf, "T");
637 else if (mod == M_W32)
638 OUTS (outf, "W32");
639 else if (mod == M_FU)
640 OUTS (outf, "FU");
641 else if (mod == M_TFU)
642 OUTS (outf, "TFU");
643 else if (mod == M_IS)
644 OUTS (outf, "IS");
645 else if (mod == M_ISS2)
646 OUTS (outf, "ISS2");
647 else if (mod == M_IH)
648 OUTS (outf, "IH");
649 else if (mod == M_IU)
650 OUTS (outf, "IU");
651 else
652 abort ();
653
654 OUTS (outf, ")");
655}
b7d48530 656
b21c9cb4
BS
657struct saved_state
658{
659 bu32 dpregs[16], iregs[4], mregs[4], bregs[4], lregs[4];
660 bu32 a0x, a0w, a1x, a1w;
661 bu32 lt[2], lc[2], lb[2];
662 int ac0, ac0_copy, ac1, an, aq;
663 int av0, av0s, av1, av1s, az, cc, v, v_copy, vs;
664 int rnd_mod;
665 int v_internal;
666 bu32 pc, rets;
667
668 int ticks;
669 int insts;
670
671 int exception;
672
673 int end_of_registers;
674
675 int msize;
676 unsigned char *memory;
677 unsigned long bfd_mach;
678} saved_state;
679
680#define DREG(x) (saved_state.dpregs[x])
681#define GREG(x,i) DPREG ((x) | (i << 3))
682#define DPREG(x) (saved_state.dpregs[x])
683#define DREG(x) (saved_state.dpregs[x])
684#define PREG(x) (saved_state.dpregs[x + 8])
685#define SPREG PREG (6)
686#define FPREG PREG (7)
687#define IREG(x) (saved_state.iregs[x])
688#define MREG(x) (saved_state.mregs[x])
689#define BREG(x) (saved_state.bregs[x])
690#define LREG(x) (saved_state.lregs[x])
691#define A0XREG (saved_state.a0x)
692#define A0WREG (saved_state.a0w)
693#define A1XREG (saved_state.a1x)
694#define A1WREG (saved_state.a1w)
695#define CCREG (saved_state.cc)
696#define LC0REG (saved_state.lc[0])
697#define LT0REG (saved_state.lt[0])
698#define LB0REG (saved_state.lb[0])
699#define LC1REG (saved_state.lc[1])
700#define LT1REG (saved_state.lt[1])
701#define LB1REG (saved_state.lb[1])
702#define RETSREG (saved_state.rets)
703#define PCREG (saved_state.pc)
704
705static bu32 *
706get_allreg (int grp, int reg)
707{
708 int fullreg = (grp << 3) | reg;
709 /* REG_R0, REG_R1, REG_R2, REG_R3, REG_R4, REG_R5, REG_R6, REG_R7,
710 REG_P0, REG_P1, REG_P2, REG_P3, REG_P4, REG_P5, REG_SP, REG_FP,
711 REG_I0, REG_I1, REG_I2, REG_I3, REG_M0, REG_M1, REG_M2, REG_M3,
712 REG_B0, REG_B1, REG_B2, REG_B3, REG_L0, REG_L1, REG_L2, REG_L3,
713 REG_A0x, REG_A0w, REG_A1x, REG_A1w, , , REG_ASTAT, REG_RETS,
714 , , , , , , , ,
715 REG_LC0, REG_LT0, REG_LB0, REG_LC1, REG_LT1, REG_LB1, REG_CYCLES,
716 REG_CYCLES2,
717 REG_USP, REG_SEQSTAT, REG_SYSCFG, REG_RETI, REG_RETX, REG_RETN, REG_RETE,
718 REG_LASTREG */
719 switch (fullreg >> 2)
720 {
721 case 0: case 1: return &DREG (reg); break;
722 case 2: case 3: return &PREG (reg); break;
723 case 4: return &IREG (reg & 3); break;
724 case 5: return &MREG (reg & 3); break;
725 case 6: return &BREG (reg & 3); break;
726 case 7: return &LREG (reg & 3); break;
727 default:
728 switch (fullreg)
086134ec
BS
729 {
730 case 32: return &saved_state.a0x;
731 case 33: return &saved_state.a0w;
732 case 34: return &saved_state.a1x;
733 case 35: return &saved_state.a1w;
734 case 39: return &saved_state.rets;
735 case 48: return &LC0REG;
736 case 49: return &LT0REG;
737 case 50: return &LB0REG;
738 case 51: return &LC1REG;
739 case 52: return &LT1REG;
740 case 53: return &LB1REG;
741 }
b21c9cb4
BS
742 return 0;
743 }
744}
745
4b7f6baa
CM
746static int
747decode_ProgCtrl_0 (TIword iw0, disassemble_info *outf)
748{
b7d48530
NC
749 /* ProgCtrl
750 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
751 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |.prgfunc.......|.poprnd........|
752 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
753 int poprnd = ((iw0 >> ProgCtrl_poprnd_bits) & ProgCtrl_poprnd_mask);
754 int prgfunc = ((iw0 >> ProgCtrl_prgfunc_bits) & ProgCtrl_prgfunc_mask);
755
756 if (prgfunc == 0 && poprnd == 0)
b7d48530 757 OUTS (outf, "NOP");
4b7f6baa 758 else if (prgfunc == 1 && poprnd == 0)
b7d48530 759 OUTS (outf, "RTS");
4b7f6baa 760 else if (prgfunc == 1 && poprnd == 1)
b7d48530 761 OUTS (outf, "RTI");
4b7f6baa 762 else if (prgfunc == 1 && poprnd == 2)
b7d48530 763 OUTS (outf, "RTX");
4b7f6baa 764 else if (prgfunc == 1 && poprnd == 3)
b7d48530 765 OUTS (outf, "RTN");
4b7f6baa 766 else if (prgfunc == 1 && poprnd == 4)
b7d48530 767 OUTS (outf, "RTE");
4b7f6baa 768 else if (prgfunc == 2 && poprnd == 0)
b7d48530 769 OUTS (outf, "IDLE");
4b7f6baa 770 else if (prgfunc == 2 && poprnd == 3)
b7d48530 771 OUTS (outf, "CSYNC");
4b7f6baa 772 else if (prgfunc == 2 && poprnd == 4)
b7d48530 773 OUTS (outf, "SSYNC");
4b7f6baa 774 else if (prgfunc == 2 && poprnd == 5)
b7d48530 775 OUTS (outf, "EMUEXCPT");
4b7f6baa
CM
776 else if (prgfunc == 3)
777 {
086134ec 778 OUTS (outf, "CLI ");
4b7f6baa 779 OUTS (outf, dregs (poprnd));
4b7f6baa
CM
780 }
781 else if (prgfunc == 4)
782 {
086134ec 783 OUTS (outf, "STI ");
4b7f6baa 784 OUTS (outf, dregs (poprnd));
4b7f6baa
CM
785 }
786 else if (prgfunc == 5)
787 {
086134ec 788 OUTS (outf, "JUMP (");
4b7f6baa
CM
789 OUTS (outf, pregs (poprnd));
790 OUTS (outf, ")");
4b7f6baa
CM
791 }
792 else if (prgfunc == 6)
793 {
086134ec 794 OUTS (outf, "CALL (");
4b7f6baa
CM
795 OUTS (outf, pregs (poprnd));
796 OUTS (outf, ")");
4b7f6baa
CM
797 }
798 else if (prgfunc == 7)
799 {
086134ec 800 OUTS (outf, "CALL (PC + ");
4b7f6baa
CM
801 OUTS (outf, pregs (poprnd));
802 OUTS (outf, ")");
4b7f6baa
CM
803 }
804 else if (prgfunc == 8)
805 {
086134ec 806 OUTS (outf, "JUMP (PC + ");
4b7f6baa
CM
807 OUTS (outf, pregs (poprnd));
808 OUTS (outf, ")");
4b7f6baa
CM
809 }
810 else if (prgfunc == 9)
811 {
086134ec 812 OUTS (outf, "RAISE ");
4b7f6baa 813 OUTS (outf, uimm4 (poprnd));
4b7f6baa
CM
814 }
815 else if (prgfunc == 10)
816 {
086134ec 817 OUTS (outf, "EXCPT ");
4b7f6baa 818 OUTS (outf, uimm4 (poprnd));
4b7f6baa
CM
819 }
820 else if (prgfunc == 11)
821 {
086134ec 822 OUTS (outf, "TESTSET (");
4b7f6baa
CM
823 OUTS (outf, pregs (poprnd));
824 OUTS (outf, ")");
4b7f6baa
CM
825 }
826 else
b7d48530
NC
827 return 0;
828 return 2;
4b7f6baa
CM
829}
830
831static int
832decode_CaCTRL_0 (TIword iw0, disassemble_info *outf)
833{
b7d48530
NC
834 /* CaCTRL
835 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
836 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 |.a.|.op....|.reg.......|
837 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
838 int a = ((iw0 >> CaCTRL_a_bits) & CaCTRL_a_mask);
839 int op = ((iw0 >> CaCTRL_op_bits) & CaCTRL_op_mask);
840 int reg = ((iw0 >> CaCTRL_reg_bits) & CaCTRL_reg_mask);
841
842 if (a == 0 && op == 0)
843 {
4b7f6baa
CM
844 OUTS (outf, "PREFETCH[");
845 OUTS (outf, pregs (reg));
846 OUTS (outf, "]");
4b7f6baa
CM
847 }
848 else if (a == 0 && op == 1)
849 {
4b7f6baa
CM
850 OUTS (outf, "FLUSHINV[");
851 OUTS (outf, pregs (reg));
852 OUTS (outf, "]");
4b7f6baa
CM
853 }
854 else if (a == 0 && op == 2)
855 {
4b7f6baa
CM
856 OUTS (outf, "FLUSH[");
857 OUTS (outf, pregs (reg));
858 OUTS (outf, "]");
4b7f6baa
CM
859 }
860 else if (a == 0 && op == 3)
861 {
4b7f6baa
CM
862 OUTS (outf, "IFLUSH[");
863 OUTS (outf, pregs (reg));
864 OUTS (outf, "]");
4b7f6baa
CM
865 }
866 else if (a == 1 && op == 0)
867 {
4b7f6baa
CM
868 OUTS (outf, "PREFETCH[");
869 OUTS (outf, pregs (reg));
870 OUTS (outf, "++]");
4b7f6baa
CM
871 }
872 else if (a == 1 && op == 1)
873 {
4b7f6baa
CM
874 OUTS (outf, "FLUSHINV[");
875 OUTS (outf, pregs (reg));
876 OUTS (outf, "++]");
4b7f6baa
CM
877 }
878 else if (a == 1 && op == 2)
879 {
4b7f6baa
CM
880 OUTS (outf, "FLUSH[");
881 OUTS (outf, pregs (reg));
882 OUTS (outf, "++]");
4b7f6baa
CM
883 }
884 else if (a == 1 && op == 3)
885 {
4b7f6baa
CM
886 OUTS (outf, "IFLUSH[");
887 OUTS (outf, pregs (reg));
888 OUTS (outf, "++]");
4b7f6baa
CM
889 }
890 else
b7d48530
NC
891 return 0;
892 return 2;
4b7f6baa
CM
893}
894
895static int
896decode_PushPopReg_0 (TIword iw0, disassemble_info *outf)
897{
b7d48530
NC
898 /* PushPopReg
899 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
900 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |.W.|.grp.......|.reg.......|
901 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
902 int W = ((iw0 >> PushPopReg_W_bits) & PushPopReg_W_mask);
903 int grp = ((iw0 >> PushPopReg_grp_bits) & PushPopReg_grp_mask);
904 int reg = ((iw0 >> PushPopReg_reg_bits) & PushPopReg_reg_mask);
905
906 if (W == 0)
907 {
4b7f6baa
CM
908 OUTS (outf, allregs (reg, grp));
909 OUTS (outf, " = [SP++]");
4b7f6baa
CM
910 }
911 else if (W == 1)
912 {
4b7f6baa
CM
913 OUTS (outf, "[--SP] = ");
914 OUTS (outf, allregs (reg, grp));
4b7f6baa
CM
915 }
916 else
b7d48530
NC
917 return 0;
918 return 2;
4b7f6baa
CM
919}
920
921static int
922decode_PushPopMultiple_0 (TIword iw0, disassemble_info *outf)
923{
b7d48530
NC
924 /* PushPopMultiple
925 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
926 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |.d.|.p.|.W.|.dr........|.pr........|
927 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
928 int p = ((iw0 >> PushPopMultiple_p_bits) & PushPopMultiple_p_mask);
929 int d = ((iw0 >> PushPopMultiple_d_bits) & PushPopMultiple_d_mask);
930 int W = ((iw0 >> PushPopMultiple_W_bits) & PushPopMultiple_W_mask);
931 int dr = ((iw0 >> PushPopMultiple_dr_bits) & PushPopMultiple_dr_mask);
932 int pr = ((iw0 >> PushPopMultiple_pr_bits) & PushPopMultiple_pr_mask);
4b7f6baa
CM
933
934 if (W == 1 && d == 1 && p == 1)
935 {
4b7f6baa 936 OUTS (outf, "[--SP] = (R7:");
086134ec 937 OUTS (outf, imm5d (dr));
4b7f6baa 938 OUTS (outf, ", P5:");
086134ec 939 OUTS (outf, imm5d (pr));
4b7f6baa 940 OUTS (outf, ")");
4b7f6baa
CM
941 }
942 else if (W == 1 && d == 1 && p == 0)
943 {
4b7f6baa 944 OUTS (outf, "[--SP] = (R7:");
086134ec 945 OUTS (outf, imm5d (dr));
4b7f6baa 946 OUTS (outf, ")");
4b7f6baa
CM
947 }
948 else if (W == 1 && d == 0 && p == 1)
949 {
4b7f6baa 950 OUTS (outf, "[--SP] = (P5:");
086134ec 951 OUTS (outf, imm5d (pr));
4b7f6baa 952 OUTS (outf, ")");
4b7f6baa
CM
953 }
954 else if (W == 0 && d == 1 && p == 1)
955 {
4b7f6baa 956 OUTS (outf, "(R7:");
086134ec 957 OUTS (outf, imm5d (dr));
4b7f6baa 958 OUTS (outf, ", P5:");
086134ec 959 OUTS (outf, imm5d (pr));
4b7f6baa 960 OUTS (outf, ") = [SP++]");
4b7f6baa
CM
961 }
962 else if (W == 0 && d == 1 && p == 0)
963 {
4b7f6baa 964 OUTS (outf, "(R7:");
086134ec 965 OUTS (outf, imm5d (dr));
4b7f6baa 966 OUTS (outf, ") = [SP++]");
4b7f6baa
CM
967 }
968 else if (W == 0 && d == 0 && p == 1)
969 {
4b7f6baa 970 OUTS (outf, "(P5:");
086134ec 971 OUTS (outf, imm5d (pr));
4b7f6baa 972 OUTS (outf, ") = [SP++]");
4b7f6baa
CM
973 }
974 else
b7d48530
NC
975 return 0;
976 return 2;
4b7f6baa
CM
977}
978
979static int
980decode_ccMV_0 (TIword iw0, disassemble_info *outf)
981{
b7d48530
NC
982 /* ccMV
983 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
984 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |.T.|.d.|.s.|.dst.......|.src.......|
985 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
986 int s = ((iw0 >> CCmv_s_bits) & CCmv_s_mask);
987 int d = ((iw0 >> CCmv_d_bits) & CCmv_d_mask);
988 int T = ((iw0 >> CCmv_T_bits) & CCmv_T_mask);
989 int src = ((iw0 >> CCmv_src_bits) & CCmv_src_mask);
990 int dst = ((iw0 >> CCmv_dst_bits) & CCmv_dst_mask);
991
992 if (T == 1)
993 {
4b7f6baa
CM
994 OUTS (outf, "IF CC ");
995 OUTS (outf, gregs (dst, d));
996 OUTS (outf, " = ");
997 OUTS (outf, gregs (src, s));
4b7f6baa
CM
998 }
999 else if (T == 0)
1000 {
086134ec 1001 OUTS (outf, "IF !CC ");
4b7f6baa
CM
1002 OUTS (outf, gregs (dst, d));
1003 OUTS (outf, " = ");
1004 OUTS (outf, gregs (src, s));
4b7f6baa
CM
1005 }
1006 else
b7d48530
NC
1007 return 0;
1008 return 2;
4b7f6baa
CM
1009}
1010
1011static int
1012decode_CCflag_0 (TIword iw0, disassemble_info *outf)
1013{
b7d48530
NC
1014 /* CCflag
1015 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1016 | 0 | 0 | 0 | 0 | 1 |.I.|.opc.......|.G.|.y.........|.x.........|
1017 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
1018 int x = ((iw0 >> CCflag_x_bits) & CCflag_x_mask);
1019 int y = ((iw0 >> CCflag_y_bits) & CCflag_y_mask);
1020 int I = ((iw0 >> CCflag_I_bits) & CCflag_I_mask);
1021 int G = ((iw0 >> CCflag_G_bits) & CCflag_G_mask);
1022 int opc = ((iw0 >> CCflag_opc_bits) & CCflag_opc_mask);
1023
1024 if (opc == 0 && I == 0 && G == 0)
1025 {
086134ec 1026 OUTS (outf, "CC = ");
4b7f6baa 1027 OUTS (outf, dregs (x));
086134ec 1028 OUTS (outf, " == ");
4b7f6baa 1029 OUTS (outf, dregs (y));
4b7f6baa
CM
1030 }
1031 else if (opc == 1 && I == 0 && G == 0)
1032 {
086134ec 1033 OUTS (outf, "CC = ");
4b7f6baa 1034 OUTS (outf, dregs (x));
086134ec 1035 OUTS (outf, " < ");
4b7f6baa 1036 OUTS (outf, dregs (y));
4b7f6baa
CM
1037 }
1038 else if (opc == 2 && I == 0 && G == 0)
1039 {
086134ec 1040 OUTS (outf, "CC = ");
4b7f6baa 1041 OUTS (outf, dregs (x));
086134ec 1042 OUTS (outf, " <= ");
4b7f6baa 1043 OUTS (outf, dregs (y));
4b7f6baa
CM
1044 }
1045 else if (opc == 3 && I == 0 && G == 0)
1046 {
086134ec 1047 OUTS (outf, "CC = ");
4b7f6baa 1048 OUTS (outf, dregs (x));
086134ec 1049 OUTS (outf, " < ");
4b7f6baa 1050 OUTS (outf, dregs (y));
086134ec 1051 OUTS (outf, " (IU)");
4b7f6baa
CM
1052 }
1053 else if (opc == 4 && I == 0 && G == 0)
1054 {
086134ec 1055 OUTS (outf, "CC = ");
4b7f6baa 1056 OUTS (outf, dregs (x));
086134ec 1057 OUTS (outf, " <= ");
4b7f6baa 1058 OUTS (outf, dregs (y));
086134ec 1059 OUTS (outf, " (IU)");
4b7f6baa
CM
1060 }
1061 else if (opc == 0 && I == 1 && G == 0)
1062 {
086134ec 1063 OUTS (outf, "CC = ");
4b7f6baa 1064 OUTS (outf, dregs (x));
086134ec 1065 OUTS (outf, " == ");
4b7f6baa 1066 OUTS (outf, imm3 (y));
4b7f6baa
CM
1067 }
1068 else if (opc == 1 && I == 1 && G == 0)
1069 {
086134ec 1070 OUTS (outf, "CC = ");
4b7f6baa 1071 OUTS (outf, dregs (x));
086134ec 1072 OUTS (outf, " < ");
4b7f6baa 1073 OUTS (outf, imm3 (y));
4b7f6baa
CM
1074 }
1075 else if (opc == 2 && I == 1 && G == 0)
1076 {
086134ec 1077 OUTS (outf, "CC = ");
4b7f6baa 1078 OUTS (outf, dregs (x));
086134ec 1079 OUTS (outf, " <= ");
4b7f6baa 1080 OUTS (outf, imm3 (y));
4b7f6baa
CM
1081 }
1082 else if (opc == 3 && I == 1 && G == 0)
1083 {
086134ec 1084 OUTS (outf, "CC = ");
4b7f6baa 1085 OUTS (outf, dregs (x));
086134ec 1086 OUTS (outf, " < ");
4b7f6baa 1087 OUTS (outf, uimm3 (y));
086134ec 1088 OUTS (outf, " (IU)");
4b7f6baa
CM
1089 }
1090 else if (opc == 4 && I == 1 && G == 0)
1091 {
086134ec 1092 OUTS (outf, "CC = ");
4b7f6baa 1093 OUTS (outf, dregs (x));
086134ec 1094 OUTS (outf, " <= ");
4b7f6baa 1095 OUTS (outf, uimm3 (y));
086134ec 1096 OUTS (outf, " (IU)");
4b7f6baa
CM
1097 }
1098 else if (opc == 0 && I == 0 && G == 1)
1099 {
086134ec 1100 OUTS (outf, "CC = ");
4b7f6baa 1101 OUTS (outf, pregs (x));
086134ec 1102 OUTS (outf, " == ");
4b7f6baa 1103 OUTS (outf, pregs (y));
4b7f6baa
CM
1104 }
1105 else if (opc == 1 && I == 0 && G == 1)
1106 {
086134ec 1107 OUTS (outf, "CC = ");
4b7f6baa 1108 OUTS (outf, pregs (x));
086134ec 1109 OUTS (outf, " < ");
4b7f6baa 1110 OUTS (outf, pregs (y));
4b7f6baa
CM
1111 }
1112 else if (opc == 2 && I == 0 && G == 1)
1113 {
086134ec 1114 OUTS (outf, "CC = ");
4b7f6baa 1115 OUTS (outf, pregs (x));
086134ec 1116 OUTS (outf, " <= ");
4b7f6baa 1117 OUTS (outf, pregs (y));
4b7f6baa
CM
1118 }
1119 else if (opc == 3 && I == 0 && G == 1)
1120 {
086134ec 1121 OUTS (outf, "CC = ");
4b7f6baa 1122 OUTS (outf, pregs (x));
086134ec 1123 OUTS (outf, " < ");
4b7f6baa 1124 OUTS (outf, pregs (y));
086134ec 1125 OUTS (outf, " (IU)");
4b7f6baa
CM
1126 }
1127 else if (opc == 4 && I == 0 && G == 1)
1128 {
086134ec 1129 OUTS (outf, "CC = ");
4b7f6baa 1130 OUTS (outf, pregs (x));
086134ec 1131 OUTS (outf, " <= ");
4b7f6baa 1132 OUTS (outf, pregs (y));
086134ec 1133 OUTS (outf, " (IU)");
4b7f6baa
CM
1134 }
1135 else if (opc == 0 && I == 1 && G == 1)
1136 {
086134ec 1137 OUTS (outf, "CC = ");
4b7f6baa 1138 OUTS (outf, pregs (x));
086134ec 1139 OUTS (outf, " == ");
4b7f6baa 1140 OUTS (outf, imm3 (y));
4b7f6baa
CM
1141 }
1142 else if (opc == 1 && I == 1 && G == 1)
1143 {
086134ec 1144 OUTS (outf, "CC = ");
4b7f6baa 1145 OUTS (outf, pregs (x));
086134ec 1146 OUTS (outf, " < ");
4b7f6baa 1147 OUTS (outf, imm3 (y));
4b7f6baa
CM
1148 }
1149 else if (opc == 2 && I == 1 && G == 1)
1150 {
086134ec 1151 OUTS (outf, "CC = ");
4b7f6baa 1152 OUTS (outf, pregs (x));
086134ec 1153 OUTS (outf, " <= ");
4b7f6baa 1154 OUTS (outf, imm3 (y));
4b7f6baa
CM
1155 }
1156 else if (opc == 3 && I == 1 && G == 1)
1157 {
086134ec 1158 OUTS (outf, "CC = ");
4b7f6baa 1159 OUTS (outf, pregs (x));
086134ec 1160 OUTS (outf, " < ");
4b7f6baa 1161 OUTS (outf, uimm3 (y));
086134ec 1162 OUTS (outf, " (IU)");
4b7f6baa
CM
1163 }
1164 else if (opc == 4 && I == 1 && G == 1)
1165 {
086134ec 1166 OUTS (outf, "CC = ");
4b7f6baa 1167 OUTS (outf, pregs (x));
086134ec 1168 OUTS (outf, " <= ");
4b7f6baa 1169 OUTS (outf, uimm3 (y));
086134ec 1170 OUTS (outf, " (IU)");
4b7f6baa
CM
1171 }
1172 else if (opc == 5 && I == 0 && G == 0)
086134ec 1173 OUTS (outf, "CC = A0 == A1");
b7d48530 1174
4b7f6baa 1175 else if (opc == 6 && I == 0 && G == 0)
086134ec 1176 OUTS (outf, "CC = A0 < A1");
b7d48530 1177
4b7f6baa 1178 else if (opc == 7 && I == 0 && G == 0)
086134ec 1179 OUTS (outf, "CC = A0 <= A1");
b7d48530 1180
4b7f6baa 1181 else
b7d48530
NC
1182 return 0;
1183 return 2;
4b7f6baa
CM
1184}
1185
1186static int
1187decode_CC2dreg_0 (TIword iw0, disassemble_info *outf)
1188{
b7d48530
NC
1189 /* CC2dreg
1190 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1191 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |.op....|.reg.......|
1192 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
1193 int op = ((iw0 >> CC2dreg_op_bits) & CC2dreg_op_mask);
1194 int reg = ((iw0 >> CC2dreg_reg_bits) & CC2dreg_reg_mask);
1195
1196 if (op == 0)
1197 {
4b7f6baa 1198 OUTS (outf, dregs (reg));
086134ec 1199 OUTS (outf, " = CC");
4b7f6baa
CM
1200 }
1201 else if (op == 1)
1202 {
086134ec 1203 OUTS (outf, "CC = ");
4b7f6baa 1204 OUTS (outf, dregs (reg));
4b7f6baa
CM
1205 }
1206 else if (op == 3)
086134ec 1207 OUTS (outf, "CC = !CC");
4b7f6baa 1208 else
b7d48530
NC
1209 return 0;
1210
1211 return 2;
4b7f6baa
CM
1212}
1213
1214static int
1215decode_CC2stat_0 (TIword iw0, disassemble_info *outf)
1216{
b7d48530
NC
1217 /* CC2stat
1218 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1219 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |.D.|.op....|.cbit..............|
1220 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
1221 int D = ((iw0 >> CC2stat_D_bits) & CC2stat_D_mask);
1222 int op = ((iw0 >> CC2stat_op_bits) & CC2stat_op_mask);
1223 int cbit = ((iw0 >> CC2stat_cbit_bits) & CC2stat_cbit_mask);
1224
1225 if (op == 0 && D == 0)
1226 {
4b7f6baa
CM
1227 OUTS (outf, "CC = ");
1228 OUTS (outf, statbits (cbit));
4b7f6baa
CM
1229 }
1230 else if (op == 1 && D == 0)
1231 {
086134ec 1232 OUTS (outf, "CC |= ");
4b7f6baa 1233 OUTS (outf, statbits (cbit));
4b7f6baa
CM
1234 }
1235 else if (op == 2 && D == 0)
1236 {
086134ec 1237 OUTS (outf, "CC &= ");
4b7f6baa 1238 OUTS (outf, statbits (cbit));
4b7f6baa
CM
1239 }
1240 else if (op == 3 && D == 0)
1241 {
086134ec 1242 OUTS (outf, "CC ^= ");
4b7f6baa 1243 OUTS (outf, statbits (cbit));
4b7f6baa
CM
1244 }
1245 else if (op == 0 && D == 1)
1246 {
4b7f6baa 1247 OUTS (outf, statbits (cbit));
086134ec 1248 OUTS (outf, " = CC");
4b7f6baa
CM
1249 }
1250 else if (op == 1 && D == 1)
1251 {
4b7f6baa 1252 OUTS (outf, statbits (cbit));
086134ec 1253 OUTS (outf, " |= CC");
4b7f6baa
CM
1254 }
1255 else if (op == 2 && D == 1)
1256 {
4b7f6baa 1257 OUTS (outf, statbits (cbit));
086134ec 1258 OUTS (outf, " &= CC");
4b7f6baa
CM
1259 }
1260 else if (op == 3 && D == 1)
1261 {
4b7f6baa 1262 OUTS (outf, statbits (cbit));
086134ec 1263 OUTS (outf, " ^= CC");
4b7f6baa
CM
1264 }
1265 else
b7d48530
NC
1266 return 0;
1267
1268 return 2;
4b7f6baa
CM
1269}
1270
1271static int
1272decode_BRCC_0 (TIword iw0, bfd_vma pc, disassemble_info *outf)
1273{
b7d48530
NC
1274 /* BRCC
1275 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1276 | 0 | 0 | 0 | 1 |.T.|.B.|.offset................................|
1277 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
1278 int B = ((iw0 >> BRCC_B_bits) & BRCC_B_mask);
1279 int T = ((iw0 >> BRCC_T_bits) & BRCC_T_mask);
1280 int offset = ((iw0 >> BRCC_offset_bits) & BRCC_offset_mask);
1281
1282 if (T == 1 && B == 1)
1283 {
086134ec 1284 OUTS (outf, "IF CC JUMP 0x");
4b7f6baa 1285 OUTS (outf, pcrel10 (offset));
086134ec 1286 OUTS (outf, " (BP)");
4b7f6baa
CM
1287 }
1288 else if (T == 0 && B == 1)
1289 {
086134ec 1290 OUTS (outf, "IF !CC JUMP 0x");
4b7f6baa 1291 OUTS (outf, pcrel10 (offset));
086134ec 1292 OUTS (outf, " (BP)");
4b7f6baa
CM
1293 }
1294 else if (T == 1)
1295 {
086134ec 1296 OUTS (outf, "IF CC JUMP 0x");
4b7f6baa 1297 OUTS (outf, pcrel10 (offset));
4b7f6baa
CM
1298 }
1299 else if (T == 0)
1300 {
086134ec 1301 OUTS (outf, "IF !CC JUMP 0x");
4b7f6baa 1302 OUTS (outf, pcrel10 (offset));
4b7f6baa
CM
1303 }
1304 else
b7d48530
NC
1305 return 0;
1306
1307 return 2;
4b7f6baa
CM
1308}
1309
1310static int
1311decode_UJUMP_0 (TIword iw0, bfd_vma pc, disassemble_info *outf)
1312{
b7d48530
NC
1313 /* UJUMP
1314 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1315 | 0 | 0 | 1 | 0 |.offset........................................|
1316 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
1317 int offset = ((iw0 >> UJump_offset_bits) & UJump_offset_mask);
1318
086134ec 1319 OUTS (outf, "JUMP.S 0x");
4b7f6baa 1320 OUTS (outf, pcrel12 (offset));
b7d48530 1321 return 2;
4b7f6baa
CM
1322}
1323
1324static int
1325decode_REGMV_0 (TIword iw0, disassemble_info *outf)
1326{
b7d48530
NC
1327 /* REGMV
1328 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1329 | 0 | 0 | 1 | 1 |.gd........|.gs........|.dst.......|.src.......|
1330 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
1331 int gs = ((iw0 >> RegMv_gs_bits) & RegMv_gs_mask);
1332 int gd = ((iw0 >> RegMv_gd_bits) & RegMv_gd_mask);
1333 int src = ((iw0 >> RegMv_src_bits) & RegMv_src_mask);
1334 int dst = ((iw0 >> RegMv_dst_bits) & RegMv_dst_mask);
1335
c958a8a8
JZ
1336 if (!((IS_GENREG (gd, dst) && IS_GENREG (gs, src))
1337 || (IS_GENREG (gd, dst) && IS_DAGREG (gs, src))
1338 || (IS_DAGREG (gd, dst) && IS_GENREG (gs, src))
1339 || (IS_DAGREG (gd, dst) && IS_DAGREG (gs, src))
1340 || (IS_GENREG (gd, dst) && gs == 7 && src == 0)
1341 || (gd == 7 && dst == 0 && IS_GENREG (gs, src))
1342 || (IS_DREG (gd, dst) && IS_SYSREG (gs, src))
1343 || (IS_PREG (gd, dst) && IS_SYSREG (gs, src))
1344 || (IS_SYSREG (gd, dst) && IS_DREG (gs, src))
1345 || (IS_SYSREG (gd, dst) && IS_PREG (gs, src))
1346 || (IS_SYSREG (gd, dst) && gs == 7 && src == 0)))
1347 return 0;
1348
4b7f6baa 1349 OUTS (outf, allregs (dst, gd));
086134ec 1350 OUTS (outf, " = ");
4b7f6baa 1351 OUTS (outf, allregs (src, gs));
b7d48530 1352 return 2;
4b7f6baa
CM
1353}
1354
1355static int
1356decode_ALU2op_0 (TIword iw0, disassemble_info *outf)
1357{
b7d48530
NC
1358 /* ALU2op
1359 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1360 | 0 | 1 | 0 | 0 | 0 | 0 |.opc...........|.src.......|.dst.......|
1361 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
1362 int src = ((iw0 >> ALU2op_src_bits) & ALU2op_src_mask);
1363 int opc = ((iw0 >> ALU2op_opc_bits) & ALU2op_opc_mask);
1364 int dst = ((iw0 >> ALU2op_dst_bits) & ALU2op_dst_mask);
1365
1366 if (opc == 0)
1367 {
4b7f6baa 1368 OUTS (outf, dregs (dst));
086134ec 1369 OUTS (outf, " >>>= ");
4b7f6baa 1370 OUTS (outf, dregs (src));
4b7f6baa
CM
1371 }
1372 else if (opc == 1)
1373 {
4b7f6baa 1374 OUTS (outf, dregs (dst));
086134ec 1375 OUTS (outf, " >>= ");
4b7f6baa 1376 OUTS (outf, dregs (src));
4b7f6baa
CM
1377 }
1378 else if (opc == 2)
1379 {
4b7f6baa 1380 OUTS (outf, dregs (dst));
086134ec 1381 OUTS (outf, " <<= ");
4b7f6baa 1382 OUTS (outf, dregs (src));
4b7f6baa
CM
1383 }
1384 else if (opc == 3)
1385 {
4b7f6baa 1386 OUTS (outf, dregs (dst));
086134ec 1387 OUTS (outf, " *= ");
4b7f6baa 1388 OUTS (outf, dregs (src));
4b7f6baa
CM
1389 }
1390 else if (opc == 4)
1391 {
4b7f6baa 1392 OUTS (outf, dregs (dst));
086134ec 1393 OUTS (outf, " = (");
4b7f6baa 1394 OUTS (outf, dregs (dst));
086134ec 1395 OUTS (outf, " + ");
4b7f6baa 1396 OUTS (outf, dregs (src));
086134ec 1397 OUTS (outf, ") << 0x1");
4b7f6baa
CM
1398 }
1399 else if (opc == 5)
1400 {
4b7f6baa 1401 OUTS (outf, dregs (dst));
086134ec 1402 OUTS (outf, " = (");
4b7f6baa 1403 OUTS (outf, dregs (dst));
086134ec 1404 OUTS (outf, " + ");
4b7f6baa 1405 OUTS (outf, dregs (src));
086134ec 1406 OUTS (outf, ") << 0x2");
4b7f6baa
CM
1407 }
1408 else if (opc == 8)
1409 {
086134ec 1410 OUTS (outf, "DIVQ (");
4b7f6baa 1411 OUTS (outf, dregs (dst));
086134ec 1412 OUTS (outf, ", ");
4b7f6baa
CM
1413 OUTS (outf, dregs (src));
1414 OUTS (outf, ")");
4b7f6baa
CM
1415 }
1416 else if (opc == 9)
1417 {
086134ec 1418 OUTS (outf, "DIVS (");
4b7f6baa 1419 OUTS (outf, dregs (dst));
086134ec 1420 OUTS (outf, ", ");
4b7f6baa
CM
1421 OUTS (outf, dregs (src));
1422 OUTS (outf, ")");
4b7f6baa
CM
1423 }
1424 else if (opc == 10)
1425 {
4b7f6baa 1426 OUTS (outf, dregs (dst));
086134ec 1427 OUTS (outf, " = ");
4b7f6baa 1428 OUTS (outf, dregs_lo (src));
086134ec 1429 OUTS (outf, " (X)");
4b7f6baa
CM
1430 }
1431 else if (opc == 11)
1432 {
4b7f6baa 1433 OUTS (outf, dregs (dst));
086134ec 1434 OUTS (outf, " = ");
4b7f6baa 1435 OUTS (outf, dregs_lo (src));
086134ec 1436 OUTS (outf, " (Z)");
4b7f6baa
CM
1437 }
1438 else if (opc == 12)
1439 {
4b7f6baa 1440 OUTS (outf, dregs (dst));
086134ec 1441 OUTS (outf, " = ");
4b7f6baa 1442 OUTS (outf, dregs_byte (src));
086134ec 1443 OUTS (outf, " (X)");
4b7f6baa
CM
1444 }
1445 else if (opc == 13)
1446 {
4b7f6baa 1447 OUTS (outf, dregs (dst));
086134ec 1448 OUTS (outf, " = ");
4b7f6baa 1449 OUTS (outf, dregs_byte (src));
086134ec 1450 OUTS (outf, " (Z)");
4b7f6baa
CM
1451 }
1452 else if (opc == 14)
1453 {
4b7f6baa 1454 OUTS (outf, dregs (dst));
086134ec 1455 OUTS (outf, " = -");
4b7f6baa 1456 OUTS (outf, dregs (src));
4b7f6baa
CM
1457 }
1458 else if (opc == 15)
1459 {
4b7f6baa 1460 OUTS (outf, dregs (dst));
086134ec 1461 OUTS (outf, " =~ ");
4b7f6baa 1462 OUTS (outf, dregs (src));
4b7f6baa
CM
1463 }
1464 else
b7d48530
NC
1465 return 0;
1466
1467 return 2;
4b7f6baa
CM
1468}
1469
1470static int
1471decode_PTR2op_0 (TIword iw0, disassemble_info *outf)
1472{
b7d48530
NC
1473 /* PTR2op
1474 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1475 | 0 | 1 | 0 | 0 | 0 | 1 | 0 |.opc.......|.src.......|.dst.......|
1476 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
1477 int src = ((iw0 >> PTR2op_src_bits) & PTR2op_dst_mask);
1478 int opc = ((iw0 >> PTR2op_opc_bits) & PTR2op_opc_mask);
1479 int dst = ((iw0 >> PTR2op_dst_bits) & PTR2op_dst_mask);
1480
1481 if (opc == 0)
1482 {
4b7f6baa 1483 OUTS (outf, pregs (dst));
086134ec 1484 OUTS (outf, " -= ");
4b7f6baa 1485 OUTS (outf, pregs (src));
4b7f6baa
CM
1486 }
1487 else if (opc == 1)
1488 {
4b7f6baa 1489 OUTS (outf, pregs (dst));
086134ec 1490 OUTS (outf, " = ");
4b7f6baa 1491 OUTS (outf, pregs (src));
086134ec 1492 OUTS (outf, " << 0x2");
4b7f6baa
CM
1493 }
1494 else if (opc == 3)
1495 {
4b7f6baa 1496 OUTS (outf, pregs (dst));
086134ec 1497 OUTS (outf, " = ");
4b7f6baa 1498 OUTS (outf, pregs (src));
086134ec 1499 OUTS (outf, " >> 0x2");
4b7f6baa
CM
1500 }
1501 else if (opc == 4)
1502 {
4b7f6baa 1503 OUTS (outf, pregs (dst));
086134ec 1504 OUTS (outf, " = ");
4b7f6baa 1505 OUTS (outf, pregs (src));
086134ec 1506 OUTS (outf, " >> 0x1");
4b7f6baa
CM
1507 }
1508 else if (opc == 5)
1509 {
4b7f6baa 1510 OUTS (outf, pregs (dst));
086134ec 1511 OUTS (outf, " += ");
4b7f6baa 1512 OUTS (outf, pregs (src));
086134ec 1513 OUTS (outf, " (BREV)");
4b7f6baa
CM
1514 }
1515 else if (opc == 6)
1516 {
4b7f6baa 1517 OUTS (outf, pregs (dst));
086134ec 1518 OUTS (outf, " = (");
4b7f6baa 1519 OUTS (outf, pregs (dst));
086134ec 1520 OUTS (outf, " + ");
4b7f6baa 1521 OUTS (outf, pregs (src));
086134ec 1522 OUTS (outf, ") << 0x1");
4b7f6baa
CM
1523 }
1524 else if (opc == 7)
1525 {
4b7f6baa 1526 OUTS (outf, pregs (dst));
086134ec 1527 OUTS (outf, " = (");
4b7f6baa 1528 OUTS (outf, pregs (dst));
086134ec 1529 OUTS (outf, " + ");
4b7f6baa 1530 OUTS (outf, pregs (src));
086134ec 1531 OUTS (outf, ") << 0x2");
4b7f6baa
CM
1532 }
1533 else
b7d48530
NC
1534 return 0;
1535
1536 return 2;
4b7f6baa
CM
1537}
1538
1539static int
1540decode_LOGI2op_0 (TIword iw0, disassemble_info *outf)
1541{
b7d48530
NC
1542 /* LOGI2op
1543 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1544 | 0 | 1 | 0 | 0 | 1 |.opc.......|.src...............|.dst.......|
1545 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
1546 int src = ((iw0 >> LOGI2op_src_bits) & LOGI2op_src_mask);
1547 int opc = ((iw0 >> LOGI2op_opc_bits) & LOGI2op_opc_mask);
1548 int dst = ((iw0 >> LOGI2op_dst_bits) & LOGI2op_dst_mask);
1549
1550 if (opc == 0)
1551 {
086134ec 1552 OUTS (outf, "CC = !BITTST (");
4b7f6baa 1553 OUTS (outf, dregs (dst));
086134ec 1554 OUTS (outf, ", ");
4b7f6baa 1555 OUTS (outf, uimm5 (src));
086134ec
BS
1556 OUTS (outf, ");\t\t/* bit");
1557 OUTS (outf, imm7d (src));
1558 OUTS (outf, " */");
1559 comment = 1;
4b7f6baa
CM
1560 }
1561 else if (opc == 1)
1562 {
4b7f6baa
CM
1563 OUTS (outf, "CC = BITTST (");
1564 OUTS (outf, dregs (dst));
086134ec 1565 OUTS (outf, ", ");
4b7f6baa 1566 OUTS (outf, uimm5 (src));
086134ec
BS
1567 OUTS (outf, ");\t\t/* bit");
1568 OUTS (outf, imm7d (src));
1569 OUTS (outf, " */");
1570 comment = 1;
4b7f6baa
CM
1571 }
1572 else if (opc == 2)
1573 {
4b7f6baa
CM
1574 OUTS (outf, "BITSET (");
1575 OUTS (outf, dregs (dst));
086134ec 1576 OUTS (outf, ", ");
4b7f6baa 1577 OUTS (outf, uimm5 (src));
086134ec
BS
1578 OUTS (outf, ");\t\t/* bit");
1579 OUTS (outf, imm7d (src));
1580 OUTS (outf, " */");
1581 comment = 1;
4b7f6baa
CM
1582 }
1583 else if (opc == 3)
1584 {
4b7f6baa
CM
1585 OUTS (outf, "BITTGL (");
1586 OUTS (outf, dregs (dst));
086134ec 1587 OUTS (outf, ", ");
4b7f6baa 1588 OUTS (outf, uimm5 (src));
086134ec
BS
1589 OUTS (outf, ");\t\t/* bit");
1590 OUTS (outf, imm7d (src));
1591 OUTS (outf, " */");
1592 comment = 1;
4b7f6baa
CM
1593 }
1594 else if (opc == 4)
1595 {
4b7f6baa
CM
1596 OUTS (outf, "BITCLR (");
1597 OUTS (outf, dregs (dst));
086134ec 1598 OUTS (outf, ", ");
4b7f6baa 1599 OUTS (outf, uimm5 (src));
086134ec
BS
1600 OUTS (outf, ");\t\t/* bit");
1601 OUTS (outf, imm7d (src));
1602 OUTS (outf, " */");
1603 comment = 1;
4b7f6baa
CM
1604 }
1605 else if (opc == 5)
1606 {
4b7f6baa 1607 OUTS (outf, dregs (dst));
086134ec 1608 OUTS (outf, " >>>= ");
4b7f6baa 1609 OUTS (outf, uimm5 (src));
4b7f6baa
CM
1610 }
1611 else if (opc == 6)
1612 {
4b7f6baa 1613 OUTS (outf, dregs (dst));
086134ec 1614 OUTS (outf, " >>= ");
4b7f6baa 1615 OUTS (outf, uimm5 (src));
4b7f6baa
CM
1616 }
1617 else if (opc == 7)
1618 {
4b7f6baa 1619 OUTS (outf, dregs (dst));
086134ec 1620 OUTS (outf, " <<= ");
4b7f6baa 1621 OUTS (outf, uimm5 (src));
4b7f6baa
CM
1622 }
1623 else
b7d48530
NC
1624 return 0;
1625
1626 return 2;
4b7f6baa
CM
1627}
1628
1629static int
1630decode_COMP3op_0 (TIword iw0, disassemble_info *outf)
1631{
b7d48530
NC
1632 /* COMP3op
1633 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1634 | 0 | 1 | 0 | 1 |.opc.......|.dst.......|.src1......|.src0......|
1635 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
1636 int opc = ((iw0 >> COMP3op_opc_bits) & COMP3op_opc_mask);
1637 int dst = ((iw0 >> COMP3op_dst_bits) & COMP3op_dst_mask);
1638 int src0 = ((iw0 >> COMP3op_src0_bits) & COMP3op_src0_mask);
1639 int src1 = ((iw0 >> COMP3op_src1_bits) & COMP3op_src1_mask);
1640
1641 if (opc == 5 && src1 == src0)
1642 {
4b7f6baa 1643 OUTS (outf, pregs (dst));
086134ec 1644 OUTS (outf, " = ");
4b7f6baa 1645 OUTS (outf, pregs (src0));
086134ec 1646 OUTS (outf, " << 0x1");
4b7f6baa
CM
1647 }
1648 else if (opc == 1)
1649 {
4b7f6baa 1650 OUTS (outf, dregs (dst));
086134ec 1651 OUTS (outf, " = ");
4b7f6baa 1652 OUTS (outf, dregs (src0));
086134ec 1653 OUTS (outf, " - ");
4b7f6baa 1654 OUTS (outf, dregs (src1));
4b7f6baa
CM
1655 }
1656 else if (opc == 2)
1657 {
4b7f6baa 1658 OUTS (outf, dregs (dst));
086134ec 1659 OUTS (outf, " = ");
4b7f6baa 1660 OUTS (outf, dregs (src0));
086134ec 1661 OUTS (outf, " & ");
4b7f6baa 1662 OUTS (outf, dregs (src1));
4b7f6baa
CM
1663 }
1664 else if (opc == 3)
1665 {
4b7f6baa 1666 OUTS (outf, dregs (dst));
086134ec 1667 OUTS (outf, " = ");
4b7f6baa 1668 OUTS (outf, dregs (src0));
086134ec 1669 OUTS (outf, " | ");
4b7f6baa 1670 OUTS (outf, dregs (src1));
4b7f6baa
CM
1671 }
1672 else if (opc == 4)
1673 {
4b7f6baa 1674 OUTS (outf, dregs (dst));
086134ec 1675 OUTS (outf, " = ");
4b7f6baa 1676 OUTS (outf, dregs (src0));
086134ec 1677 OUTS (outf, " ^ ");
4b7f6baa 1678 OUTS (outf, dregs (src1));
4b7f6baa
CM
1679 }
1680 else if (opc == 5)
1681 {
4b7f6baa 1682 OUTS (outf, pregs (dst));
086134ec 1683 OUTS (outf, " = ");
4b7f6baa 1684 OUTS (outf, pregs (src0));
086134ec 1685 OUTS (outf, " + ");
4b7f6baa 1686 OUTS (outf, pregs (src1));
4b7f6baa
CM
1687 }
1688 else if (opc == 6)
1689 {
4b7f6baa 1690 OUTS (outf, pregs (dst));
086134ec 1691 OUTS (outf, " = ");
4b7f6baa 1692 OUTS (outf, pregs (src0));
086134ec 1693 OUTS (outf, " + (");
4b7f6baa 1694 OUTS (outf, pregs (src1));
086134ec 1695 OUTS (outf, " << 0x1)");
4b7f6baa
CM
1696 }
1697 else if (opc == 7)
1698 {
4b7f6baa 1699 OUTS (outf, pregs (dst));
086134ec 1700 OUTS (outf, " = ");
4b7f6baa 1701 OUTS (outf, pregs (src0));
086134ec 1702 OUTS (outf, " + (");
4b7f6baa 1703 OUTS (outf, pregs (src1));
086134ec 1704 OUTS (outf, " << 0x2)");
4b7f6baa
CM
1705 }
1706 else if (opc == 0)
1707 {
4b7f6baa 1708 OUTS (outf, dregs (dst));
086134ec 1709 OUTS (outf, " = ");
4b7f6baa 1710 OUTS (outf, dregs (src0));
086134ec 1711 OUTS (outf, " + ");
4b7f6baa 1712 OUTS (outf, dregs (src1));
4b7f6baa
CM
1713 }
1714 else
b7d48530
NC
1715 return 0;
1716
1717 return 2;
4b7f6baa
CM
1718}
1719
1720static int
1721decode_COMPI2opD_0 (TIword iw0, disassemble_info *outf)
1722{
b7d48530
NC
1723 /* COMPI2opD
1724 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1725 | 0 | 1 | 1 | 0 | 0 |.op|..src......................|.dst.......|
1726 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
1727 int op = ((iw0 >> COMPI2opD_op_bits) & COMPI2opD_op_mask);
1728 int dst = ((iw0 >> COMPI2opD_dst_bits) & COMPI2opD_dst_mask);
1729 int src = ((iw0 >> COMPI2opD_src_bits) & COMPI2opD_src_mask);
1730
086134ec
BS
1731 bu32 *pval = get_allreg (0, dst);
1732
1733 /* Since we don't have 32-bit immediate loads, we allow the disassembler
1734 to combine them, so it prints out the right values.
1735 Here we keep track of the registers. */
1736 if (op == 0)
1737 {
1738 *pval = imm7_val (src);
1739 if (src & 0x40)
1740 *pval |= 0xFFFFFF80;
1741 else
1742 *pval &= 0x7F;
1743 }
1744
4b7f6baa
CM
1745 if (op == 0)
1746 {
4b7f6baa 1747 OUTS (outf, dregs (dst));
086134ec 1748 OUTS (outf, " = ");
4b7f6baa 1749 OUTS (outf, imm7 (src));
086134ec
BS
1750 OUTS (outf, " (X);\t\t/*\t\t");
1751 OUTS (outf, dregs (dst));
1752 OUTS (outf, "=");
1753 OUTS (outf, uimm32 (*pval));
1754 OUTS (outf, "(");
1755 OUTS (outf, imm32 (*pval));
1756 OUTS (outf, ") */");
1757 comment = 1;
4b7f6baa
CM
1758 }
1759 else if (op == 1)
1760 {
4b7f6baa 1761 OUTS (outf, dregs (dst));
086134ec 1762 OUTS (outf, " += ");
4b7f6baa 1763 OUTS (outf, imm7 (src));
086134ec
BS
1764 OUTS (outf, ";\t\t/* (");
1765 OUTS (outf, imm7d (src));
1766 OUTS (outf, ") */");
1767 comment = 1;
4b7f6baa
CM
1768 }
1769 else
b7d48530
NC
1770 return 0;
1771
1772 return 2;
4b7f6baa
CM
1773}
1774
1775static int
1776decode_COMPI2opP_0 (TIword iw0, disassemble_info *outf)
1777{
b7d48530
NC
1778 /* COMPI2opP
1779 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1780 | 0 | 1 | 1 | 0 | 1 |.op|.src.......................|.dst.......|
1781 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
1782 int op = ((iw0 >> COMPI2opP_op_bits) & COMPI2opP_op_mask);
1783 int src = ((iw0 >> COMPI2opP_src_bits) & COMPI2opP_src_mask);
1784 int dst = ((iw0 >> COMPI2opP_dst_bits) & COMPI2opP_dst_mask);
1785
086134ec
BS
1786 bu32 *pval = get_allreg (1, dst);
1787
1788 if (op == 0)
1789 {
1790 *pval = imm7_val (src);
1791 if (src & 0x40)
1792 *pval |= 0xFFFFFF80;
1793 else
1794 *pval &= 0x7F;
1795 }
1796
4b7f6baa
CM
1797 if (op == 0)
1798 {
4b7f6baa 1799 OUTS (outf, pregs (dst));
086134ec 1800 OUTS (outf, " = ");
4b7f6baa 1801 OUTS (outf, imm7 (src));
086134ec
BS
1802 OUTS (outf, " (X);\t\t/*\t\t");
1803 OUTS (outf, pregs (dst));
1804 OUTS (outf, "=");
1805 OUTS (outf, uimm32 (*pval));
1806 OUTS (outf, "(");
1807 OUTS (outf, imm32 (*pval));
1808 OUTS (outf, ") */");
1809 comment = 1;
4b7f6baa
CM
1810 }
1811 else if (op == 1)
1812 {
4b7f6baa 1813 OUTS (outf, pregs (dst));
086134ec 1814 OUTS (outf, " += ");
4b7f6baa 1815 OUTS (outf, imm7 (src));
086134ec
BS
1816 OUTS (outf, ";\t\t/* (");
1817 OUTS (outf, imm7d (src));
1818 OUTS (outf, ") */");
1819 comment = 1;
4b7f6baa
CM
1820 }
1821 else
b7d48530
NC
1822 return 0;
1823
1824 return 2;
4b7f6baa
CM
1825}
1826
1827static int
1828decode_LDSTpmod_0 (TIword iw0, disassemble_info *outf)
1829{
b7d48530
NC
1830 /* LDSTpmod
1831 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1832 | 1 | 0 | 0 | 0 |.W.|.aop...|.reg.......|.idx.......|.ptr.......|
1833 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
1834 int W = ((iw0 >> LDSTpmod_W_bits) & LDSTpmod_W_mask);
1835 int aop = ((iw0 >> LDSTpmod_aop_bits) & LDSTpmod_aop_mask);
1836 int idx = ((iw0 >> LDSTpmod_idx_bits) & LDSTpmod_idx_mask);
1837 int ptr = ((iw0 >> LDSTpmod_ptr_bits) & LDSTpmod_ptr_mask);
1838 int reg = ((iw0 >> LDSTpmod_reg_bits) & LDSTpmod_reg_mask);
1839
1840 if (aop == 1 && W == 0 && idx == ptr)
1841 {
4b7f6baa 1842 OUTS (outf, dregs_lo (reg));
086134ec 1843 OUTS (outf, " = W[");
4b7f6baa
CM
1844 OUTS (outf, pregs (ptr));
1845 OUTS (outf, "]");
4b7f6baa
CM
1846 }
1847 else if (aop == 2 && W == 0 && idx == ptr)
1848 {
4b7f6baa 1849 OUTS (outf, dregs_hi (reg));
086134ec 1850 OUTS (outf, " = W[");
4b7f6baa
CM
1851 OUTS (outf, pregs (ptr));
1852 OUTS (outf, "]");
4b7f6baa
CM
1853 }
1854 else if (aop == 1 && W == 1 && idx == ptr)
1855 {
4b7f6baa
CM
1856 OUTS (outf, "W[");
1857 OUTS (outf, pregs (ptr));
086134ec 1858 OUTS (outf, "] = ");
4b7f6baa 1859 OUTS (outf, dregs_lo (reg));
4b7f6baa
CM
1860 }
1861 else if (aop == 2 && W == 1 && idx == ptr)
1862 {
4b7f6baa
CM
1863 OUTS (outf, "W[");
1864 OUTS (outf, pregs (ptr));
086134ec 1865 OUTS (outf, "] = ");
4b7f6baa 1866 OUTS (outf, dregs_hi (reg));
4b7f6baa
CM
1867 }
1868 else if (aop == 0 && W == 0)
1869 {
4b7f6baa 1870 OUTS (outf, dregs (reg));
086134ec 1871 OUTS (outf, " = [");
4b7f6baa 1872 OUTS (outf, pregs (ptr));
086134ec 1873 OUTS (outf, " ++ ");
4b7f6baa
CM
1874 OUTS (outf, pregs (idx));
1875 OUTS (outf, "]");
4b7f6baa
CM
1876 }
1877 else if (aop == 1 && W == 0)
1878 {
4b7f6baa 1879 OUTS (outf, dregs_lo (reg));
086134ec 1880 OUTS (outf, " = W[");
4b7f6baa 1881 OUTS (outf, pregs (ptr));
086134ec 1882 OUTS (outf, " ++ ");
4b7f6baa
CM
1883 OUTS (outf, pregs (idx));
1884 OUTS (outf, "]");
4b7f6baa
CM
1885 }
1886 else if (aop == 2 && W == 0)
1887 {
4b7f6baa 1888 OUTS (outf, dregs_hi (reg));
086134ec 1889 OUTS (outf, " = W[");
4b7f6baa 1890 OUTS (outf, pregs (ptr));
086134ec 1891 OUTS (outf, " ++ ");
4b7f6baa
CM
1892 OUTS (outf, pregs (idx));
1893 OUTS (outf, "]");
4b7f6baa
CM
1894 }
1895 else if (aop == 3 && W == 0)
1896 {
4b7f6baa 1897 OUTS (outf, dregs (reg));
086134ec 1898 OUTS (outf, " = W[");
4b7f6baa 1899 OUTS (outf, pregs (ptr));
086134ec 1900 OUTS (outf, " ++ ");
4b7f6baa
CM
1901 OUTS (outf, pregs (idx));
1902 OUTS (outf, "] (Z)");
4b7f6baa
CM
1903 }
1904 else if (aop == 3 && W == 1)
1905 {
4b7f6baa 1906 OUTS (outf, dregs (reg));
086134ec 1907 OUTS (outf, " = W[");
4b7f6baa 1908 OUTS (outf, pregs (ptr));
086134ec 1909 OUTS (outf, " ++ ");
4b7f6baa 1910 OUTS (outf, pregs (idx));
086134ec 1911 OUTS (outf, "] (X)");
4b7f6baa
CM
1912 }
1913 else if (aop == 0 && W == 1)
1914 {
4b7f6baa
CM
1915 OUTS (outf, "[");
1916 OUTS (outf, pregs (ptr));
086134ec 1917 OUTS (outf, " ++ ");
4b7f6baa 1918 OUTS (outf, pregs (idx));
086134ec 1919 OUTS (outf, "] = ");
4b7f6baa 1920 OUTS (outf, dregs (reg));
4b7f6baa
CM
1921 }
1922 else if (aop == 1 && W == 1)
1923 {
4b7f6baa
CM
1924 OUTS (outf, "W[");
1925 OUTS (outf, pregs (ptr));
086134ec 1926 OUTS (outf, " ++ ");
4b7f6baa 1927 OUTS (outf, pregs (idx));
086134ec 1928 OUTS (outf, "] = ");
4b7f6baa 1929 OUTS (outf, dregs_lo (reg));
4b7f6baa
CM
1930 }
1931 else if (aop == 2 && W == 1)
1932 {
4b7f6baa
CM
1933 OUTS (outf, "W[");
1934 OUTS (outf, pregs (ptr));
086134ec 1935 OUTS (outf, " ++ ");
4b7f6baa 1936 OUTS (outf, pregs (idx));
086134ec 1937 OUTS (outf, "] = ");
4b7f6baa 1938 OUTS (outf, dregs_hi (reg));
4b7f6baa
CM
1939 }
1940 else
b7d48530
NC
1941 return 0;
1942
1943 return 2;
4b7f6baa
CM
1944}
1945
1946static int
1947decode_dagMODim_0 (TIword iw0, disassemble_info *outf)
1948{
b7d48530
NC
1949 /* dagMODim
1950 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1951 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 0 |.br| 1 | 1 |.op|.m.....|.i.....|
1952 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
1953 int i = ((iw0 >> DagMODim_i_bits) & DagMODim_i_mask);
1954 int m = ((iw0 >> DagMODim_m_bits) & DagMODim_m_mask);
1955 int br = ((iw0 >> DagMODim_br_bits) & DagMODim_br_mask);
1956 int op = ((iw0 >> DagMODim_op_bits) & DagMODim_op_mask);
1957
1958 if (op == 0 && br == 1)
1959 {
4b7f6baa 1960 OUTS (outf, iregs (i));
086134ec 1961 OUTS (outf, " += ");
4b7f6baa 1962 OUTS (outf, mregs (m));
086134ec 1963 OUTS (outf, " (BREV)");
4b7f6baa
CM
1964 }
1965 else if (op == 0)
1966 {
4b7f6baa 1967 OUTS (outf, iregs (i));
086134ec 1968 OUTS (outf, " += ");
4b7f6baa 1969 OUTS (outf, mregs (m));
4b7f6baa
CM
1970 }
1971 else if (op == 1)
1972 {
4b7f6baa 1973 OUTS (outf, iregs (i));
086134ec 1974 OUTS (outf, " -= ");
4b7f6baa 1975 OUTS (outf, mregs (m));
4b7f6baa
CM
1976 }
1977 else
b7d48530
NC
1978 return 0;
1979
1980 return 2;
4b7f6baa
CM
1981}
1982
1983static int
1984decode_dagMODik_0 (TIword iw0, disassemble_info *outf)
1985{
b7d48530
NC
1986 /* dagMODik
1987 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1988 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 0 |.op....|.i.....|
1989 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
1990 int i = ((iw0 >> DagMODik_i_bits) & DagMODik_i_mask);
1991 int op = ((iw0 >> DagMODik_op_bits) & DagMODik_op_mask);
1992
1993 if (op == 0)
1994 {
4b7f6baa 1995 OUTS (outf, iregs (i));
086134ec 1996 OUTS (outf, " += 0x2");
4b7f6baa
CM
1997 }
1998 else if (op == 1)
1999 {
4b7f6baa 2000 OUTS (outf, iregs (i));
086134ec 2001 OUTS (outf, " -= 0x2");
4b7f6baa
CM
2002 }
2003 else if (op == 2)
2004 {
4b7f6baa 2005 OUTS (outf, iregs (i));
086134ec 2006 OUTS (outf, " += 0x4");
4b7f6baa
CM
2007 }
2008 else if (op == 3)
2009 {
4b7f6baa 2010 OUTS (outf, iregs (i));
086134ec 2011 OUTS (outf, " -= 0x4");
4b7f6baa
CM
2012 }
2013 else
b7d48530
NC
2014 return 0;
2015
086134ec
BS
2016 if (! parallel )
2017 {
2018 OUTS (outf, ";\t\t/* ( ");
2019 if (op == 0 || op == 1)
2020 OUTS (outf, "2");
2021 else if (op == 2 || op == 3)
2022 OUTS (outf, "4");
2023 OUTS (outf, ") */");
2024 comment = 1;
2025 }
2026
b7d48530 2027 return 2;
4b7f6baa
CM
2028}
2029
2030static int
2031decode_dspLDST_0 (TIword iw0, disassemble_info *outf)
2032{
b7d48530
NC
2033 /* dspLDST
2034 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2035 | 1 | 0 | 0 | 1 | 1 | 1 |.W.|.aop...|.m.....|.i.....|.reg.......|
2036 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
2037 int i = ((iw0 >> DspLDST_i_bits) & DspLDST_i_mask);
2038 int m = ((iw0 >> DspLDST_m_bits) & DspLDST_m_mask);
2039 int W = ((iw0 >> DspLDST_W_bits) & DspLDST_W_mask);
2040 int aop = ((iw0 >> DspLDST_aop_bits) & DspLDST_aop_mask);
2041 int reg = ((iw0 >> DspLDST_reg_bits) & DspLDST_reg_mask);
2042
2043 if (aop == 0 && W == 0 && m == 0)
2044 {
4b7f6baa 2045 OUTS (outf, dregs (reg));
086134ec 2046 OUTS (outf, " = [");
4b7f6baa
CM
2047 OUTS (outf, iregs (i));
2048 OUTS (outf, "++]");
4b7f6baa
CM
2049 }
2050 else if (aop == 0 && W == 0 && m == 1)
2051 {
4b7f6baa 2052 OUTS (outf, dregs_lo (reg));
086134ec 2053 OUTS (outf, " = W[");
4b7f6baa
CM
2054 OUTS (outf, iregs (i));
2055 OUTS (outf, "++]");
4b7f6baa
CM
2056 }
2057 else if (aop == 0 && W == 0 && m == 2)
2058 {
4b7f6baa 2059 OUTS (outf, dregs_hi (reg));
086134ec 2060 OUTS (outf, " = W[");
4b7f6baa
CM
2061 OUTS (outf, iregs (i));
2062 OUTS (outf, "++]");
4b7f6baa
CM
2063 }
2064 else if (aop == 1 && W == 0 && m == 0)
2065 {
4b7f6baa 2066 OUTS (outf, dregs (reg));
086134ec 2067 OUTS (outf, " = [");
4b7f6baa
CM
2068 OUTS (outf, iregs (i));
2069 OUTS (outf, "--]");
4b7f6baa
CM
2070 }
2071 else if (aop == 1 && W == 0 && m == 1)
2072 {
4b7f6baa 2073 OUTS (outf, dregs_lo (reg));
086134ec 2074 OUTS (outf, " = W[");
4b7f6baa
CM
2075 OUTS (outf, iregs (i));
2076 OUTS (outf, "--]");
4b7f6baa
CM
2077 }
2078 else if (aop == 1 && W == 0 && m == 2)
2079 {
4b7f6baa 2080 OUTS (outf, dregs_hi (reg));
086134ec 2081 OUTS (outf, " = W[");
4b7f6baa
CM
2082 OUTS (outf, iregs (i));
2083 OUTS (outf, "--]");
4b7f6baa
CM
2084 }
2085 else if (aop == 2 && W == 0 && m == 0)
2086 {
4b7f6baa 2087 OUTS (outf, dregs (reg));
086134ec 2088 OUTS (outf, " = [");
4b7f6baa
CM
2089 OUTS (outf, iregs (i));
2090 OUTS (outf, "]");
4b7f6baa
CM
2091 }
2092 else if (aop == 2 && W == 0 && m == 1)
2093 {
4b7f6baa 2094 OUTS (outf, dregs_lo (reg));
086134ec 2095 OUTS (outf, " = W[");
4b7f6baa
CM
2096 OUTS (outf, iregs (i));
2097 OUTS (outf, "]");
4b7f6baa
CM
2098 }
2099 else if (aop == 2 && W == 0 && m == 2)
2100 {
4b7f6baa 2101 OUTS (outf, dregs_hi (reg));
086134ec 2102 OUTS (outf, " = W[");
4b7f6baa
CM
2103 OUTS (outf, iregs (i));
2104 OUTS (outf, "]");
4b7f6baa
CM
2105 }
2106 else if (aop == 0 && W == 1 && m == 0)
2107 {
4b7f6baa
CM
2108 OUTS (outf, "[");
2109 OUTS (outf, iregs (i));
086134ec 2110 OUTS (outf, "++] = ");
4b7f6baa 2111 OUTS (outf, dregs (reg));
4b7f6baa
CM
2112 }
2113 else if (aop == 0 && W == 1 && m == 1)
2114 {
4b7f6baa
CM
2115 OUTS (outf, "W[");
2116 OUTS (outf, iregs (i));
086134ec 2117 OUTS (outf, "++] = ");
4b7f6baa 2118 OUTS (outf, dregs_lo (reg));
4b7f6baa
CM
2119 }
2120 else if (aop == 0 && W == 1 && m == 2)
2121 {
4b7f6baa
CM
2122 OUTS (outf, "W[");
2123 OUTS (outf, iregs (i));
086134ec 2124 OUTS (outf, "++] = ");
4b7f6baa 2125 OUTS (outf, dregs_hi (reg));
4b7f6baa
CM
2126 }
2127 else if (aop == 1 && W == 1 && m == 0)
2128 {
4b7f6baa
CM
2129 OUTS (outf, "[");
2130 OUTS (outf, iregs (i));
086134ec 2131 OUTS (outf, "--] = ");
4b7f6baa 2132 OUTS (outf, dregs (reg));
4b7f6baa
CM
2133 }
2134 else if (aop == 1 && W == 1 && m == 1)
2135 {
4b7f6baa
CM
2136 OUTS (outf, "W[");
2137 OUTS (outf, iregs (i));
086134ec 2138 OUTS (outf, "--] = ");
4b7f6baa 2139 OUTS (outf, dregs_lo (reg));
4b7f6baa
CM
2140 }
2141 else if (aop == 1 && W == 1 && m == 2)
2142 {
4b7f6baa
CM
2143 OUTS (outf, "W[");
2144 OUTS (outf, iregs (i));
086134ec 2145 OUTS (outf, "--] = ");
4b7f6baa 2146 OUTS (outf, dregs_hi (reg));
4b7f6baa
CM
2147 }
2148 else if (aop == 2 && W == 1 && m == 0)
2149 {
4b7f6baa
CM
2150 OUTS (outf, "[");
2151 OUTS (outf, iregs (i));
086134ec 2152 OUTS (outf, "] = ");
4b7f6baa 2153 OUTS (outf, dregs (reg));
4b7f6baa
CM
2154 }
2155 else if (aop == 2 && W == 1 && m == 1)
2156 {
4b7f6baa
CM
2157 OUTS (outf, "W[");
2158 OUTS (outf, iregs (i));
086134ec 2159 OUTS (outf, "] = ");
4b7f6baa 2160 OUTS (outf, dregs_lo (reg));
4b7f6baa
CM
2161 }
2162 else if (aop == 2 && W == 1 && m == 2)
2163 {
4b7f6baa
CM
2164 OUTS (outf, "W[");
2165 OUTS (outf, iregs (i));
086134ec 2166 OUTS (outf, "] = ");
4b7f6baa 2167 OUTS (outf, dregs_hi (reg));
4b7f6baa
CM
2168 }
2169 else if (aop == 3 && W == 0)
2170 {
4b7f6baa 2171 OUTS (outf, dregs (reg));
086134ec 2172 OUTS (outf, " = [");
4b7f6baa 2173 OUTS (outf, iregs (i));
086134ec 2174 OUTS (outf, " ++ ");
4b7f6baa
CM
2175 OUTS (outf, mregs (m));
2176 OUTS (outf, "]");
4b7f6baa
CM
2177 }
2178 else if (aop == 3 && W == 1)
2179 {
4b7f6baa
CM
2180 OUTS (outf, "[");
2181 OUTS (outf, iregs (i));
086134ec 2182 OUTS (outf, " ++ ");
4b7f6baa 2183 OUTS (outf, mregs (m));
086134ec 2184 OUTS (outf, "] = ");
4b7f6baa 2185 OUTS (outf, dregs (reg));
4b7f6baa
CM
2186 }
2187 else
b7d48530
NC
2188 return 0;
2189
2190 return 2;
4b7f6baa
CM
2191}
2192
2193static int
2194decode_LDST_0 (TIword iw0, disassemble_info *outf)
2195{
b7d48530
NC
2196 /* LDST
2197 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2198 | 1 | 0 | 0 | 1 |.sz....|.W.|.aop...|.Z.|.ptr.......|.reg.......|
2199 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
2200 int Z = ((iw0 >> LDST_Z_bits) & LDST_Z_mask);
2201 int W = ((iw0 >> LDST_W_bits) & LDST_W_mask);
2202 int sz = ((iw0 >> LDST_sz_bits) & LDST_sz_mask);
2203 int aop = ((iw0 >> LDST_aop_bits) & LDST_aop_mask);
2204 int reg = ((iw0 >> LDST_reg_bits) & LDST_reg_mask);
2205 int ptr = ((iw0 >> LDST_ptr_bits) & LDST_ptr_mask);
2206
2207 if (aop == 0 && sz == 0 && Z == 0 && W == 0)
2208 {
4b7f6baa 2209 OUTS (outf, dregs (reg));
086134ec 2210 OUTS (outf, " = [");
4b7f6baa
CM
2211 OUTS (outf, pregs (ptr));
2212 OUTS (outf, "++]");
4b7f6baa
CM
2213 }
2214 else if (aop == 0 && sz == 0 && Z == 1 && W == 0)
2215 {
4b7f6baa 2216 OUTS (outf, pregs (reg));
086134ec 2217 OUTS (outf, " = [");
4b7f6baa
CM
2218 OUTS (outf, pregs (ptr));
2219 OUTS (outf, "++]");
4b7f6baa
CM
2220 }
2221 else if (aop == 0 && sz == 1 && Z == 0 && W == 0)
2222 {
4b7f6baa 2223 OUTS (outf, dregs (reg));
086134ec 2224 OUTS (outf, " = W[");
4b7f6baa
CM
2225 OUTS (outf, pregs (ptr));
2226 OUTS (outf, "++] (Z)");
4b7f6baa
CM
2227 }
2228 else if (aop == 0 && sz == 1 && Z == 1 && W == 0)
2229 {
4b7f6baa 2230 OUTS (outf, dregs (reg));
086134ec 2231 OUTS (outf, " = W[");
4b7f6baa 2232 OUTS (outf, pregs (ptr));
086134ec 2233 OUTS (outf, "++] (X)");
4b7f6baa
CM
2234 }
2235 else if (aop == 0 && sz == 2 && Z == 0 && W == 0)
2236 {
4b7f6baa 2237 OUTS (outf, dregs (reg));
086134ec 2238 OUTS (outf, " = B[");
4b7f6baa
CM
2239 OUTS (outf, pregs (ptr));
2240 OUTS (outf, "++] (Z)");
4b7f6baa
CM
2241 }
2242 else if (aop == 0 && sz == 2 && Z == 1 && W == 0)
2243 {
4b7f6baa 2244 OUTS (outf, dregs (reg));
086134ec 2245 OUTS (outf, " = B[");
4b7f6baa 2246 OUTS (outf, pregs (ptr));
086134ec 2247 OUTS (outf, "++] (X)");
4b7f6baa
CM
2248 }
2249 else if (aop == 1 && sz == 0 && Z == 0 && W == 0)
2250 {
4b7f6baa 2251 OUTS (outf, dregs (reg));
086134ec 2252 OUTS (outf, " = [");
4b7f6baa
CM
2253 OUTS (outf, pregs (ptr));
2254 OUTS (outf, "--]");
4b7f6baa
CM
2255 }
2256 else if (aop == 1 && sz == 0 && Z == 1 && W == 0)
2257 {
4b7f6baa 2258 OUTS (outf, pregs (reg));
086134ec 2259 OUTS (outf, " = [");
4b7f6baa
CM
2260 OUTS (outf, pregs (ptr));
2261 OUTS (outf, "--]");
4b7f6baa
CM
2262 }
2263 else if (aop == 1 && sz == 1 && Z == 0 && W == 0)
2264 {
4b7f6baa 2265 OUTS (outf, dregs (reg));
086134ec 2266 OUTS (outf, " = W[");
4b7f6baa
CM
2267 OUTS (outf, pregs (ptr));
2268 OUTS (outf, "--] (Z)");
4b7f6baa
CM
2269 }
2270 else if (aop == 1 && sz == 1 && Z == 1 && W == 0)
2271 {
4b7f6baa 2272 OUTS (outf, dregs (reg));
086134ec 2273 OUTS (outf, " = W[");
4b7f6baa 2274 OUTS (outf, pregs (ptr));
086134ec 2275 OUTS (outf, "--] (X)");
4b7f6baa
CM
2276 }
2277 else if (aop == 1 && sz == 2 && Z == 0 && W == 0)
2278 {
4b7f6baa 2279 OUTS (outf, dregs (reg));
086134ec 2280 OUTS (outf, " = B[");
4b7f6baa
CM
2281 OUTS (outf, pregs (ptr));
2282 OUTS (outf, "--] (Z)");
4b7f6baa
CM
2283 }
2284 else if (aop == 1 && sz == 2 && Z == 1 && W == 0)
2285 {
4b7f6baa 2286 OUTS (outf, dregs (reg));
086134ec 2287 OUTS (outf, " = B[");
4b7f6baa 2288 OUTS (outf, pregs (ptr));
086134ec 2289 OUTS (outf, "--] (X)");
4b7f6baa
CM
2290 }
2291 else if (aop == 2 && sz == 0 && Z == 0 && W == 0)
2292 {
4b7f6baa 2293 OUTS (outf, dregs (reg));
086134ec 2294 OUTS (outf, " = [");
4b7f6baa
CM
2295 OUTS (outf, pregs (ptr));
2296 OUTS (outf, "]");
4b7f6baa
CM
2297 }
2298 else if (aop == 2 && sz == 0 && Z == 1 && W == 0)
2299 {
4b7f6baa 2300 OUTS (outf, pregs (reg));
086134ec 2301 OUTS (outf, " = [");
4b7f6baa
CM
2302 OUTS (outf, pregs (ptr));
2303 OUTS (outf, "]");
4b7f6baa
CM
2304 }
2305 else if (aop == 2 && sz == 1 && Z == 0 && W == 0)
2306 {
4b7f6baa 2307 OUTS (outf, dregs (reg));
086134ec 2308 OUTS (outf, " = W[");
4b7f6baa
CM
2309 OUTS (outf, pregs (ptr));
2310 OUTS (outf, "] (Z)");
4b7f6baa
CM
2311 }
2312 else if (aop == 2 && sz == 1 && Z == 1 && W == 0)
2313 {
4b7f6baa 2314 OUTS (outf, dregs (reg));
086134ec 2315 OUTS (outf, " = W[");
4b7f6baa 2316 OUTS (outf, pregs (ptr));
086134ec 2317 OUTS (outf, "] (X)");
4b7f6baa
CM
2318 }
2319 else if (aop == 2 && sz == 2 && Z == 0 && W == 0)
2320 {
4b7f6baa 2321 OUTS (outf, dregs (reg));
086134ec 2322 OUTS (outf, " = B[");
4b7f6baa
CM
2323 OUTS (outf, pregs (ptr));
2324 OUTS (outf, "] (Z)");
4b7f6baa
CM
2325 }
2326 else if (aop == 2 && sz == 2 && Z == 1 && W == 0)
2327 {
4b7f6baa 2328 OUTS (outf, dregs (reg));
086134ec 2329 OUTS (outf, " = B[");
4b7f6baa 2330 OUTS (outf, pregs (ptr));
086134ec 2331 OUTS (outf, "] (X)");
4b7f6baa
CM
2332 }
2333 else if (aop == 0 && sz == 0 && Z == 0 && W == 1)
2334 {
4b7f6baa
CM
2335 OUTS (outf, "[");
2336 OUTS (outf, pregs (ptr));
086134ec 2337 OUTS (outf, "++] = ");
4b7f6baa 2338 OUTS (outf, dregs (reg));
4b7f6baa
CM
2339 }
2340 else if (aop == 0 && sz == 0 && Z == 1 && W == 1)
2341 {
4b7f6baa
CM
2342 OUTS (outf, "[");
2343 OUTS (outf, pregs (ptr));
086134ec 2344 OUTS (outf, "++] = ");
4b7f6baa 2345 OUTS (outf, pregs (reg));
4b7f6baa
CM
2346 }
2347 else if (aop == 0 && sz == 1 && Z == 0 && W == 1)
2348 {
4b7f6baa
CM
2349 OUTS (outf, "W[");
2350 OUTS (outf, pregs (ptr));
086134ec 2351 OUTS (outf, "++] = ");
4b7f6baa 2352 OUTS (outf, dregs (reg));
4b7f6baa
CM
2353 }
2354 else if (aop == 0 && sz == 2 && Z == 0 && W == 1)
2355 {
4b7f6baa
CM
2356 OUTS (outf, "B[");
2357 OUTS (outf, pregs (ptr));
086134ec 2358 OUTS (outf, "++] = ");
4b7f6baa 2359 OUTS (outf, dregs (reg));
4b7f6baa
CM
2360 }
2361 else if (aop == 1 && sz == 0 && Z == 0 && W == 1)
2362 {
4b7f6baa
CM
2363 OUTS (outf, "[");
2364 OUTS (outf, pregs (ptr));
086134ec 2365 OUTS (outf, "--] = ");
4b7f6baa 2366 OUTS (outf, dregs (reg));
4b7f6baa
CM
2367 }
2368 else if (aop == 1 && sz == 0 && Z == 1 && W == 1)
2369 {
4b7f6baa
CM
2370 OUTS (outf, "[");
2371 OUTS (outf, pregs (ptr));
086134ec 2372 OUTS (outf, "--] = ");
4b7f6baa 2373 OUTS (outf, pregs (reg));
4b7f6baa
CM
2374 }
2375 else if (aop == 1 && sz == 1 && Z == 0 && W == 1)
2376 {
4b7f6baa
CM
2377 OUTS (outf, "W[");
2378 OUTS (outf, pregs (ptr));
086134ec 2379 OUTS (outf, "--] = ");
4b7f6baa 2380 OUTS (outf, dregs (reg));
4b7f6baa
CM
2381 }
2382 else if (aop == 1 && sz == 2 && Z == 0 && W == 1)
2383 {
4b7f6baa
CM
2384 OUTS (outf, "B[");
2385 OUTS (outf, pregs (ptr));
086134ec 2386 OUTS (outf, "--] = ");
4b7f6baa 2387 OUTS (outf, dregs (reg));
4b7f6baa
CM
2388 }
2389 else if (aop == 2 && sz == 0 && Z == 0 && W == 1)
2390 {
4b7f6baa
CM
2391 OUTS (outf, "[");
2392 OUTS (outf, pregs (ptr));
086134ec 2393 OUTS (outf, "] = ");
4b7f6baa 2394 OUTS (outf, dregs (reg));
4b7f6baa
CM
2395 }
2396 else if (aop == 2 && sz == 0 && Z == 1 && W == 1)
2397 {
4b7f6baa
CM
2398 OUTS (outf, "[");
2399 OUTS (outf, pregs (ptr));
086134ec 2400 OUTS (outf, "] = ");
4b7f6baa 2401 OUTS (outf, pregs (reg));
4b7f6baa
CM
2402 }
2403 else if (aop == 2 && sz == 1 && Z == 0 && W == 1)
2404 {
4b7f6baa
CM
2405 OUTS (outf, "W[");
2406 OUTS (outf, pregs (ptr));
086134ec 2407 OUTS (outf, "] = ");
4b7f6baa 2408 OUTS (outf, dregs (reg));
4b7f6baa
CM
2409 }
2410 else if (aop == 2 && sz == 2 && Z == 0 && W == 1)
2411 {
4b7f6baa
CM
2412 OUTS (outf, "B[");
2413 OUTS (outf, pregs (ptr));
086134ec 2414 OUTS (outf, "] = ");
4b7f6baa 2415 OUTS (outf, dregs (reg));
4b7f6baa
CM
2416 }
2417 else
b7d48530
NC
2418 return 0;
2419
2420 return 2;
4b7f6baa
CM
2421}
2422
2423static int
2424decode_LDSTiiFP_0 (TIword iw0, disassemble_info *outf)
2425{
b7d48530
NC
2426 /* LDSTiiFP
2427 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2428 | 1 | 0 | 1 | 1 | 1 | 0 |.W.|.offset............|.reg...........|
2429 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
2430 int reg = ((iw0 >> LDSTiiFP_reg_bits) & LDSTiiFP_reg_mask);
2431 int offset = ((iw0 >> LDSTiiFP_offset_bits) & LDSTiiFP_offset_mask);
2432 int W = ((iw0 >> LDSTiiFP_W_bits) & LDSTiiFP_W_mask);
2433
2434 if (W == 0)
2435 {
4b7f6baa 2436 OUTS (outf, dpregs (reg));
086134ec 2437 OUTS (outf, " = [FP ");
4b7f6baa
CM
2438 OUTS (outf, negimm5s4 (offset));
2439 OUTS (outf, "]");
4b7f6baa
CM
2440 }
2441 else if (W == 1)
2442 {
086134ec 2443 OUTS (outf, "[FP ");
4b7f6baa 2444 OUTS (outf, negimm5s4 (offset));
086134ec 2445 OUTS (outf, "] = ");
4b7f6baa 2446 OUTS (outf, dpregs (reg));
4b7f6baa
CM
2447 }
2448 else
b7d48530
NC
2449 return 0;
2450
2451 return 2;
4b7f6baa
CM
2452}
2453
2454static int
2455decode_LDSTii_0 (TIword iw0, disassemble_info *outf)
2456{
b7d48530
NC
2457 /* LDSTii
2458 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2459 | 1 | 0 | 1 |.W.|.op....|.offset........|.ptr.......|.reg.......|
2460 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
2461 int reg = ((iw0 >> LDSTii_reg_bit) & LDSTii_reg_mask);
2462 int ptr = ((iw0 >> LDSTii_ptr_bit) & LDSTii_ptr_mask);
2463 int offset = ((iw0 >> LDSTii_offset_bit) & LDSTii_offset_mask);
2464 int op = ((iw0 >> LDSTii_op_bit) & LDSTii_op_mask);
2465 int W = ((iw0 >> LDSTii_W_bit) & LDSTii_W_mask);
2466
2467 if (W == 0 && op == 0)
2468 {
4b7f6baa 2469 OUTS (outf, dregs (reg));
086134ec 2470 OUTS (outf, " = [");
4b7f6baa 2471 OUTS (outf, pregs (ptr));
086134ec 2472 OUTS (outf, " + ");
4b7f6baa
CM
2473 OUTS (outf, uimm4s4 (offset));
2474 OUTS (outf, "]");
4b7f6baa
CM
2475 }
2476 else if (W == 0 && op == 1)
2477 {
4b7f6baa 2478 OUTS (outf, dregs (reg));
086134ec 2479 OUTS (outf, " = W[");
4b7f6baa 2480 OUTS (outf, pregs (ptr));
086134ec 2481 OUTS (outf, " + ");
4b7f6baa
CM
2482 OUTS (outf, uimm4s2 (offset));
2483 OUTS (outf, "] (Z)");
4b7f6baa
CM
2484 }
2485 else if (W == 0 && op == 2)
2486 {
4b7f6baa 2487 OUTS (outf, dregs (reg));
086134ec 2488 OUTS (outf, " = W[");
4b7f6baa 2489 OUTS (outf, pregs (ptr));
086134ec 2490 OUTS (outf, " + ");
4b7f6baa 2491 OUTS (outf, uimm4s2 (offset));
086134ec 2492 OUTS (outf, "] (X)");
4b7f6baa
CM
2493 }
2494 else if (W == 0 && op == 3)
2495 {
4b7f6baa 2496 OUTS (outf, pregs (reg));
086134ec 2497 OUTS (outf, " = [");
4b7f6baa 2498 OUTS (outf, pregs (ptr));
086134ec 2499 OUTS (outf, " + ");
4b7f6baa
CM
2500 OUTS (outf, uimm4s4 (offset));
2501 OUTS (outf, "]");
4b7f6baa
CM
2502 }
2503 else if (W == 1 && op == 0)
2504 {
4b7f6baa
CM
2505 OUTS (outf, "[");
2506 OUTS (outf, pregs (ptr));
086134ec 2507 OUTS (outf, " + ");
4b7f6baa 2508 OUTS (outf, uimm4s4 (offset));
086134ec 2509 OUTS (outf, "] = ");
4b7f6baa 2510 OUTS (outf, dregs (reg));
4b7f6baa
CM
2511 }
2512 else if (W == 1 && op == 1)
2513 {
086134ec 2514 OUTS (outf, "W[");
4b7f6baa 2515 OUTS (outf, pregs (ptr));
086134ec 2516 OUTS (outf, " + ");
4b7f6baa 2517 OUTS (outf, uimm4s2 (offset));
086134ec 2518 OUTS (outf, "] = ");
4b7f6baa 2519 OUTS (outf, dregs (reg));
4b7f6baa
CM
2520 }
2521 else if (W == 1 && op == 3)
2522 {
4b7f6baa
CM
2523 OUTS (outf, "[");
2524 OUTS (outf, pregs (ptr));
086134ec 2525 OUTS (outf, " + ");
4b7f6baa 2526 OUTS (outf, uimm4s4 (offset));
086134ec 2527 OUTS (outf, "] = ");
4b7f6baa 2528 OUTS (outf, pregs (reg));
4b7f6baa
CM
2529 }
2530 else
b7d48530
NC
2531 return 0;
2532
2533 return 2;
4b7f6baa
CM
2534}
2535
2536static int
2537decode_LoopSetup_0 (TIword iw0, TIword iw1, bfd_vma pc, disassemble_info *outf)
2538{
b7d48530
NC
2539 /* LoopSetup
2540 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2541 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 |.rop...|.c.|.soffset.......|
2542 |.reg...........| - | - |.eoffset...............................|
2543 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
2544 int c = ((iw0 >> (LoopSetup_c_bits - 16)) & LoopSetup_c_mask);
2545 int reg = ((iw1 >> LoopSetup_reg_bits) & LoopSetup_reg_mask);
2546 int rop = ((iw0 >> (LoopSetup_rop_bits - 16)) & LoopSetup_rop_mask);
2547 int soffset = ((iw0 >> (LoopSetup_soffset_bits - 16)) & LoopSetup_soffset_mask);
2548 int eoffset = ((iw1 >> LoopSetup_eoffset_bits) & LoopSetup_eoffset_mask);
2549
2550 if (rop == 0)
2551 {
4b7f6baa 2552 OUTS (outf, "LSETUP");
086134ec 2553 OUTS (outf, "(0x");
4b7f6baa 2554 OUTS (outf, pcrel4 (soffset));
086134ec 2555 OUTS (outf, ", 0x");
4b7f6baa 2556 OUTS (outf, lppcrel10 (eoffset));
086134ec 2557 OUTS (outf, ") ");
4b7f6baa 2558 OUTS (outf, counters (c));
4b7f6baa
CM
2559 }
2560 else if (rop == 1)
2561 {
4b7f6baa 2562 OUTS (outf, "LSETUP");
086134ec 2563 OUTS (outf, "(0x");
4b7f6baa 2564 OUTS (outf, pcrel4 (soffset));
086134ec 2565 OUTS (outf, ", 0x");
4b7f6baa 2566 OUTS (outf, lppcrel10 (eoffset));
086134ec 2567 OUTS (outf, ") ");
4b7f6baa 2568 OUTS (outf, counters (c));
086134ec 2569 OUTS (outf, " = ");
4b7f6baa 2570 OUTS (outf, pregs (reg));
4b7f6baa
CM
2571 }
2572 else if (rop == 3)
2573 {
4b7f6baa 2574 OUTS (outf, "LSETUP");
086134ec 2575 OUTS (outf, "(0x");
4b7f6baa 2576 OUTS (outf, pcrel4 (soffset));
086134ec 2577 OUTS (outf, ", 0x");
4b7f6baa 2578 OUTS (outf, lppcrel10 (eoffset));
086134ec 2579 OUTS (outf, ") ");
4b7f6baa 2580 OUTS (outf, counters (c));
086134ec 2581 OUTS (outf, " = ");
4b7f6baa 2582 OUTS (outf, pregs (reg));
086134ec 2583 OUTS (outf, " >> 0x1");
4b7f6baa
CM
2584 }
2585 else
b7d48530
NC
2586 return 0;
2587
2588 return 4;
4b7f6baa
CM
2589}
2590
2591static int
2592decode_LDIMMhalf_0 (TIword iw0, TIword iw1, disassemble_info *outf)
2593{
b7d48530
NC
2594 /* LDIMMhalf
2595 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2596 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 1 |.Z.|.H.|.S.|.grp...|.reg.......|
2597 |.hword.........................................................|
2598 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
2599 int H = ((iw0 >> (LDIMMhalf_H_bits - 16)) & LDIMMhalf_H_mask);
2600 int Z = ((iw0 >> (LDIMMhalf_Z_bits - 16)) & LDIMMhalf_Z_mask);
2601 int S = ((iw0 >> (LDIMMhalf_S_bits - 16)) & LDIMMhalf_S_mask);
2602 int reg = ((iw0 >> (LDIMMhalf_reg_bits - 16)) & LDIMMhalf_reg_mask);
2603 int grp = ((iw0 >> (LDIMMhalf_grp_bits - 16)) & LDIMMhalf_grp_mask);
2604 int hword = ((iw1 >> LDIMMhalf_hword_bits) & LDIMMhalf_hword_mask);
2605
b21c9cb4
BS
2606 bu32 *pval = get_allreg (grp, reg);
2607
2608 /* Since we don't have 32-bit immediate loads, we allow the disassembler
2609 to combine them, so it prints out the right values.
2610 Here we keep track of the registers. */
2611 if (H == 0 && S == 1 && Z == 0)
2612 {
2613 /* regs = imm16 (x) */
2614 *pval = imm16_val (hword);
086134ec
BS
2615 if (hword & 0x8000)
2616 *pval |= 0xFFFF0000;
2617 else
2618 *pval &= 0xFFFF;
b21c9cb4
BS
2619 }
2620 else if (H == 0 && S == 0 && Z == 1)
2621 {
2622 /* regs = luimm16 (Z) */
2623 *pval = luimm16_val (hword);
086134ec 2624 *pval &= 0xFFFF;
b21c9cb4
BS
2625 }
2626 else if (H == 0 && S == 0 && Z == 0)
2627 {
2628 /* regs_lo = luimm16 */
2629 *pval &= 0xFFFF0000;
2630 *pval |= luimm16_val (hword);
2631 }
2632 else if (H == 1 && S == 0 && Z == 0)
2633 {
2634 /* regs_hi = huimm16 */
2635 *pval &= 0xFFFF;
2636 *pval |= luimm16_val (hword) << 16;
2637 }
2638
2639 /* Here we do the disassembly */
4b7f6baa
CM
2640 if (grp == 0 && H == 0 && S == 0 && Z == 0)
2641 {
4b7f6baa 2642 OUTS (outf, dregs_lo (reg));
086134ec
BS
2643 OUTS (outf, " = ");
2644 OUTS (outf, uimm16 (hword));
4b7f6baa
CM
2645 }
2646 else if (grp == 0 && H == 1 && S == 0 && Z == 0)
2647 {
4b7f6baa 2648 OUTS (outf, dregs_hi (reg));
086134ec
BS
2649 OUTS (outf, " = ");
2650 OUTS (outf, uimm16 (hword));
4b7f6baa
CM
2651 }
2652 else if (grp == 0 && H == 0 && S == 1 && Z == 0)
2653 {
4b7f6baa 2654 OUTS (outf, dregs (reg));
086134ec 2655 OUTS (outf, " = ");
4b7f6baa
CM
2656 OUTS (outf, imm16 (hword));
2657 OUTS (outf, " (X)");
4b7f6baa
CM
2658 }
2659 else if (H == 0 && S == 1 && Z == 0)
086134ec 2660 {
4b7f6baa 2661 OUTS (outf, regs (reg, grp));
086134ec 2662 OUTS (outf, " = ");
4b7f6baa
CM
2663 OUTS (outf, imm16 (hword));
2664 OUTS (outf, " (X)");
4b7f6baa
CM
2665 }
2666 else if (H == 0 && S == 0 && Z == 1)
2667 {
4b7f6baa 2668 OUTS (outf, regs (reg, grp));
086134ec
BS
2669 OUTS (outf, " = ");
2670 OUTS (outf, uimm16 (hword));
2671 OUTS (outf, " (Z)");
4b7f6baa
CM
2672 }
2673 else if (H == 0 && S == 0 && Z == 0)
2674 {
4b7f6baa 2675 OUTS (outf, regs_lo (reg, grp));
086134ec 2676 OUTS (outf, " = ");
b21c9cb4 2677 OUTS (outf, uimm16 (hword));
4b7f6baa
CM
2678 }
2679 else if (H == 1 && S == 0 && Z == 0)
2680 {
4b7f6baa 2681 OUTS (outf, regs_hi (reg, grp));
086134ec 2682 OUTS (outf, " = ");
b21c9cb4 2683 OUTS (outf, uimm16 (hword));
4b7f6baa
CM
2684 }
2685 else
b7d48530
NC
2686 return 0;
2687
b21c9cb4 2688 /* And we print out the 32-bit value if it is a pointer. */
086134ec 2689 if (S == 0 && Z == 0)
b21c9cb4 2690 {
086134ec
BS
2691 OUTS (outf, ";\t\t/* (");
2692 OUTS (outf, imm16d (hword));
2693 OUTS (outf, ")\t");
2694
b21c9cb4 2695 /* If it is an MMR, don't print the symbol. */
086134ec
BS
2696 if (*pval < 0xFFC00000 && grp == 1)
2697 {
2698 OUTS (outf, regs (reg, grp));
2699 OUTS (outf, "=0x");
2700 OUTS (outf, huimm32e (*pval));
2701 }
b21c9cb4 2702 else
086134ec
BS
2703 {
2704 OUTS (outf, regs (reg, grp));
2705 OUTS (outf, "=0x");
2706 OUTS (outf, huimm32e (*pval));
2707 OUTS (outf, "(");
2708 OUTS (outf, imm32 (*pval));
2709 OUTS (outf, ")");
2710 }
b21c9cb4
BS
2711
2712 OUTS (outf, " */");
086134ec
BS
2713 comment = 1;
2714 }
2715 if (S == 1 || Z == 1)
2716 {
2717 OUTS (outf, ";\t\t/*\t\t");
2718 OUTS (outf, regs (reg, grp));
2719 OUTS (outf, "=0x");
2720 OUTS (outf, huimm32e (*pval));
2721 OUTS (outf, "(");
2722 OUTS (outf, imm32 (*pval));
2723 OUTS (outf, ") */");
2724 comment = 1;
b21c9cb4 2725 }
b7d48530 2726 return 4;
4b7f6baa
CM
2727}
2728
2729static int
2730decode_CALLa_0 (TIword iw0, TIword iw1, bfd_vma pc, disassemble_info *outf)
2731{
b7d48530
NC
2732 /* CALLa
2733 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2734 | 1 | 1 | 1 | 0 | 0 | 0 | 1 |.S.|.msw...........................|
2735 |.lsw...........................................................|
2736 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
2737 int S = ((iw0 >> (CALLa_S_bits - 16)) & CALLa_S_mask);
2738 int lsw = ((iw1 >> 0) & 0xffff);
2739 int msw = ((iw0 >> 0) & 0xff);
2740
2741 if (S == 1)
086134ec 2742 OUTS (outf, "CALL 0x");
4b7f6baa 2743 else if (S == 0)
086134ec 2744 OUTS (outf, "JUMP.L 0x");
4b7f6baa 2745 else
b7d48530
NC
2746 return 0;
2747
2748 OUTS (outf, pcrel24 (((msw) << 16) | (lsw)));
2749 return 4;
4b7f6baa
CM
2750}
2751
2752static int
2753decode_LDSTidxI_0 (TIword iw0, TIword iw1, disassemble_info *outf)
2754{
b7d48530
NC
2755 /* LDSTidxI
2756 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2757 | 1 | 1 | 1 | 0 | 0 | 1 |.W.|.Z.|.sz....|.ptr.......|.reg.......|
2758 |.offset........................................................|
2759 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
2760 int Z = ((iw0 >> (LDSTidxI_Z_bits - 16)) & LDSTidxI_Z_mask);
2761 int W = ((iw0 >> (LDSTidxI_W_bits - 16)) & LDSTidxI_W_mask);
2762 int sz = ((iw0 >> (LDSTidxI_sz_bits - 16)) & LDSTidxI_sz_mask);
2763 int reg = ((iw0 >> (LDSTidxI_reg_bits - 16)) & LDSTidxI_reg_mask);
2764 int ptr = ((iw0 >> (LDSTidxI_ptr_bits - 16)) & LDSTidxI_ptr_mask);
2765 int offset = ((iw1 >> LDSTidxI_offset_bits) & LDSTidxI_offset_mask);
2766
2767 if (W == 0 && sz == 0 && Z == 0)
2768 {
4b7f6baa 2769 OUTS (outf, dregs (reg));
086134ec 2770 OUTS (outf, " = [");
4b7f6baa 2771 OUTS (outf, pregs (ptr));
086134ec 2772 OUTS (outf, " + ");
4b7f6baa
CM
2773 OUTS (outf, imm16s4 (offset));
2774 OUTS (outf, "]");
4b7f6baa
CM
2775 }
2776 else if (W == 0 && sz == 0 && Z == 1)
2777 {
4b7f6baa 2778 OUTS (outf, pregs (reg));
086134ec 2779 OUTS (outf, " = [");
4b7f6baa 2780 OUTS (outf, pregs (ptr));
086134ec 2781 OUTS (outf, " + ");
4b7f6baa
CM
2782 OUTS (outf, imm16s4 (offset));
2783 OUTS (outf, "]");
4b7f6baa
CM
2784 }
2785 else if (W == 0 && sz == 1 && Z == 0)
2786 {
4b7f6baa 2787 OUTS (outf, dregs (reg));
086134ec 2788 OUTS (outf, " = W[");
4b7f6baa 2789 OUTS (outf, pregs (ptr));
086134ec 2790 OUTS (outf, " + ");
4b7f6baa
CM
2791 OUTS (outf, imm16s2 (offset));
2792 OUTS (outf, "] (Z)");
4b7f6baa
CM
2793 }
2794 else if (W == 0 && sz == 1 && Z == 1)
2795 {
4b7f6baa 2796 OUTS (outf, dregs (reg));
086134ec 2797 OUTS (outf, " = W[");
4b7f6baa 2798 OUTS (outf, pregs (ptr));
086134ec 2799 OUTS (outf, " + ");
4b7f6baa 2800 OUTS (outf, imm16s2 (offset));
086134ec 2801 OUTS (outf, "] (X)");
4b7f6baa
CM
2802 }
2803 else if (W == 0 && sz == 2 && Z == 0)
2804 {
4b7f6baa 2805 OUTS (outf, dregs (reg));
086134ec 2806 OUTS (outf, " = B[");
4b7f6baa 2807 OUTS (outf, pregs (ptr));
086134ec 2808 OUTS (outf, " + ");
4b7f6baa
CM
2809 OUTS (outf, imm16 (offset));
2810 OUTS (outf, "] (Z)");
4b7f6baa
CM
2811 }
2812 else if (W == 0 && sz == 2 && Z == 1)
2813 {
4b7f6baa 2814 OUTS (outf, dregs (reg));
086134ec 2815 OUTS (outf, " = B[");
4b7f6baa 2816 OUTS (outf, pregs (ptr));
086134ec 2817 OUTS (outf, " + ");
4b7f6baa 2818 OUTS (outf, imm16 (offset));
086134ec 2819 OUTS (outf, "] (X)");
4b7f6baa
CM
2820 }
2821 else if (W == 1 && sz == 0 && Z == 0)
2822 {
4b7f6baa
CM
2823 OUTS (outf, "[");
2824 OUTS (outf, pregs (ptr));
086134ec 2825 OUTS (outf, " + ");
4b7f6baa 2826 OUTS (outf, imm16s4 (offset));
086134ec 2827 OUTS (outf, "] = ");
4b7f6baa 2828 OUTS (outf, dregs (reg));
4b7f6baa
CM
2829 }
2830 else if (W == 1 && sz == 0 && Z == 1)
2831 {
4b7f6baa
CM
2832 OUTS (outf, "[");
2833 OUTS (outf, pregs (ptr));
086134ec 2834 OUTS (outf, " + ");
4b7f6baa 2835 OUTS (outf, imm16s4 (offset));
086134ec 2836 OUTS (outf, "] = ");
4b7f6baa 2837 OUTS (outf, pregs (reg));
4b7f6baa
CM
2838 }
2839 else if (W == 1 && sz == 1 && Z == 0)
2840 {
4b7f6baa
CM
2841 OUTS (outf, "W[");
2842 OUTS (outf, pregs (ptr));
086134ec 2843 OUTS (outf, " + ");
4b7f6baa 2844 OUTS (outf, imm16s2 (offset));
086134ec 2845 OUTS (outf, "] = ");
4b7f6baa 2846 OUTS (outf, dregs (reg));
4b7f6baa
CM
2847 }
2848 else if (W == 1 && sz == 2 && Z == 0)
2849 {
4b7f6baa
CM
2850 OUTS (outf, "B[");
2851 OUTS (outf, pregs (ptr));
086134ec 2852 OUTS (outf, " + ");
4b7f6baa 2853 OUTS (outf, imm16 (offset));
086134ec 2854 OUTS (outf, "] = ");
4b7f6baa 2855 OUTS (outf, dregs (reg));
4b7f6baa
CM
2856 }
2857 else
b7d48530
NC
2858 return 0;
2859
2860 return 4;
4b7f6baa
CM
2861}
2862
2863static int
2864decode_linkage_0 (TIword iw0, TIword iw1, disassemble_info *outf)
2865{
b7d48530
NC
2866 /* linkage
2867 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2868 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |.R.|
2869 |.framesize.....................................................|
2870 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
2871 int R = ((iw0 >> (Linkage_R_bits - 16)) & Linkage_R_mask);
2872 int framesize = ((iw1 >> Linkage_framesize_bits) & Linkage_framesize_mask);
2873
2874 if (R == 0)
2875 {
4b7f6baa
CM
2876 OUTS (outf, "LINK ");
2877 OUTS (outf, uimm16s4 (framesize));
086134ec
BS
2878 OUTS (outf, ";\t\t/* (");
2879 OUTS (outf, uimm16s4d (framesize));
2880 OUTS (outf, ") */");
2881 comment = 1;
4b7f6baa
CM
2882 }
2883 else if (R == 1)
b7d48530 2884 OUTS (outf, "UNLINK");
4b7f6baa 2885 else
b7d48530
NC
2886 return 0;
2887
2888 return 4;
4b7f6baa
CM
2889}
2890
2891static int
2892decode_dsp32mac_0 (TIword iw0, TIword iw1, disassemble_info *outf)
2893{
b7d48530
NC
2894 /* dsp32mac
2895 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2896 | 1 | 1 | 0 | 0 |.M.| 0 | 0 |.mmod..........|.MM|.P.|.w1|.op1...|
2897 |.h01|.h11|.w0|.op0...|.h00|.h10|.dst.......|.src0......|.src1..|
2898 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2899 int op1 = ((iw0 >> (DSP32Mac_op1_bits - 16)) & DSP32Mac_op1_mask);
2900 int w1 = ((iw0 >> (DSP32Mac_w1_bits - 16)) & DSP32Mac_w1_mask);
2901 int P = ((iw0 >> (DSP32Mac_p_bits - 16)) & DSP32Mac_p_mask);
2902 int MM = ((iw0 >> (DSP32Mac_MM_bits - 16)) & DSP32Mac_MM_mask);
4b7f6baa 2903 int mmod = ((iw0 >> (DSP32Mac_mmod_bits - 16)) & DSP32Mac_mmod_mask);
b7d48530 2904 int w0 = ((iw1 >> DSP32Mac_w0_bits) & DSP32Mac_w0_mask);
4b7f6baa
CM
2905 int src0 = ((iw1 >> DSP32Mac_src0_bits) & DSP32Mac_src0_mask);
2906 int src1 = ((iw1 >> DSP32Mac_src1_bits) & DSP32Mac_src1_mask);
b7d48530
NC
2907 int dst = ((iw1 >> DSP32Mac_dst_bits) & DSP32Mac_dst_mask);
2908 int h10 = ((iw1 >> DSP32Mac_h10_bits) & DSP32Mac_h10_mask);
2909 int h00 = ((iw1 >> DSP32Mac_h00_bits) & DSP32Mac_h00_mask);
2910 int op0 = ((iw1 >> DSP32Mac_op0_bits) & DSP32Mac_op0_mask);
2911 int h11 = ((iw1 >> DSP32Mac_h11_bits) & DSP32Mac_h11_mask);
2912 int h01 = ((iw1 >> DSP32Mac_h01_bits) & DSP32Mac_h01_mask);
4b7f6baa
CM
2913
2914 if (w0 == 0 && w1 == 0 && op1 == 3 && op0 == 3)
2915 return 0;
2916
2917 if (op1 == 3 && MM)
2918 return 0;
2919
2920 if ((w1 || w0) && mmod == M_W32)
2921 return 0;
2922
ee171c8f 2923 if (((1 << mmod) & (P ? 0x131b : 0x1b5f)) == 0)
4b7f6baa
CM
2924 return 0;
2925
2926 if (w1 == 1 || op1 != 3)
2927 {
2928 if (w1)
2929 OUTS (outf, P ? dregs (dst + 1) : dregs_hi (dst));
2930
2931 if (op1 == 3)
2932 OUTS (outf, " = A1");
2933 else
2934 {
2935 if (w1)
2936 OUTS (outf, " = (");
2937 decode_macfunc (1, op1, h01, h11, src0, src1, outf);
2938 if (w1)
2939 OUTS (outf, ")");
2940 }
2941
2942 if (w0 == 1 || op0 != 3)
2943 {
2944 if (MM)
2945 OUTS (outf, " (M)");
2946 MM = 0;
2947 OUTS (outf, ", ");
2948 }
2949 }
2950
2951 if (w0 == 1 || op0 != 3)
2952 {
2953 if (w0)
2954 OUTS (outf, P ? dregs (dst) : dregs_lo (dst));
2955
2956 if (op0 == 3)
2957 OUTS (outf, " = A0");
2958 else
2959 {
2960 if (w0)
2961 OUTS (outf, " = (");
2962 decode_macfunc (0, op0, h00, h10, src0, src1, outf);
2963 if (w0)
2964 OUTS (outf, ")");
2965 }
2966 }
2967
2968 decode_optmode (mmod, MM, outf);
2969
2970 return 4;
2971}
2972
2973static int
2974decode_dsp32mult_0 (TIword iw0, TIword iw1, disassemble_info *outf)
2975{
b7d48530
NC
2976 /* dsp32mult
2977 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2978 | 1 | 1 | 0 | 0 |.M.| 0 | 1 |.mmod..........|.MM|.P.|.w1|.op1...|
2979 |.h01|.h11|.w0|.op0...|.h00|.h10|.dst.......|.src0......|.src1..|
2980 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
2981 int w1 = ((iw0 >> (DSP32Mac_w1_bits - 16)) & DSP32Mac_w1_mask);
2982 int P = ((iw0 >> (DSP32Mac_p_bits - 16)) & DSP32Mac_p_mask);
2983 int MM = ((iw0 >> (DSP32Mac_MM_bits - 16)) & DSP32Mac_MM_mask);
4b7f6baa 2984 int mmod = ((iw0 >> (DSP32Mac_mmod_bits - 16)) & DSP32Mac_mmod_mask);
b7d48530 2985 int w0 = ((iw1 >> DSP32Mac_w0_bits) & DSP32Mac_w0_mask);
4b7f6baa
CM
2986 int src0 = ((iw1 >> DSP32Mac_src0_bits) & DSP32Mac_src0_mask);
2987 int src1 = ((iw1 >> DSP32Mac_src1_bits) & DSP32Mac_src1_mask);
b7d48530
NC
2988 int dst = ((iw1 >> DSP32Mac_dst_bits) & DSP32Mac_dst_mask);
2989 int h10 = ((iw1 >> DSP32Mac_h10_bits) & DSP32Mac_h10_mask);
2990 int h00 = ((iw1 >> DSP32Mac_h00_bits) & DSP32Mac_h00_mask);
2991 int h11 = ((iw1 >> DSP32Mac_h11_bits) & DSP32Mac_h11_mask);
2992 int h01 = ((iw1 >> DSP32Mac_h01_bits) & DSP32Mac_h01_mask);
4b7f6baa
CM
2993
2994 if (w1 == 0 && w0 == 0)
2995 return 0;
b7d48530 2996
4b7f6baa
CM
2997 if (((1 << mmod) & (P ? 0x313 : 0x1b57)) == 0)
2998 return 0;
b7d48530 2999
4b7f6baa
CM
3000 if (w1)
3001 {
3002 OUTS (outf, P ? dregs (dst | 1) : dregs_hi (dst));
3003 OUTS (outf, " = ");
3004 decode_multfunc (h01, h11, src0, src1, outf);
3005
3006 if (w0)
3007 {
3008 if (MM)
3009 OUTS (outf, " (M)");
3010 MM = 0;
3011 OUTS (outf, ", ");
3012 }
3013 }
3014
3015 if (w0)
3016 {
3017 OUTS (outf, dregs (dst));
3018 OUTS (outf, " = ");
3019 decode_multfunc (h00, h10, src0, src1, outf);
3020 }
3021
3022 decode_optmode (mmod, MM, outf);
3023 return 4;
3024}
3025
3026static int
3027decode_dsp32alu_0 (TIword iw0, TIword iw1, disassemble_info *outf)
3028{
b7d48530
NC
3029 /* dsp32alu
3030 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
3031 | 1 | 1 | 0 | 0 |.M.| 1 | 0 | - | - | - |.HL|.aopcde............|
3032 |.aop...|.s.|.x.|.dst0......|.dst1......|.src0......|.src1......|
3033 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
3034 int s = ((iw1 >> DSP32Alu_s_bits) & DSP32Alu_s_mask);
3035 int x = ((iw1 >> DSP32Alu_x_bits) & DSP32Alu_x_mask);
3036 int aop = ((iw1 >> DSP32Alu_aop_bits) & DSP32Alu_aop_mask);
3037 int src0 = ((iw1 >> DSP32Alu_src0_bits) & DSP32Alu_src0_mask);
3038 int src1 = ((iw1 >> DSP32Alu_src1_bits) & DSP32Alu_src1_mask);
3039 int dst0 = ((iw1 >> DSP32Alu_dst0_bits) & DSP32Alu_dst0_mask);
3040 int dst1 = ((iw1 >> DSP32Alu_dst1_bits) & DSP32Alu_dst1_mask);
3041 int HL = ((iw0 >> (DSP32Alu_HL_bits - 16)) & DSP32Alu_HL_mask);
3042 int aopcde = ((iw0 >> (DSP32Alu_aopcde_bits - 16)) & DSP32Alu_aopcde_mask);
3043
3044 if (aop == 0 && aopcde == 9 && HL == 0 && s == 0)
3045 {
086134ec 3046 OUTS (outf, "A0.L = ");
4b7f6baa 3047 OUTS (outf, dregs_lo (src0));
4b7f6baa
CM
3048 }
3049 else if (aop == 2 && aopcde == 9 && HL == 1 && s == 0)
3050 {
086134ec 3051 OUTS (outf, "A1.H = ");
4b7f6baa 3052 OUTS (outf, dregs_hi (src0));
4b7f6baa
CM
3053 }
3054 else if (aop == 2 && aopcde == 9 && HL == 0 && s == 0)
3055 {
086134ec 3056 OUTS (outf, "A1.L = ");
4b7f6baa 3057 OUTS (outf, dregs_lo (src0));
4b7f6baa
CM
3058 }
3059 else if (aop == 0 && aopcde == 9 && HL == 1 && s == 0)
3060 {
086134ec 3061 OUTS (outf, "A0.H = ");
4b7f6baa 3062 OUTS (outf, dregs_hi (src0));
4b7f6baa
CM
3063 }
3064 else if (x == 1 && HL == 1 && aop == 3 && aopcde == 5)
3065 {
4b7f6baa 3066 OUTS (outf, dregs_hi (dst0));
086134ec 3067 OUTS (outf, " = ");
4b7f6baa 3068 OUTS (outf, dregs (src0));
086134ec 3069 OUTS (outf, " - ");
4b7f6baa 3070 OUTS (outf, dregs (src1));
086134ec 3071 OUTS (outf, " (RND20)");
4b7f6baa
CM
3072 }
3073 else if (x == 1 && HL == 1 && aop == 2 && aopcde == 5)
3074 {
4b7f6baa 3075 OUTS (outf, dregs_hi (dst0));
086134ec 3076 OUTS (outf, " = ");
4b7f6baa 3077 OUTS (outf, dregs (src0));
086134ec 3078 OUTS (outf, " + ");
4b7f6baa 3079 OUTS (outf, dregs (src1));
086134ec 3080 OUTS (outf, " (RND20)");
4b7f6baa
CM
3081 }
3082 else if (x == 0 && HL == 0 && aop == 1 && aopcde == 5)
3083 {
4b7f6baa 3084 OUTS (outf, dregs_lo (dst0));
086134ec 3085 OUTS (outf, " = ");
4b7f6baa 3086 OUTS (outf, dregs (src0));
086134ec 3087 OUTS (outf, " - ");
4b7f6baa 3088 OUTS (outf, dregs (src1));
086134ec 3089 OUTS (outf, " (RND12)");
4b7f6baa
CM
3090 }
3091 else if (x == 0 && HL == 0 && aop == 0 && aopcde == 5)
3092 {
4b7f6baa 3093 OUTS (outf, dregs_lo (dst0));
086134ec 3094 OUTS (outf, " = ");
4b7f6baa 3095 OUTS (outf, dregs (src0));
086134ec 3096 OUTS (outf, " + ");
4b7f6baa 3097 OUTS (outf, dregs (src1));
086134ec 3098 OUTS (outf, " (RND12)");
4b7f6baa
CM
3099 }
3100 else if (x == 1 && HL == 0 && aop == 3 && aopcde == 5)
3101 {
4b7f6baa 3102 OUTS (outf, dregs_lo (dst0));
086134ec 3103 OUTS (outf, " = ");
4b7f6baa 3104 OUTS (outf, dregs (src0));
086134ec 3105 OUTS (outf, " - ");
4b7f6baa 3106 OUTS (outf, dregs (src1));
086134ec 3107 OUTS (outf, " (RND20)");
4b7f6baa
CM
3108 }
3109 else if (x == 0 && HL == 1 && aop == 0 && aopcde == 5)
3110 {
4b7f6baa 3111 OUTS (outf, dregs_hi (dst0));
086134ec 3112 OUTS (outf, " = ");
4b7f6baa 3113 OUTS (outf, dregs (src0));
086134ec 3114 OUTS (outf, " + ");
4b7f6baa 3115 OUTS (outf, dregs (src1));
086134ec 3116 OUTS (outf, " (RND12)");
4b7f6baa
CM
3117 }
3118 else if (x == 1 && HL == 0 && aop == 2 && aopcde == 5)
3119 {
4b7f6baa 3120 OUTS (outf, dregs_lo (dst0));
086134ec 3121 OUTS (outf, " = ");
4b7f6baa 3122 OUTS (outf, dregs (src0));
086134ec 3123 OUTS (outf, " + ");
4b7f6baa 3124 OUTS (outf, dregs (src1));
086134ec 3125 OUTS (outf, " (RND20)");
4b7f6baa
CM
3126 }
3127 else if (x == 0 && HL == 1 && aop == 1 && aopcde == 5)
3128 {
4b7f6baa 3129 OUTS (outf, dregs_hi (dst0));
086134ec 3130 OUTS (outf, " = ");
4b7f6baa 3131 OUTS (outf, dregs (src0));
086134ec 3132 OUTS (outf, " - ");
4b7f6baa 3133 OUTS (outf, dregs (src1));
086134ec 3134 OUTS (outf, " (RND12)");
4b7f6baa
CM
3135 }
3136 else if (HL == 1 && aop == 0 && aopcde == 2)
3137 {
4b7f6baa 3138 OUTS (outf, dregs_hi (dst0));
086134ec 3139 OUTS (outf, " = ");
4b7f6baa 3140 OUTS (outf, dregs_lo (src0));
086134ec 3141 OUTS (outf, " + ");
4b7f6baa 3142 OUTS (outf, dregs_lo (src1));
4b7f6baa 3143 amod1 (s, x, outf);
4b7f6baa
CM
3144 }
3145 else if (HL == 1 && aop == 1 && aopcde == 2)
3146 {
4b7f6baa 3147 OUTS (outf, dregs_hi (dst0));
086134ec 3148 OUTS (outf, " = ");
4b7f6baa 3149 OUTS (outf, dregs_lo (src0));
086134ec 3150 OUTS (outf, " + ");
4b7f6baa 3151 OUTS (outf, dregs_hi (src1));
4b7f6baa 3152 amod1 (s, x, outf);
4b7f6baa
CM
3153 }
3154 else if (HL == 1 && aop == 2 && aopcde == 2)
3155 {
4b7f6baa 3156 OUTS (outf, dregs_hi (dst0));
086134ec 3157 OUTS (outf, " = ");
4b7f6baa 3158 OUTS (outf, dregs_hi (src0));
086134ec 3159 OUTS (outf, " + ");
4b7f6baa 3160 OUTS (outf, dregs_lo (src1));
4b7f6baa 3161 amod1 (s, x, outf);
4b7f6baa
CM
3162 }
3163 else if (HL == 1 && aop == 3 && aopcde == 2)
3164 {
4b7f6baa 3165 OUTS (outf, dregs_hi (dst0));
086134ec 3166 OUTS (outf, " = ");
4b7f6baa 3167 OUTS (outf, dregs_hi (src0));
086134ec 3168 OUTS (outf, " + ");
4b7f6baa 3169 OUTS (outf, dregs_hi (src1));
4b7f6baa 3170 amod1 (s, x, outf);
4b7f6baa
CM
3171 }
3172 else if (HL == 0 && aop == 0 && aopcde == 3)
3173 {
4b7f6baa 3174 OUTS (outf, dregs_lo (dst0));
086134ec 3175 OUTS (outf, " = ");
4b7f6baa 3176 OUTS (outf, dregs_lo (src0));
086134ec 3177 OUTS (outf, " - ");
4b7f6baa 3178 OUTS (outf, dregs_lo (src1));
4b7f6baa 3179 amod1 (s, x, outf);
4b7f6baa
CM
3180 }
3181 else if (HL == 0 && aop == 1 && aopcde == 3)
3182 {
4b7f6baa 3183 OUTS (outf, dregs_lo (dst0));
086134ec 3184 OUTS (outf, " = ");
4b7f6baa 3185 OUTS (outf, dregs_lo (src0));
086134ec 3186 OUTS (outf, " - ");
4b7f6baa 3187 OUTS (outf, dregs_hi (src1));
4b7f6baa 3188 amod1 (s, x, outf);
4b7f6baa
CM
3189 }
3190 else if (HL == 0 && aop == 3 && aopcde == 2)
3191 {
4b7f6baa 3192 OUTS (outf, dregs_lo (dst0));
086134ec 3193 OUTS (outf, " = ");
4b7f6baa 3194 OUTS (outf, dregs_hi (src0));
086134ec 3195 OUTS (outf, " + ");
4b7f6baa 3196 OUTS (outf, dregs_hi (src1));
4b7f6baa 3197 amod1 (s, x, outf);
4b7f6baa
CM
3198 }
3199 else if (HL == 1 && aop == 0 && aopcde == 3)
3200 {
4b7f6baa 3201 OUTS (outf, dregs_hi (dst0));
086134ec 3202 OUTS (outf, " = ");
4b7f6baa 3203 OUTS (outf, dregs_lo (src0));
086134ec 3204 OUTS (outf, " - ");
4b7f6baa 3205 OUTS (outf, dregs_lo (src1));
4b7f6baa 3206 amod1 (s, x, outf);
4b7f6baa
CM
3207 }
3208 else if (HL == 1 && aop == 1 && aopcde == 3)
3209 {
4b7f6baa 3210 OUTS (outf, dregs_hi (dst0));
086134ec 3211 OUTS (outf, " = ");
4b7f6baa 3212 OUTS (outf, dregs_lo (src0));
086134ec 3213 OUTS (outf, " - ");
4b7f6baa 3214 OUTS (outf, dregs_hi (src1));
4b7f6baa 3215 amod1 (s, x, outf);
4b7f6baa
CM
3216 }
3217 else if (HL == 1 && aop == 2 && aopcde == 3)
3218 {
4b7f6baa 3219 OUTS (outf, dregs_hi (dst0));
086134ec 3220 OUTS (outf, " = ");
4b7f6baa 3221 OUTS (outf, dregs_hi (src0));
086134ec 3222 OUTS (outf, " - ");
4b7f6baa 3223 OUTS (outf, dregs_lo (src1));
4b7f6baa 3224 amod1 (s, x, outf);
4b7f6baa
CM
3225 }
3226 else if (HL == 1 && aop == 3 && aopcde == 3)
3227 {
4b7f6baa 3228 OUTS (outf, dregs_hi (dst0));
086134ec 3229 OUTS (outf, " = ");
4b7f6baa 3230 OUTS (outf, dregs_hi (src0));
086134ec 3231 OUTS (outf, " - ");
4b7f6baa 3232 OUTS (outf, dregs_hi (src1));
4b7f6baa 3233 amod1 (s, x, outf);
4b7f6baa
CM
3234 }
3235 else if (HL == 0 && aop == 2 && aopcde == 2)
3236 {
4b7f6baa 3237 OUTS (outf, dregs_lo (dst0));
086134ec 3238 OUTS (outf, " = ");
4b7f6baa 3239 OUTS (outf, dregs_hi (src0));
086134ec 3240 OUTS (outf, " + ");
4b7f6baa 3241 OUTS (outf, dregs_lo (src1));
4b7f6baa 3242 amod1 (s, x, outf);
4b7f6baa
CM
3243 }
3244 else if (HL == 0 && aop == 1 && aopcde == 2)
3245 {
4b7f6baa 3246 OUTS (outf, dregs_lo (dst0));
086134ec 3247 OUTS (outf, " = ");
4b7f6baa 3248 OUTS (outf, dregs_lo (src0));
086134ec 3249 OUTS (outf, " + ");
4b7f6baa 3250 OUTS (outf, dregs_hi (src1));
4b7f6baa 3251 amod1 (s, x, outf);
4b7f6baa
CM
3252 }
3253 else if (HL == 0 && aop == 2 && aopcde == 3)
3254 {
4b7f6baa 3255 OUTS (outf, dregs_lo (dst0));
086134ec 3256 OUTS (outf, " = ");
4b7f6baa 3257 OUTS (outf, dregs_hi (src0));
086134ec 3258 OUTS (outf, " - ");
4b7f6baa 3259 OUTS (outf, dregs_lo (src1));
4b7f6baa 3260 amod1 (s, x, outf);
4b7f6baa
CM
3261 }
3262 else if (HL == 0 && aop == 3 && aopcde == 3)
3263 {
4b7f6baa 3264 OUTS (outf, dregs_lo (dst0));
086134ec 3265 OUTS (outf, " = ");
4b7f6baa 3266 OUTS (outf, dregs_hi (src0));
086134ec 3267 OUTS (outf, " - ");
4b7f6baa 3268 OUTS (outf, dregs_hi (src1));
4b7f6baa 3269 amod1 (s, x, outf);
4b7f6baa
CM
3270 }
3271 else if (HL == 0 && aop == 0 && aopcde == 2)
3272 {
4b7f6baa 3273 OUTS (outf, dregs_lo (dst0));
086134ec 3274 OUTS (outf, " = ");
4b7f6baa 3275 OUTS (outf, dregs_lo (src0));
086134ec 3276 OUTS (outf, " + ");
4b7f6baa 3277 OUTS (outf, dregs_lo (src1));
4b7f6baa 3278 amod1 (s, x, outf);
4b7f6baa
CM
3279 }
3280 else if (aop == 0 && aopcde == 9 && s == 1)
3281 {
086134ec 3282 OUTS (outf, "A0 = ");
4b7f6baa 3283 OUTS (outf, dregs (src0));
4b7f6baa
CM
3284 }
3285 else if (aop == 3 && aopcde == 11 && s == 0)
086134ec 3286 OUTS (outf, "A0 -= A1");
b7d48530 3287
4b7f6baa 3288 else if (aop == 3 && aopcde == 11 && s == 1)
086134ec 3289 OUTS (outf, "A0 -= A1 (W32)");
b7d48530 3290
4b7f6baa
CM
3291 else if (aop == 3 && aopcde == 22 && HL == 1)
3292 {
4b7f6baa 3293 OUTS (outf, dregs (dst0));
086134ec 3294 OUTS (outf, " = BYTEOP2M (");
4b7f6baa
CM
3295 OUTS (outf, dregs (src0 + 1));
3296 OUTS (outf, ":");
3297 OUTS (outf, imm5 (src0));
086134ec 3298 OUTS (outf, ", ");
4b7f6baa
CM
3299 OUTS (outf, dregs (src1 + 1));
3300 OUTS (outf, ":");
3301 OUTS (outf, imm5 (src1));
086134ec 3302 OUTS (outf, ") (TH");
4b7f6baa
CM
3303 if (s == 1)
3304 OUTS (outf, ", R)");
3305 else
3306 OUTS (outf, ")");
4b7f6baa
CM
3307 }
3308 else if (aop == 3 && aopcde == 22 && HL == 0)
3309 {
4b7f6baa 3310 OUTS (outf, dregs (dst0));
086134ec 3311 OUTS (outf, " = BYTEOP2M (");
4b7f6baa
CM
3312 OUTS (outf, dregs (src0 + 1));
3313 OUTS (outf, ":");
3314 OUTS (outf, imm5 (src0));
086134ec 3315 OUTS (outf, ", ");
4b7f6baa
CM
3316 OUTS (outf, dregs (src1 + 1));
3317 OUTS (outf, ":");
3318 OUTS (outf, imm5 (src1));
086134ec 3319 OUTS (outf, ") (TL");
4b7f6baa
CM
3320 if (s == 1)
3321 OUTS (outf, ", R)");
3322 else
3323 OUTS (outf, ")");
4b7f6baa
CM
3324 }
3325 else if (aop == 2 && aopcde == 22 && HL == 1)
3326 {
4b7f6baa 3327 OUTS (outf, dregs (dst0));
086134ec 3328 OUTS (outf, " = BYTEOP2M (");
4b7f6baa
CM
3329 OUTS (outf, dregs (src0 + 1));
3330 OUTS (outf, ":");
3331 OUTS (outf, imm5 (src0));
086134ec 3332 OUTS (outf, ", ");
4b7f6baa
CM
3333 OUTS (outf, dregs (src1 + 1));
3334 OUTS (outf, ":");
3335 OUTS (outf, imm5 (src1));
086134ec 3336 OUTS (outf, ") (RNDH");
4b7f6baa
CM
3337 if (s == 1)
3338 OUTS (outf, ", R)");
3339 else
3340 OUTS (outf, ")");
4b7f6baa
CM
3341 }
3342 else if (aop == 2 && aopcde == 22 && HL == 0)
3343 {
4b7f6baa 3344 OUTS (outf, dregs (dst0));
086134ec 3345 OUTS (outf, " = BYTEOP2M (");
4b7f6baa
CM
3346 OUTS (outf, dregs (src0 + 1));
3347 OUTS (outf, ":");
3348 OUTS (outf, imm5 (src0));
086134ec 3349 OUTS (outf, ", ");
4b7f6baa
CM
3350 OUTS (outf, dregs (src1 + 1));
3351 OUTS (outf, ":");
3352 OUTS (outf, imm5 (src1));
086134ec 3353 OUTS (outf, ") (RNDL");
4b7f6baa
CM
3354 if (s == 1)
3355 OUTS (outf, ", R)");
3356 else
3357 OUTS (outf, ")");
4b7f6baa
CM
3358 }
3359 else if (aop == 1 && aopcde == 22 && HL == 1)
3360 {
4b7f6baa 3361 OUTS (outf, dregs (dst0));
086134ec 3362 OUTS (outf, " = BYTEOP2P (");
4b7f6baa
CM
3363 OUTS (outf, dregs (src0 + 1));
3364 OUTS (outf, ":");
086134ec
BS
3365 OUTS (outf, imm5d (src0));
3366 OUTS (outf, ", ");
4b7f6baa
CM
3367 OUTS (outf, dregs (src1 + 1));
3368 OUTS (outf, ":");
086134ec
BS
3369 OUTS (outf, imm5d (src1));
3370 OUTS (outf, ") (TH");
4b7f6baa
CM
3371 if (s == 1)
3372 OUTS (outf, ", R)");
3373 else
3374 OUTS (outf, ")");
4b7f6baa
CM
3375 }
3376 else if (aop == 1 && aopcde == 22 && HL == 0)
3377 {
4b7f6baa 3378 OUTS (outf, dregs (dst0));
086134ec 3379 OUTS (outf, " = BYTEOP2P (");
4b7f6baa
CM
3380 OUTS (outf, dregs (src0 + 1));
3381 OUTS (outf, ":");
086134ec
BS
3382 OUTS (outf, imm5d (src0));
3383 OUTS (outf, ", ");
4b7f6baa
CM
3384 OUTS (outf, dregs (src1 + 1));
3385 OUTS (outf, ":");
086134ec
BS
3386 OUTS (outf, imm5d (src1));
3387 OUTS (outf, ") (TL");
4b7f6baa
CM
3388 if (s == 1)
3389 OUTS (outf, ", R)");
3390 else
3391 OUTS (outf, ")");
4b7f6baa
CM
3392 }
3393 else if (aop == 0 && aopcde == 22 && HL == 1)
3394 {
4b7f6baa 3395 OUTS (outf, dregs (dst0));
086134ec 3396 OUTS (outf, " = BYTEOP2P (");
4b7f6baa
CM
3397 OUTS (outf, dregs (src0 + 1));
3398 OUTS (outf, ":");
086134ec
BS
3399 OUTS (outf, imm5d (src0));
3400 OUTS (outf, ", ");
4b7f6baa
CM
3401 OUTS (outf, dregs (src1 + 1));
3402 OUTS (outf, ":");
086134ec
BS
3403 OUTS (outf, imm5d (src1));
3404 OUTS (outf, ") (RNDH");
4b7f6baa
CM
3405 if (s == 1)
3406 OUTS (outf, ", R)");
3407 else
3408 OUTS (outf, ")");
4b7f6baa
CM
3409 }
3410 else if (aop == 0 && aopcde == 22 && HL == 0)
3411 {
4b7f6baa 3412 OUTS (outf, dregs (dst0));
086134ec 3413 OUTS (outf, " = BYTEOP2P (");
4b7f6baa
CM
3414 OUTS (outf, dregs (src0 + 1));
3415 OUTS (outf, ":");
086134ec
BS
3416 OUTS (outf, imm5d (src0));
3417 OUTS (outf, ", ");
4b7f6baa
CM
3418 OUTS (outf, dregs (src1 + 1));
3419 OUTS (outf, ":");
086134ec
BS
3420 OUTS (outf, imm5d (src1));
3421 OUTS (outf, ") (RNDL");
4b7f6baa
CM
3422 if (s == 1)
3423 OUTS (outf, ", R)");
3424 else
3425 OUTS (outf, ")");
4b7f6baa
CM
3426 }
3427 else if (aop == 0 && s == 0 && aopcde == 8)
086134ec 3428 OUTS (outf, "A0 = 0");
b7d48530 3429
4b7f6baa 3430 else if (aop == 0 && s == 1 && aopcde == 8)
086134ec 3431 OUTS (outf, "A0 = A0 (S)");
b7d48530 3432
4b7f6baa 3433 else if (aop == 1 && s == 0 && aopcde == 8)
086134ec 3434 OUTS (outf, "A1 = 0");
b7d48530 3435
4b7f6baa 3436 else if (aop == 1 && s == 1 && aopcde == 8)
086134ec 3437 OUTS (outf, "A1 = A1 (S)");
b7d48530 3438
4b7f6baa 3439 else if (aop == 2 && s == 0 && aopcde == 8)
086134ec 3440 OUTS (outf, "A1 = A0 = 0");
b7d48530 3441
4b7f6baa 3442 else if (aop == 2 && s == 1 && aopcde == 8)
086134ec 3443 OUTS (outf, "A1 = A1 (S), A0 = A0 (S)");
b7d48530 3444
4b7f6baa 3445 else if (aop == 3 && s == 0 && aopcde == 8)
086134ec 3446 OUTS (outf, "A0 = A1");
b7d48530 3447
4b7f6baa 3448 else if (aop == 3 && s == 1 && aopcde == 8)
086134ec 3449 OUTS (outf, "A1 = A0");
b7d48530 3450
4b7f6baa
CM
3451 else if (aop == 1 && aopcde == 9 && s == 0)
3452 {
086134ec 3453 OUTS (outf, "A0.X = ");
4b7f6baa 3454 OUTS (outf, dregs_lo (src0));
4b7f6baa
CM
3455 }
3456 else if (aop == 1 && HL == 0 && aopcde == 11)
3457 {
4b7f6baa 3458 OUTS (outf, dregs_lo (dst0));
086134ec 3459 OUTS (outf, " = (A0 += A1)");
4b7f6baa
CM
3460 }
3461 else if (aop == 3 && HL == 0 && aopcde == 16)
086134ec 3462 OUTS (outf, "A1 = ABS A0, A0 = ABS A0");
b7d48530 3463
4b7f6baa
CM
3464 else if (aop == 0 && aopcde == 23 && HL == 1)
3465 {
4b7f6baa 3466 OUTS (outf, dregs (dst0));
086134ec 3467 OUTS (outf, " = BYTEOP3P (");
4b7f6baa
CM
3468 OUTS (outf, dregs (src0 + 1));
3469 OUTS (outf, ":");
086134ec
BS
3470 OUTS (outf, imm5d (src0));
3471 OUTS (outf, ", ");
4b7f6baa
CM
3472 OUTS (outf, dregs (src1 + 1));
3473 OUTS (outf, ":");
086134ec
BS
3474 OUTS (outf, imm5d (src1));
3475 OUTS (outf, ") (HI");
4b7f6baa
CM
3476 if (s == 1)
3477 OUTS (outf, ", R)");
3478 else
3479 OUTS (outf, ")");
4b7f6baa
CM
3480 }
3481 else if (aop == 3 && aopcde == 9 && s == 0)
3482 {
086134ec 3483 OUTS (outf, "A1.X = ");
4b7f6baa 3484 OUTS (outf, dregs_lo (src0));
4b7f6baa
CM
3485 }
3486 else if (aop == 1 && HL == 1 && aopcde == 16)
086134ec 3487 OUTS (outf, "A1 = ABS A1");
b7d48530 3488
4b7f6baa 3489 else if (aop == 0 && HL == 1 && aopcde == 16)
086134ec 3490 OUTS (outf, "A1 = ABS A0");
b7d48530 3491
4b7f6baa
CM
3492 else if (aop == 2 && aopcde == 9 && s == 1)
3493 {
086134ec 3494 OUTS (outf, "A1 = ");
4b7f6baa 3495 OUTS (outf, dregs (src0));
4b7f6baa
CM
3496 }
3497 else if (HL == 0 && aop == 3 && aopcde == 12)
3498 {
4b7f6baa 3499 OUTS (outf, dregs_lo (dst0));
086134ec 3500 OUTS (outf, " = ");
4b7f6baa 3501 OUTS (outf, dregs (src0));
086134ec 3502 OUTS (outf, " (RND)");
4b7f6baa
CM
3503 }
3504 else if (aop == 1 && HL == 0 && aopcde == 16)
086134ec 3505 OUTS (outf, "A0 = ABS A1");
b7d48530 3506
4b7f6baa 3507 else if (aop == 0 && HL == 0 && aopcde == 16)
086134ec 3508 OUTS (outf, "A0 = ABS A0");
b7d48530 3509
4b7f6baa
CM
3510 else if (aop == 3 && HL == 0 && aopcde == 15)
3511 {
4b7f6baa 3512 OUTS (outf, dregs (dst0));
086134ec 3513 OUTS (outf, " = -");
4b7f6baa 3514 OUTS (outf, dregs (src0));
086134ec 3515 OUTS (outf, " (V)");
4b7f6baa
CM
3516 }
3517 else if (aop == 3 && s == 1 && HL == 0 && aopcde == 7)
3518 {
4b7f6baa 3519 OUTS (outf, dregs (dst0));
086134ec 3520 OUTS (outf, " = -");
4b7f6baa 3521 OUTS (outf, dregs (src0));
086134ec 3522 OUTS (outf, " (S)");
4b7f6baa
CM
3523 }
3524 else if (aop == 3 && s == 0 && HL == 0 && aopcde == 7)
3525 {
4b7f6baa 3526 OUTS (outf, dregs (dst0));
086134ec 3527 OUTS (outf, " = -");
4b7f6baa 3528 OUTS (outf, dregs (src0));
086134ec 3529 OUTS (outf, " (NS)");
4b7f6baa
CM
3530 }
3531 else if (aop == 1 && HL == 1 && aopcde == 11)
3532 {
4b7f6baa 3533 OUTS (outf, dregs_hi (dst0));
086134ec 3534 OUTS (outf, " = (A0 += A1)");
4b7f6baa
CM
3535 }
3536 else if (aop == 2 && aopcde == 11 && s == 0)
086134ec 3537 OUTS (outf, "A0 += A1");
b7d48530 3538
4b7f6baa 3539 else if (aop == 2 && aopcde == 11 && s == 1)
086134ec 3540 OUTS (outf, "A0 += A1 (W32)");
b7d48530 3541
4b7f6baa 3542 else if (aop == 3 && HL == 0 && aopcde == 14)
086134ec 3543 OUTS (outf, "A1 = -A1, A0 = -A0");
b7d48530 3544
4b7f6baa
CM
3545 else if (HL == 1 && aop == 3 && aopcde == 12)
3546 {
4b7f6baa 3547 OUTS (outf, dregs_hi (dst0));
086134ec 3548 OUTS (outf, " = ");
4b7f6baa 3549 OUTS (outf, dregs (src0));
086134ec 3550 OUTS (outf, " (RND)");
4b7f6baa
CM
3551 }
3552 else if (aop == 0 && aopcde == 23 && HL == 0)
3553 {
4b7f6baa 3554 OUTS (outf, dregs (dst0));
086134ec 3555 OUTS (outf, " = BYTEOP3P (");
4b7f6baa
CM
3556 OUTS (outf, dregs (src0 + 1));
3557 OUTS (outf, ":");
086134ec
BS
3558 OUTS (outf, imm5d (src0));
3559 OUTS (outf, ", ");
4b7f6baa
CM
3560 OUTS (outf, dregs (src1 + 1));
3561 OUTS (outf, ":");
086134ec
BS
3562 OUTS (outf, imm5d (src1));
3563 OUTS (outf, ") (LO");
4b7f6baa
CM
3564 if (s == 1)
3565 OUTS (outf, ", R)");
3566 else
3567 OUTS (outf, ")");
4b7f6baa
CM
3568 }
3569 else if (aop == 0 && HL == 0 && aopcde == 14)
086134ec 3570 OUTS (outf, "A0 = -A0");
b7d48530 3571
4b7f6baa 3572 else if (aop == 1 && HL == 0 && aopcde == 14)
086134ec 3573 OUTS (outf, "A0 = -A1");
b7d48530 3574
4b7f6baa 3575 else if (aop == 0 && HL == 1 && aopcde == 14)
086134ec 3576 OUTS (outf, "A1 = -A0");
b7d48530 3577
4b7f6baa 3578 else if (aop == 1 && HL == 1 && aopcde == 14)
086134ec 3579 OUTS (outf, "A1 = -A1");
b7d48530 3580
4b7f6baa
CM
3581 else if (aop == 0 && aopcde == 12)
3582 {
4b7f6baa 3583 OUTS (outf, dregs_hi (dst0));
086134ec 3584 OUTS (outf, " = ");
4b7f6baa 3585 OUTS (outf, dregs_lo (dst0));
086134ec 3586 OUTS (outf, " = SIGN (");
4b7f6baa 3587 OUTS (outf, dregs_hi (src0));
086134ec 3588 OUTS (outf, ") * ");
4b7f6baa 3589 OUTS (outf, dregs_hi (src1));
086134ec 3590 OUTS (outf, " + SIGN (");
4b7f6baa 3591 OUTS (outf, dregs_lo (src0));
086134ec 3592 OUTS (outf, ") * ");
4b7f6baa 3593 OUTS (outf, dregs_lo (src1));
4b7f6baa
CM
3594 }
3595 else if (aop == 2 && aopcde == 0)
3596 {
4b7f6baa 3597 OUTS (outf, dregs (dst0));
086134ec 3598 OUTS (outf, " = ");
4b7f6baa 3599 OUTS (outf, dregs (src0));
086134ec 3600 OUTS (outf, " -|+ ");
4b7f6baa 3601 OUTS (outf, dregs (src1));
4b7f6baa 3602 amod0 (s, x, outf);
4b7f6baa
CM
3603 }
3604 else if (aop == 1 && aopcde == 12)
3605 {
4b7f6baa 3606 OUTS (outf, dregs (dst1));
086134ec 3607 OUTS (outf, " = A1.L + A1.H, ");
4b7f6baa 3608 OUTS (outf, dregs (dst0));
086134ec 3609 OUTS (outf, " = A0.L + A0.H");
4b7f6baa
CM
3610 }
3611 else if (aop == 2 && aopcde == 4)
3612 {
4b7f6baa 3613 OUTS (outf, dregs (dst1));
086134ec 3614 OUTS (outf, " = ");
4b7f6baa 3615 OUTS (outf, dregs (src0));
086134ec 3616 OUTS (outf, " + ");
4b7f6baa 3617 OUTS (outf, dregs (src1));
086134ec 3618 OUTS (outf, ", ");
4b7f6baa 3619 OUTS (outf, dregs (dst0));
086134ec 3620 OUTS (outf, " = ");
4b7f6baa 3621 OUTS (outf, dregs (src0));
086134ec 3622 OUTS (outf, " - ");
4b7f6baa 3623 OUTS (outf, dregs (src1));
4b7f6baa 3624 amod1 (s, x, outf);
4b7f6baa
CM
3625 }
3626 else if (HL == 0 && aopcde == 1)
3627 {
4b7f6baa 3628 OUTS (outf, dregs (dst1));
086134ec 3629 OUTS (outf, " = ");
4b7f6baa 3630 OUTS (outf, dregs (src0));
086134ec 3631 OUTS (outf, " +|+ ");
4b7f6baa 3632 OUTS (outf, dregs (src1));
086134ec 3633 OUTS (outf, ", ");
4b7f6baa 3634 OUTS (outf, dregs (dst0));
086134ec 3635 OUTS (outf, " = ");
4b7f6baa 3636 OUTS (outf, dregs (src0));
086134ec 3637 OUTS (outf, " -|- ");
4b7f6baa
CM
3638 OUTS (outf, dregs (src1));
3639 amod0amod2 (s, x, aop, outf);
4b7f6baa
CM
3640 }
3641 else if (aop == 0 && aopcde == 11)
3642 {
4b7f6baa 3643 OUTS (outf, dregs (dst0));
086134ec 3644 OUTS (outf, " = (A0 += A1)");
4b7f6baa
CM
3645 }
3646 else if (aop == 0 && aopcde == 10)
3647 {
4b7f6baa 3648 OUTS (outf, dregs_lo (dst0));
086134ec 3649 OUTS (outf, " = A0.X");
4b7f6baa
CM
3650 }
3651 else if (aop == 1 && aopcde == 10)
3652 {
4b7f6baa 3653 OUTS (outf, dregs_lo (dst0));
086134ec 3654 OUTS (outf, " = A1.X");
4b7f6baa
CM
3655 }
3656 else if (aop == 1 && aopcde == 0)
3657 {
4b7f6baa 3658 OUTS (outf, dregs (dst0));
086134ec 3659 OUTS (outf, " = ");
4b7f6baa 3660 OUTS (outf, dregs (src0));
086134ec 3661 OUTS (outf, " +|- ");
4b7f6baa 3662 OUTS (outf, dregs (src1));
4b7f6baa 3663 amod0 (s, x, outf);
4b7f6baa
CM
3664 }
3665 else if (aop == 3 && aopcde == 0)
3666 {
4b7f6baa 3667 OUTS (outf, dregs (dst0));
086134ec 3668 OUTS (outf, " = ");
4b7f6baa 3669 OUTS (outf, dregs (src0));
086134ec 3670 OUTS (outf, " -|- ");
4b7f6baa 3671 OUTS (outf, dregs (src1));
4b7f6baa 3672 amod0 (s, x, outf);
4b7f6baa
CM
3673 }
3674 else if (aop == 1 && aopcde == 4)
3675 {
4b7f6baa 3676 OUTS (outf, dregs (dst0));
086134ec 3677 OUTS (outf, " = ");
4b7f6baa 3678 OUTS (outf, dregs (src0));
086134ec 3679 OUTS (outf, " - ");
4b7f6baa 3680 OUTS (outf, dregs (src1));
4b7f6baa 3681 amod1 (s, x, outf);
4b7f6baa
CM
3682 }
3683 else if (aop == 0 && aopcde == 17)
3684 {
4b7f6baa 3685 OUTS (outf, dregs (dst1));
086134ec 3686 OUTS (outf, " = A1 + A0, ");
4b7f6baa 3687 OUTS (outf, dregs (dst0));
086134ec 3688 OUTS (outf, " = A1 - A0");
4b7f6baa 3689 amod1 (s, x, outf);
4b7f6baa
CM
3690 }
3691 else if (aop == 1 && aopcde == 17)
3692 {
4b7f6baa 3693 OUTS (outf, dregs (dst1));
086134ec 3694 OUTS (outf, " = A0 + A1, ");
4b7f6baa 3695 OUTS (outf, dregs (dst0));
086134ec 3696 OUTS (outf, " = A0 - A1");
4b7f6baa 3697 amod1 (s, x, outf);
4b7f6baa
CM
3698 }
3699 else if (aop == 0 && aopcde == 18)
3700 {
086134ec 3701 OUTS (outf, "SAA (");
4b7f6baa
CM
3702 OUTS (outf, dregs (src0 + 1));
3703 OUTS (outf, ":");
086134ec
BS
3704 OUTS (outf, imm5d (src0));
3705 OUTS (outf, ", ");
4b7f6baa
CM
3706 OUTS (outf, dregs (src1 + 1));
3707 OUTS (outf, ":");
086134ec
BS
3708 OUTS (outf, imm5d (src1));
3709 OUTS (outf, ")");
4b7f6baa 3710 aligndir (s, outf);
4b7f6baa
CM
3711 }
3712 else if (aop == 3 && aopcde == 18)
b7d48530
NC
3713 OUTS (outf, "DISALGNEXCPT");
3714
4b7f6baa
CM
3715 else if (aop == 0 && aopcde == 20)
3716 {
4b7f6baa 3717 OUTS (outf, dregs (dst0));
086134ec 3718 OUTS (outf, " = BYTEOP1P (");
4b7f6baa
CM
3719 OUTS (outf, dregs (src0 + 1));
3720 OUTS (outf, ":");
086134ec
BS
3721 OUTS (outf, imm5d (src0));
3722 OUTS (outf, ", ");
4b7f6baa
CM
3723 OUTS (outf, dregs (src1 + 1));
3724 OUTS (outf, ":");
086134ec 3725 OUTS (outf, imm5d (src1));
4b7f6baa
CM
3726 OUTS (outf, ")");
3727 aligndir (s, outf);
4b7f6baa
CM
3728 }
3729 else if (aop == 1 && aopcde == 20)
3730 {
4b7f6baa 3731 OUTS (outf, dregs (dst0));
086134ec 3732 OUTS (outf, " = BYTEOP1P (");
4b7f6baa
CM
3733 OUTS (outf, dregs (src0 + 1));
3734 OUTS (outf, ":");
086134ec
BS
3735 OUTS (outf, imm5d (src0));
3736 OUTS (outf, ", ");
4b7f6baa
CM
3737 OUTS (outf, dregs (src1 + 1));
3738 OUTS (outf, ":");
086134ec
BS
3739 OUTS (outf, imm5d (src1));
3740 OUTS (outf, ") (T");
4b7f6baa
CM
3741 if (s == 1)
3742 OUTS (outf, ", R)");
3743 else
3744 OUTS (outf, ")");
4b7f6baa
CM
3745 }
3746 else if (aop == 0 && aopcde == 21)
3747 {
4b7f6baa
CM
3748 OUTS (outf, "(");
3749 OUTS (outf, dregs (dst1));
086134ec 3750 OUTS (outf, ", ");
4b7f6baa 3751 OUTS (outf, dregs (dst0));
086134ec 3752 OUTS (outf, ") = BYTEOP16P (");
4b7f6baa
CM
3753 OUTS (outf, dregs (src0 + 1));
3754 OUTS (outf, ":");
086134ec
BS
3755 OUTS (outf, imm5d (src0));
3756 OUTS (outf, ", ");
4b7f6baa
CM
3757 OUTS (outf, dregs (src1 + 1));
3758 OUTS (outf, ":");
086134ec
BS
3759 OUTS (outf, imm5d (src1));
3760 OUTS (outf, ")");
4b7f6baa 3761 aligndir (s, outf);
4b7f6baa
CM
3762 }
3763 else if (aop == 1 && aopcde == 21)
3764 {
4b7f6baa
CM
3765 OUTS (outf, "(");
3766 OUTS (outf, dregs (dst1));
086134ec 3767 OUTS (outf, ", ");
4b7f6baa 3768 OUTS (outf, dregs (dst0));
086134ec 3769 OUTS (outf, ") = BYTEOP16M (");
4b7f6baa
CM
3770 OUTS (outf, dregs (src0 + 1));
3771 OUTS (outf, ":");
086134ec
BS
3772 OUTS (outf, imm5d (src0));
3773 OUTS (outf, ", ");
4b7f6baa
CM
3774 OUTS (outf, dregs (src1 + 1));
3775 OUTS (outf, ":");
086134ec
BS
3776 OUTS (outf, imm5d (src1));
3777 OUTS (outf, ")");
4b7f6baa 3778 aligndir (s, outf);
4b7f6baa
CM
3779 }
3780 else if (aop == 2 && aopcde == 7)
3781 {
4b7f6baa 3782 OUTS (outf, dregs (dst0));
086134ec 3783 OUTS (outf, " = ABS ");
4b7f6baa 3784 OUTS (outf, dregs (src0));
4b7f6baa
CM
3785 }
3786 else if (aop == 1 && aopcde == 7)
3787 {
4b7f6baa 3788 OUTS (outf, dregs (dst0));
086134ec 3789 OUTS (outf, " = MIN (");
4b7f6baa 3790 OUTS (outf, dregs (src0));
086134ec 3791 OUTS (outf, ", ");
4b7f6baa
CM
3792 OUTS (outf, dregs (src1));
3793 OUTS (outf, ")");
4b7f6baa
CM
3794 }
3795 else if (aop == 0 && aopcde == 7)
3796 {
4b7f6baa 3797 OUTS (outf, dregs (dst0));
086134ec 3798 OUTS (outf, " = MAX (");
4b7f6baa 3799 OUTS (outf, dregs (src0));
086134ec 3800 OUTS (outf, ", ");
4b7f6baa
CM
3801 OUTS (outf, dregs (src1));
3802 OUTS (outf, ")");
4b7f6baa
CM
3803 }
3804 else if (aop == 2 && aopcde == 6)
3805 {
4b7f6baa 3806 OUTS (outf, dregs (dst0));
086134ec 3807 OUTS (outf, " = ABS ");
4b7f6baa 3808 OUTS (outf, dregs (src0));
086134ec 3809 OUTS (outf, " (V)");
4b7f6baa
CM
3810 }
3811 else if (aop == 1 && aopcde == 6)
3812 {
4b7f6baa 3813 OUTS (outf, dregs (dst0));
086134ec 3814 OUTS (outf, " = MIN (");
4b7f6baa 3815 OUTS (outf, dregs (src0));
086134ec 3816 OUTS (outf, ", ");
4b7f6baa 3817 OUTS (outf, dregs (src1));
086134ec 3818 OUTS (outf, ") (V)");
4b7f6baa
CM
3819 }
3820 else if (aop == 0 && aopcde == 6)
3821 {
4b7f6baa 3822 OUTS (outf, dregs (dst0));
086134ec 3823 OUTS (outf, " = MAX (");
4b7f6baa 3824 OUTS (outf, dregs (src0));
086134ec 3825 OUTS (outf, ", ");
4b7f6baa 3826 OUTS (outf, dregs (src1));
086134ec 3827 OUTS (outf, ") (V)");
4b7f6baa
CM
3828 }
3829 else if (HL == 1 && aopcde == 1)
3830 {
4b7f6baa 3831 OUTS (outf, dregs (dst1));
086134ec 3832 OUTS (outf, " = ");
4b7f6baa 3833 OUTS (outf, dregs (src0));
086134ec 3834 OUTS (outf, " +|- ");
4b7f6baa 3835 OUTS (outf, dregs (src1));
086134ec 3836 OUTS (outf, ", ");
4b7f6baa 3837 OUTS (outf, dregs (dst0));
086134ec 3838 OUTS (outf, " = ");
4b7f6baa 3839 OUTS (outf, dregs (src0));
086134ec 3840 OUTS (outf, " -|+ ");
4b7f6baa
CM
3841 OUTS (outf, dregs (src1));
3842 amod0amod2 (s, x, aop, outf);
4b7f6baa
CM
3843 }
3844 else if (aop == 0 && aopcde == 4)
3845 {
4b7f6baa 3846 OUTS (outf, dregs (dst0));
086134ec 3847 OUTS (outf, " = ");
4b7f6baa 3848 OUTS (outf, dregs (src0));
086134ec 3849 OUTS (outf, " + ");
4b7f6baa 3850 OUTS (outf, dregs (src1));
4b7f6baa 3851 amod1 (s, x, outf);
4b7f6baa
CM
3852 }
3853 else if (aop == 0 && aopcde == 0)
3854 {
4b7f6baa 3855 OUTS (outf, dregs (dst0));
086134ec 3856 OUTS (outf, " = ");
4b7f6baa 3857 OUTS (outf, dregs (src0));
086134ec 3858 OUTS (outf, " +|+ ");
4b7f6baa 3859 OUTS (outf, dregs (src1));
4b7f6baa 3860 amod0 (s, x, outf);
4b7f6baa
CM
3861 }
3862 else if (aop == 0 && aopcde == 24)
3863 {
4b7f6baa 3864 OUTS (outf, dregs (dst0));
086134ec 3865 OUTS (outf, " = BYTEPACK (");
4b7f6baa 3866 OUTS (outf, dregs (src0));
086134ec 3867 OUTS (outf, ", ");
4b7f6baa
CM
3868 OUTS (outf, dregs (src1));
3869 OUTS (outf, ")");
4b7f6baa
CM
3870 }
3871 else if (aop == 1 && aopcde == 24)
3872 {
4b7f6baa
CM
3873 OUTS (outf, "(");
3874 OUTS (outf, dregs (dst1));
086134ec 3875 OUTS (outf, ", ");
4b7f6baa
CM
3876 OUTS (outf, dregs (dst0));
3877 OUTS (outf, ") = BYTEUNPACK ");
3878 OUTS (outf, dregs (src0 + 1));
3879 OUTS (outf, ":");
086134ec 3880 OUTS (outf, imm5d (src0));
4b7f6baa 3881 aligndir (s, outf);
4b7f6baa
CM
3882 }
3883 else if (aopcde == 13)
3884 {
4b7f6baa
CM
3885 OUTS (outf, "(");
3886 OUTS (outf, dregs (dst1));
086134ec 3887 OUTS (outf, ", ");
4b7f6baa
CM
3888 OUTS (outf, dregs (dst0));
3889 OUTS (outf, ") = SEARCH ");
3890 OUTS (outf, dregs (src0));
086134ec 3891 OUTS (outf, " (");
4b7f6baa
CM
3892 searchmod (aop, outf);
3893 OUTS (outf, ")");
4b7f6baa
CM
3894 }
3895 else
b7d48530
NC
3896 return 0;
3897
3898 return 4;
4b7f6baa
CM
3899}
3900
3901static int
3902decode_dsp32shift_0 (TIword iw0, TIword iw1, disassemble_info *outf)
3903{
b7d48530
NC
3904 /* dsp32shift
3905 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
3906 | 1 | 1 | 0 | 0 |.M.| 1 | 1 | 0 | 0 | - | - |.sopcde............|
3907 |.sop...|.HLs...|.dst0......| - | - | - |.src0......|.src1......|
3908 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
3909 int HLs = ((iw1 >> DSP32Shift_HLs_bits) & DSP32Shift_HLs_mask);
3910 int sop = ((iw1 >> DSP32Shift_sop_bits) & DSP32Shift_sop_mask);
3911 int src0 = ((iw1 >> DSP32Shift_src0_bits) & DSP32Shift_src0_mask);
3912 int src1 = ((iw1 >> DSP32Shift_src1_bits) & DSP32Shift_src1_mask);
3913 int dst0 = ((iw1 >> DSP32Shift_dst0_bits) & DSP32Shift_dst0_mask);
3914 int sopcde = ((iw0 >> (DSP32Shift_sopcde_bits - 16)) & DSP32Shift_sopcde_mask);
3915 const char *acc01 = (HLs & 1) == 0 ? "A0" : "A1";
3916
4b7f6baa
CM
3917 if (HLs == 0 && sop == 0 && sopcde == 0)
3918 {
4b7f6baa 3919 OUTS (outf, dregs_lo (dst0));
086134ec 3920 OUTS (outf, " = ASHIFT ");
4b7f6baa
CM
3921 OUTS (outf, dregs_lo (src1));
3922 OUTS (outf, " BY ");
3923 OUTS (outf, dregs_lo (src0));
4b7f6baa
CM
3924 }
3925 else if (HLs == 1 && sop == 0 && sopcde == 0)
3926 {
4b7f6baa 3927 OUTS (outf, dregs_lo (dst0));
086134ec 3928 OUTS (outf, " = ASHIFT ");
4b7f6baa
CM
3929 OUTS (outf, dregs_hi (src1));
3930 OUTS (outf, " BY ");
3931 OUTS (outf, dregs_lo (src0));
4b7f6baa
CM
3932 }
3933 else if (HLs == 2 && sop == 0 && sopcde == 0)
3934 {
4b7f6baa 3935 OUTS (outf, dregs_hi (dst0));
086134ec 3936 OUTS (outf, " = ASHIFT ");
4b7f6baa
CM
3937 OUTS (outf, dregs_lo (src1));
3938 OUTS (outf, " BY ");
3939 OUTS (outf, dregs_lo (src0));
4b7f6baa
CM
3940 }
3941 else if (HLs == 3 && sop == 0 && sopcde == 0)
3942 {
4b7f6baa 3943 OUTS (outf, dregs_hi (dst0));
086134ec 3944 OUTS (outf, " = ASHIFT ");
4b7f6baa
CM
3945 OUTS (outf, dregs_hi (src1));
3946 OUTS (outf, " BY ");
3947 OUTS (outf, dregs_lo (src0));
4b7f6baa
CM
3948 }
3949 else if (HLs == 0 && sop == 1 && sopcde == 0)
3950 {
4b7f6baa 3951 OUTS (outf, dregs_lo (dst0));
086134ec 3952 OUTS (outf, " = ASHIFT ");
4b7f6baa
CM
3953 OUTS (outf, dregs_lo (src1));
3954 OUTS (outf, " BY ");
3955 OUTS (outf, dregs_lo (src0));
086134ec 3956 OUTS (outf, " (S)");
4b7f6baa
CM
3957 }
3958 else if (HLs == 1 && sop == 1 && sopcde == 0)
3959 {
4b7f6baa 3960 OUTS (outf, dregs_lo (dst0));
086134ec 3961 OUTS (outf, " = ASHIFT ");
4b7f6baa
CM
3962 OUTS (outf, dregs_hi (src1));
3963 OUTS (outf, " BY ");
3964 OUTS (outf, dregs_lo (src0));
086134ec 3965 OUTS (outf, " (S)");
4b7f6baa
CM
3966 }
3967 else if (HLs == 2 && sop == 1 && sopcde == 0)
3968 {
4b7f6baa 3969 OUTS (outf, dregs_hi (dst0));
086134ec 3970 OUTS (outf, " = ASHIFT ");
4b7f6baa
CM
3971 OUTS (outf, dregs_lo (src1));
3972 OUTS (outf, " BY ");
3973 OUTS (outf, dregs_lo (src0));
086134ec 3974 OUTS (outf, " (S)");
4b7f6baa
CM
3975 }
3976 else if (HLs == 3 && sop == 1 && sopcde == 0)
3977 {
4b7f6baa 3978 OUTS (outf, dregs_hi (dst0));
086134ec 3979 OUTS (outf, " = ASHIFT ");
4b7f6baa
CM
3980 OUTS (outf, dregs_hi (src1));
3981 OUTS (outf, " BY ");
3982 OUTS (outf, dregs_lo (src0));
086134ec 3983 OUTS (outf, " (S)");
4b7f6baa
CM
3984 }
3985 else if (sop == 2 && sopcde == 0)
3986 {
4b7f6baa 3987 OUTS (outf, (HLs & 2) == 0 ? dregs_lo (dst0) : dregs_hi (dst0));
086134ec 3988 OUTS (outf, " = LSHIFT ");
4b7f6baa
CM
3989 OUTS (outf, (HLs & 1) == 0 ? dregs_lo (src1) : dregs_hi (src1));
3990 OUTS (outf, " BY ");
3991 OUTS (outf, dregs_lo (src0));
4b7f6baa
CM
3992 }
3993 else if (sop == 0 && sopcde == 3)
3994 {
4b7f6baa 3995 OUTS (outf, acc01);
086134ec 3996 OUTS (outf, " = ASHIFT ");
4b7f6baa
CM
3997 OUTS (outf, acc01);
3998 OUTS (outf, " BY ");
3999 OUTS (outf, dregs_lo (src0));
4b7f6baa
CM
4000 }
4001 else if (sop == 1 && sopcde == 3)
4002 {
4b7f6baa 4003 OUTS (outf, acc01);
086134ec 4004 OUTS (outf, " = LSHIFT ");
4b7f6baa
CM
4005 OUTS (outf, acc01);
4006 OUTS (outf, " BY ");
4007 OUTS (outf, dregs_lo (src0));
4b7f6baa
CM
4008 }
4009 else if (sop == 2 && sopcde == 3)
4010 {
4b7f6baa 4011 OUTS (outf, acc01);
086134ec 4012 OUTS (outf, " = ROT ");
4b7f6baa
CM
4013 OUTS (outf, acc01);
4014 OUTS (outf, " BY ");
4015 OUTS (outf, dregs_lo (src0));
4b7f6baa
CM
4016 }
4017 else if (sop == 3 && sopcde == 3)
4018 {
4b7f6baa 4019 OUTS (outf, dregs (dst0));
086134ec 4020 OUTS (outf, " = ROT ");
4b7f6baa
CM
4021 OUTS (outf, dregs (src1));
4022 OUTS (outf, " BY ");
4023 OUTS (outf, dregs_lo (src0));
4b7f6baa
CM
4024 }
4025 else if (sop == 1 && sopcde == 1)
4026 {
4b7f6baa 4027 OUTS (outf, dregs (dst0));
086134ec 4028 OUTS (outf, " = ASHIFT ");
4b7f6baa
CM
4029 OUTS (outf, dregs (src1));
4030 OUTS (outf, " BY ");
4031 OUTS (outf, dregs_lo (src0));
086134ec 4032 OUTS (outf, " (V, S)");
4b7f6baa
CM
4033 }
4034 else if (sop == 0 && sopcde == 1)
4035 {
4b7f6baa 4036 OUTS (outf, dregs (dst0));
086134ec 4037 OUTS (outf, " = ASHIFT ");
4b7f6baa
CM
4038 OUTS (outf, dregs (src1));
4039 OUTS (outf, " BY ");
4040 OUTS (outf, dregs_lo (src0));
086134ec 4041 OUTS (outf, " (V)");
4b7f6baa
CM
4042 }
4043 else if (sop == 0 && sopcde == 2)
4044 {
4b7f6baa 4045 OUTS (outf, dregs (dst0));
086134ec 4046 OUTS (outf, " = ASHIFT ");
4b7f6baa
CM
4047 OUTS (outf, dregs (src1));
4048 OUTS (outf, " BY ");
4049 OUTS (outf, dregs_lo (src0));
4b7f6baa
CM
4050 }
4051 else if (sop == 1 && sopcde == 2)
4052 {
4b7f6baa 4053 OUTS (outf, dregs (dst0));
086134ec 4054 OUTS (outf, " = ASHIFT ");
4b7f6baa
CM
4055 OUTS (outf, dregs (src1));
4056 OUTS (outf, " BY ");
4057 OUTS (outf, dregs_lo (src0));
086134ec 4058 OUTS (outf, " (S)");
4b7f6baa
CM
4059 }
4060 else if (sop == 2 && sopcde == 2)
4061 {
4b7f6baa 4062 OUTS (outf, dregs (dst0));
086134ec 4063 OUTS (outf, " = SHIFT ");
4b7f6baa
CM
4064 OUTS (outf, dregs (src1));
4065 OUTS (outf, " BY ");
4066 OUTS (outf, dregs_lo (src0));
4b7f6baa
CM
4067 }
4068 else if (sop == 3 && sopcde == 2)
4069 {
4b7f6baa 4070 OUTS (outf, dregs (dst0));
086134ec 4071 OUTS (outf, " = ROT ");
4b7f6baa
CM
4072 OUTS (outf, dregs (src1));
4073 OUTS (outf, " BY ");
4074 OUTS (outf, dregs_lo (src0));
4b7f6baa
CM
4075 }
4076 else if (sop == 2 && sopcde == 1)
4077 {
4b7f6baa 4078 OUTS (outf, dregs (dst0));
086134ec 4079 OUTS (outf, " = SHIFT ");
4b7f6baa
CM
4080 OUTS (outf, dregs (src1));
4081 OUTS (outf, " BY ");
4082 OUTS (outf, dregs_lo (src0));
086134ec 4083 OUTS (outf, " (V)");
4b7f6baa
CM
4084 }
4085 else if (sop == 0 && sopcde == 4)
4086 {
4b7f6baa 4087 OUTS (outf, dregs (dst0));
086134ec 4088 OUTS (outf, " = PACK (");
4b7f6baa 4089 OUTS (outf, dregs_lo (src1));
086134ec 4090 OUTS (outf, ", ");
4b7f6baa
CM
4091 OUTS (outf, dregs_lo (src0));
4092 OUTS (outf, ")");
4b7f6baa
CM
4093 }
4094 else if (sop == 1 && sopcde == 4)
4095 {
4b7f6baa 4096 OUTS (outf, dregs (dst0));
086134ec 4097 OUTS (outf, " = PACK (");
4b7f6baa 4098 OUTS (outf, dregs_lo (src1));
086134ec 4099 OUTS (outf, ", ");
4b7f6baa
CM
4100 OUTS (outf, dregs_hi (src0));
4101 OUTS (outf, ")");
4b7f6baa
CM
4102 }
4103 else if (sop == 2 && sopcde == 4)
4104 {
4b7f6baa 4105 OUTS (outf, dregs (dst0));
086134ec 4106 OUTS (outf, " = PACK (");
4b7f6baa 4107 OUTS (outf, dregs_hi (src1));
086134ec 4108 OUTS (outf, ", ");
4b7f6baa
CM
4109 OUTS (outf, dregs_lo (src0));
4110 OUTS (outf, ")");
4b7f6baa
CM
4111 }
4112 else if (sop == 3 && sopcde == 4)
4113 {
4b7f6baa 4114 OUTS (outf, dregs (dst0));
086134ec 4115 OUTS (outf, " = PACK (");
4b7f6baa 4116 OUTS (outf, dregs_hi (src1));
086134ec 4117 OUTS (outf, ", ");
4b7f6baa
CM
4118 OUTS (outf, dregs_hi (src0));
4119 OUTS (outf, ")");
4b7f6baa
CM
4120 }
4121 else if (sop == 0 && sopcde == 5)
4122 {
4b7f6baa 4123 OUTS (outf, dregs_lo (dst0));
086134ec 4124 OUTS (outf, " = SIGNBITS ");
4b7f6baa 4125 OUTS (outf, dregs (src1));
4b7f6baa
CM
4126 }
4127 else if (sop == 1 && sopcde == 5)
4128 {
4b7f6baa 4129 OUTS (outf, dregs_lo (dst0));
086134ec 4130 OUTS (outf, " = SIGNBITS ");
4b7f6baa 4131 OUTS (outf, dregs_lo (src1));
4b7f6baa
CM
4132 }
4133 else if (sop == 2 && sopcde == 5)
4134 {
4b7f6baa 4135 OUTS (outf, dregs_lo (dst0));
086134ec 4136 OUTS (outf, " = SIGNBITS ");
4b7f6baa 4137 OUTS (outf, dregs_hi (src1));
4b7f6baa
CM
4138 }
4139 else if (sop == 0 && sopcde == 6)
4140 {
4b7f6baa 4141 OUTS (outf, dregs_lo (dst0));
086134ec 4142 OUTS (outf, " = SIGNBITS A0");
4b7f6baa
CM
4143 }
4144 else if (sop == 1 && sopcde == 6)
4145 {
4b7f6baa 4146 OUTS (outf, dregs_lo (dst0));
086134ec 4147 OUTS (outf, " = SIGNBITS A1");
4b7f6baa
CM
4148 }
4149 else if (sop == 3 && sopcde == 6)
4150 {
4b7f6baa 4151 OUTS (outf, dregs_lo (dst0));
086134ec 4152 OUTS (outf, " = ONES ");
4b7f6baa 4153 OUTS (outf, dregs (src1));
4b7f6baa
CM
4154 }
4155 else if (sop == 0 && sopcde == 7)
4156 {
4b7f6baa 4157 OUTS (outf, dregs_lo (dst0));
086134ec 4158 OUTS (outf, " = EXPADJ (");
4b7f6baa 4159 OUTS (outf, dregs (src1));
086134ec 4160 OUTS (outf, ", ");
4b7f6baa
CM
4161 OUTS (outf, dregs_lo (src0));
4162 OUTS (outf, ")");
4b7f6baa
CM
4163 }
4164 else if (sop == 1 && sopcde == 7)
4165 {
4b7f6baa 4166 OUTS (outf, dregs_lo (dst0));
086134ec 4167 OUTS (outf, " = EXPADJ (");
4b7f6baa 4168 OUTS (outf, dregs (src1));
086134ec 4169 OUTS (outf, ", ");
4b7f6baa
CM
4170 OUTS (outf, dregs_lo (src0));
4171 OUTS (outf, ") (V)");
4b7f6baa
CM
4172 }
4173 else if (sop == 2 && sopcde == 7)
4174 {
4b7f6baa 4175 OUTS (outf, dregs_lo (dst0));
086134ec 4176 OUTS (outf, " = EXPADJ (");
4b7f6baa 4177 OUTS (outf, dregs_lo (src1));
086134ec 4178 OUTS (outf, ", ");
4b7f6baa
CM
4179 OUTS (outf, dregs_lo (src0));
4180 OUTS (outf, ")");
4b7f6baa
CM
4181 }
4182 else if (sop == 3 && sopcde == 7)
4183 {
4b7f6baa 4184 OUTS (outf, dregs_lo (dst0));
086134ec 4185 OUTS (outf, " = EXPADJ (");
4b7f6baa 4186 OUTS (outf, dregs_hi (src1));
086134ec 4187 OUTS (outf, ", ");
4b7f6baa
CM
4188 OUTS (outf, dregs_lo (src0));
4189 OUTS (outf, ")");
4b7f6baa
CM
4190 }
4191 else if (sop == 0 && sopcde == 8)
4192 {
4b7f6baa
CM
4193 OUTS (outf, "BITMUX (");
4194 OUTS (outf, dregs (src0));
086134ec 4195 OUTS (outf, ", ");
4b7f6baa 4196 OUTS (outf, dregs (src1));
086134ec 4197 OUTS (outf, ", A0) (ASR)");
4b7f6baa
CM
4198 }
4199 else if (sop == 1 && sopcde == 8)
4200 {
4b7f6baa
CM
4201 OUTS (outf, "BITMUX (");
4202 OUTS (outf, dregs (src0));
086134ec 4203 OUTS (outf, ", ");
4b7f6baa 4204 OUTS (outf, dregs (src1));
086134ec 4205 OUTS (outf, ", A0) (ASL)");
4b7f6baa
CM
4206 }
4207 else if (sop == 0 && sopcde == 9)
4208 {
4b7f6baa 4209 OUTS (outf, dregs_lo (dst0));
086134ec 4210 OUTS (outf, " = VIT_MAX (");
4b7f6baa
CM
4211 OUTS (outf, dregs (src1));
4212 OUTS (outf, ") (ASL)");
4b7f6baa
CM
4213 }
4214 else if (sop == 1 && sopcde == 9)
4215 {
4b7f6baa 4216 OUTS (outf, dregs_lo (dst0));
086134ec 4217 OUTS (outf, " = VIT_MAX (");
4b7f6baa
CM
4218 OUTS (outf, dregs (src1));
4219 OUTS (outf, ") (ASR)");
4b7f6baa
CM
4220 }
4221 else if (sop == 2 && sopcde == 9)
4222 {
4b7f6baa 4223 OUTS (outf, dregs (dst0));
086134ec 4224 OUTS (outf, " = VIT_MAX (");
4b7f6baa 4225 OUTS (outf, dregs (src1));
086134ec 4226 OUTS (outf, ", ");
4b7f6baa 4227 OUTS (outf, dregs (src0));
086134ec 4228 OUTS (outf, ") (ASL)");
4b7f6baa
CM
4229 }
4230 else if (sop == 3 && sopcde == 9)
4231 {
4b7f6baa 4232 OUTS (outf, dregs (dst0));
086134ec 4233 OUTS (outf, " = VIT_MAX (");
4b7f6baa 4234 OUTS (outf, dregs (src1));
086134ec 4235 OUTS (outf, ", ");
4b7f6baa 4236 OUTS (outf, dregs (src0));
086134ec 4237 OUTS (outf, ") (ASR)");
4b7f6baa
CM
4238 }
4239 else if (sop == 0 && sopcde == 10)
4240 {
4b7f6baa 4241 OUTS (outf, dregs (dst0));
086134ec 4242 OUTS (outf, " = EXTRACT (");
4b7f6baa 4243 OUTS (outf, dregs (src1));
086134ec 4244 OUTS (outf, ", ");
4b7f6baa
CM
4245 OUTS (outf, dregs_lo (src0));
4246 OUTS (outf, ") (Z)");
4b7f6baa
CM
4247 }
4248 else if (sop == 1 && sopcde == 10)
4249 {
4b7f6baa 4250 OUTS (outf, dregs (dst0));
086134ec 4251 OUTS (outf, " = EXTRACT (");
4b7f6baa 4252 OUTS (outf, dregs (src1));
086134ec 4253 OUTS (outf, ", ");
4b7f6baa 4254 OUTS (outf, dregs_lo (src0));
086134ec 4255 OUTS (outf, ") (X)");
4b7f6baa
CM
4256 }
4257 else if (sop == 2 && sopcde == 10)
4258 {
4b7f6baa 4259 OUTS (outf, dregs (dst0));
086134ec 4260 OUTS (outf, " = DEPOSIT (");
4b7f6baa 4261 OUTS (outf, dregs (src1));
086134ec 4262 OUTS (outf, ", ");
4b7f6baa
CM
4263 OUTS (outf, dregs (src0));
4264 OUTS (outf, ")");
4b7f6baa
CM
4265 }
4266 else if (sop == 3 && sopcde == 10)
4267 {
4b7f6baa 4268 OUTS (outf, dregs (dst0));
086134ec 4269 OUTS (outf, " = DEPOSIT (");
4b7f6baa 4270 OUTS (outf, dregs (src1));
086134ec 4271 OUTS (outf, ", ");
4b7f6baa 4272 OUTS (outf, dregs (src0));
086134ec 4273 OUTS (outf, ") (X)");
4b7f6baa
CM
4274 }
4275 else if (sop == 0 && sopcde == 11)
4276 {
4b7f6baa 4277 OUTS (outf, dregs_lo (dst0));
086134ec 4278 OUTS (outf, " = CC = BXORSHIFT (A0, ");
4b7f6baa
CM
4279 OUTS (outf, dregs (src0));
4280 OUTS (outf, ")");
4b7f6baa
CM
4281 }
4282 else if (sop == 1 && sopcde == 11)
4283 {
4b7f6baa 4284 OUTS (outf, dregs_lo (dst0));
086134ec 4285 OUTS (outf, " = CC = BXOR (A0, ");
4b7f6baa
CM
4286 OUTS (outf, dregs (src0));
4287 OUTS (outf, ")");
4b7f6baa
CM
4288 }
4289 else if (sop == 0 && sopcde == 12)
086134ec 4290 OUTS (outf, "A0 = BXORSHIFT (A0, A1, CC)");
b7d48530 4291
4b7f6baa
CM
4292 else if (sop == 1 && sopcde == 12)
4293 {
4b7f6baa 4294 OUTS (outf, dregs_lo (dst0));
086134ec 4295 OUTS (outf, " = CC = BXOR (A0, A1, CC)");
4b7f6baa
CM
4296 }
4297 else if (sop == 0 && sopcde == 13)
4298 {
4b7f6baa 4299 OUTS (outf, dregs (dst0));
086134ec 4300 OUTS (outf, " = ALIGN8 (");
4b7f6baa 4301 OUTS (outf, dregs (src1));
086134ec 4302 OUTS (outf, ", ");
4b7f6baa
CM
4303 OUTS (outf, dregs (src0));
4304 OUTS (outf, ")");
4b7f6baa
CM
4305 }
4306 else if (sop == 1 && sopcde == 13)
4307 {
4b7f6baa 4308 OUTS (outf, dregs (dst0));
086134ec 4309 OUTS (outf, " = ALIGN16 (");
4b7f6baa 4310 OUTS (outf, dregs (src1));
086134ec 4311 OUTS (outf, ", ");
4b7f6baa
CM
4312 OUTS (outf, dregs (src0));
4313 OUTS (outf, ")");
4b7f6baa
CM
4314 }
4315 else if (sop == 2 && sopcde == 13)
4316 {
4b7f6baa 4317 OUTS (outf, dregs (dst0));
086134ec 4318 OUTS (outf, " = ALIGN24 (");
4b7f6baa 4319 OUTS (outf, dregs (src1));
086134ec 4320 OUTS (outf, ", ");
4b7f6baa
CM
4321 OUTS (outf, dregs (src0));
4322 OUTS (outf, ")");
4b7f6baa
CM
4323 }
4324 else
b7d48530
NC
4325 return 0;
4326
4327 return 4;
4b7f6baa
CM
4328}
4329
4330static int
4331decode_dsp32shiftimm_0 (TIword iw0, TIword iw1, disassemble_info *outf)
4332{
b7d48530
NC
4333 /* dsp32shiftimm
4334 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
4335 | 1 | 1 | 0 | 0 |.M.| 1 | 1 | 0 | 1 | - | - |.sopcde............|
4336 |.sop...|.HLs...|.dst0......|.immag.................|.src1......|
4337 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4338 int src1 = ((iw1 >> DSP32ShiftImm_src1_bits) & DSP32ShiftImm_src1_mask);
4339 int sop = ((iw1 >> DSP32ShiftImm_sop_bits) & DSP32ShiftImm_sop_mask);
4340 int bit8 = ((iw1 >> 8) & 0x1);
4341 int immag = ((iw1 >> DSP32ShiftImm_immag_bits) & DSP32ShiftImm_immag_mask);
4b7f6baa 4342 int newimmag = (-(iw1 >> DSP32ShiftImm_immag_bits) & DSP32ShiftImm_immag_mask);
b7d48530
NC
4343 int dst0 = ((iw1 >> DSP32ShiftImm_dst0_bits) & DSP32ShiftImm_dst0_mask);
4344 int sopcde = ((iw0 >> (DSP32ShiftImm_sopcde_bits - 16)) & DSP32ShiftImm_sopcde_mask);
4345 int HLs = ((iw1 >> DSP32ShiftImm_HLs_bits) & DSP32ShiftImm_HLs_mask);
4b7f6baa
CM
4346
4347
331f1cbe 4348 if (sop == 0 && sopcde == 0)
4b7f6baa 4349 {
331f1cbe
BS
4350 OUTS (outf, (HLs & 2) ? dregs_hi (dst0) : dregs_lo (dst0));
4351 OUTS (outf, " = ");
4352 OUTS (outf, (HLs & 1) ? dregs_hi (src1) : dregs_lo (src1));
4353 OUTS (outf, " >>> ");
4b7f6baa 4354 OUTS (outf, uimm4 (newimmag));
4b7f6baa 4355 }
331f1cbe 4356 else if (sop == 1 && sopcde == 0 && bit8 == 0)
4b7f6baa 4357 {
331f1cbe
BS
4358 OUTS (outf, (HLs & 2) ? dregs_hi (dst0) : dregs_lo (dst0));
4359 OUTS (outf, " = ");
4360 OUTS (outf, (HLs & 1) ? dregs_hi (src1) : dregs_lo (src1));
4361 OUTS (outf, " << ");
4b7f6baa 4362 OUTS (outf, uimm4 (immag));
331f1cbe 4363 OUTS (outf, " (S)");
4b7f6baa 4364 }
331f1cbe 4365 else if (sop == 1 && sopcde == 0 && bit8 == 1)
4b7f6baa 4366 {
331f1cbe
BS
4367 OUTS (outf, (HLs & 2) ? dregs_hi (dst0) : dregs_lo (dst0));
4368 OUTS (outf, " = ");
4369 OUTS (outf, (HLs & 1) ? dregs_hi (src1) : dregs_lo (src1));
4370 OUTS (outf, " >>> ");
4b7f6baa 4371 OUTS (outf, uimm4 (newimmag));
331f1cbe 4372 OUTS (outf, " (S)");
4b7f6baa 4373 }
331f1cbe 4374 else if (sop == 2 && sopcde == 0 && bit8 == 0)
4b7f6baa 4375 {
331f1cbe
BS
4376 OUTS (outf, (HLs & 2) ? dregs_hi (dst0) : dregs_lo (dst0));
4377 OUTS (outf, " = ");
4378 OUTS (outf, (HLs & 1) ? dregs_hi (src1) : dregs_lo (src1));
4379 OUTS (outf, " << ");
4b7f6baa 4380 OUTS (outf, uimm4 (immag));
4b7f6baa 4381 }
331f1cbe 4382 else if (sop == 2 && sopcde == 0 && bit8 == 1)
4b7f6baa 4383 {
331f1cbe
BS
4384 OUTS (outf, (HLs & 2) ? dregs_hi (dst0) : dregs_lo (dst0));
4385 OUTS (outf, " = ");
4386 OUTS (outf, (HLs & 1) ? dregs_hi (src1) : dregs_lo (src1));
4387 OUTS (outf, " >> ");
4b7f6baa 4388 OUTS (outf, uimm4 (newimmag));
4b7f6baa 4389 }
4b7f6baa
CM
4390 else if (sop == 2 && sopcde == 3 && HLs == 1)
4391 {
086134ec 4392 OUTS (outf, "A1 = ROT A1 BY ");
4b7f6baa 4393 OUTS (outf, imm6 (immag));
4b7f6baa
CM
4394 }
4395 else if (sop == 0 && sopcde == 3 && HLs == 0 && bit8 == 0)
4396 {
086134ec 4397 OUTS (outf, "A0 = A0 << ");
4b7f6baa 4398 OUTS (outf, uimm5 (immag));
4b7f6baa
CM
4399 }
4400 else if (sop == 0 && sopcde == 3 && HLs == 0 && bit8 == 1)
4401 {
086134ec 4402 OUTS (outf, "A0 = A0 >>> ");
4b7f6baa 4403 OUTS (outf, uimm5 (newimmag));
4b7f6baa
CM
4404 }
4405 else if (sop == 0 && sopcde == 3 && HLs == 1 && bit8 == 0)
4406 {
086134ec 4407 OUTS (outf, "A1 = A1 << ");
4b7f6baa 4408 OUTS (outf, uimm5 (immag));
4b7f6baa
CM
4409 }
4410 else if (sop == 0 && sopcde == 3 && HLs == 1 && bit8 == 1)
4411 {
086134ec 4412 OUTS (outf, "A1 = A1 >>> ");
4b7f6baa 4413 OUTS (outf, uimm5 (newimmag));
4b7f6baa
CM
4414 }
4415 else if (sop == 1 && sopcde == 3 && HLs == 0)
4416 {
086134ec 4417 OUTS (outf, "A0 = A0 >> ");
4b7f6baa 4418 OUTS (outf, uimm5 (newimmag));
4b7f6baa
CM
4419 }
4420 else if (sop == 1 && sopcde == 3 && HLs == 1)
4421 {
086134ec 4422 OUTS (outf, "A1 = A1 >> ");
4b7f6baa 4423 OUTS (outf, uimm5 (newimmag));
4b7f6baa
CM
4424 }
4425 else if (sop == 2 && sopcde == 3 && HLs == 0)
4426 {
086134ec 4427 OUTS (outf, "A0 = ROT A0 BY ");
4b7f6baa 4428 OUTS (outf, imm6 (immag));
4b7f6baa
CM
4429 }
4430 else if (sop == 1 && sopcde == 1 && bit8 == 0)
4431 {
4b7f6baa 4432 OUTS (outf, dregs (dst0));
086134ec 4433 OUTS (outf, " = ");
4b7f6baa 4434 OUTS (outf, dregs (src1));
086134ec 4435 OUTS (outf, " << ");
4b7f6baa
CM
4436 OUTS (outf, uimm5 (immag));
4437 OUTS (outf, " (V, S)");
4b7f6baa
CM
4438 }
4439 else if (sop == 1 && sopcde == 1 && bit8 == 1)
4440 {
4b7f6baa 4441 OUTS (outf, dregs (dst0));
086134ec 4442 OUTS (outf, " = ");
4b7f6baa 4443 OUTS (outf, dregs (src1));
086134ec 4444 OUTS (outf, " >>> ");
4b7f6baa
CM
4445 OUTS (outf, imm5 (-immag));
4446 OUTS (outf, " (V)");
4b7f6baa
CM
4447 }
4448 else if (sop == 2 && sopcde == 1 && bit8 == 1)
4449 {
4b7f6baa 4450 OUTS (outf, dregs (dst0));
086134ec 4451 OUTS (outf, " = ");
4b7f6baa
CM
4452 OUTS (outf, dregs (src1));
4453 OUTS (outf, " >> ");
4454 OUTS (outf, uimm5 (newimmag));
4455 OUTS (outf, " (V)");
4b7f6baa
CM
4456 }
4457 else if (sop == 2 && sopcde == 1 && bit8 == 0)
4458 {
4b7f6baa 4459 OUTS (outf, dregs (dst0));
086134ec 4460 OUTS (outf, " = ");
4b7f6baa 4461 OUTS (outf, dregs (src1));
086134ec 4462 OUTS (outf, " << ");
4b7f6baa
CM
4463 OUTS (outf, imm5 (immag));
4464 OUTS (outf, " (V)");
4b7f6baa
CM
4465 }
4466 else if (sop == 0 && sopcde == 1)
4467 {
4b7f6baa 4468 OUTS (outf, dregs (dst0));
086134ec 4469 OUTS (outf, " = ");
4b7f6baa 4470 OUTS (outf, dregs (src1));
086134ec 4471 OUTS (outf, " >>> ");
4b7f6baa
CM
4472 OUTS (outf, uimm5 (newimmag));
4473 OUTS (outf, " (V)");
4b7f6baa
CM
4474 }
4475 else if (sop == 1 && sopcde == 2)
4476 {
4b7f6baa 4477 OUTS (outf, dregs (dst0));
086134ec 4478 OUTS (outf, " = ");
4b7f6baa 4479 OUTS (outf, dregs (src1));
086134ec 4480 OUTS (outf, " << ");
4b7f6baa 4481 OUTS (outf, uimm5 (immag));
086134ec 4482 OUTS (outf, " (S)");
4b7f6baa
CM
4483 }
4484 else if (sop == 2 && sopcde == 2 && bit8 == 1)
4485 {
4b7f6baa 4486 OUTS (outf, dregs (dst0));
086134ec 4487 OUTS (outf, " = ");
4b7f6baa 4488 OUTS (outf, dregs (src1));
086134ec 4489 OUTS (outf, " >> ");
4b7f6baa 4490 OUTS (outf, uimm5 (newimmag));
4b7f6baa
CM
4491 }
4492 else if (sop == 2 && sopcde == 2 && bit8 == 0)
4493 {
4b7f6baa 4494 OUTS (outf, dregs (dst0));
086134ec 4495 OUTS (outf, " = ");
4b7f6baa 4496 OUTS (outf, dregs (src1));
086134ec 4497 OUTS (outf, " << ");
4b7f6baa 4498 OUTS (outf, uimm5 (immag));
4b7f6baa
CM
4499 }
4500 else if (sop == 3 && sopcde == 2)
4501 {
4b7f6baa 4502 OUTS (outf, dregs (dst0));
086134ec 4503 OUTS (outf, " = ROT ");
4b7f6baa
CM
4504 OUTS (outf, dregs (src1));
4505 OUTS (outf, " BY ");
4506 OUTS (outf, imm6 (immag));
4b7f6baa
CM
4507 }
4508 else if (sop == 0 && sopcde == 2)
4509 {
4b7f6baa 4510 OUTS (outf, dregs (dst0));
086134ec 4511 OUTS (outf, " = ");
4b7f6baa 4512 OUTS (outf, dregs (src1));
086134ec 4513 OUTS (outf, " >>> ");
4b7f6baa 4514 OUTS (outf, uimm5 (newimmag));
4b7f6baa
CM
4515 }
4516 else
b7d48530
NC
4517 return 0;
4518
4519 return 4;
4b7f6baa
CM
4520}
4521
4522static int
4523decode_pseudoDEBUG_0 (TIword iw0, disassemble_info *outf)
4524{
b7d48530
NC
4525 /* pseudoDEBUG
4526 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
4527 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 |.fn....|.grp.......|.reg.......|
4528 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa
CM
4529 int fn = ((iw0 >> PseudoDbg_fn_bits) & PseudoDbg_fn_mask);
4530 int grp = ((iw0 >> PseudoDbg_grp_bits) & PseudoDbg_grp_mask);
4531 int reg = ((iw0 >> PseudoDbg_reg_bits) & PseudoDbg_reg_mask);
4532
4533 if (reg == 0 && fn == 3)
b7d48530
NC
4534 OUTS (outf, "DBG A0");
4535
4b7f6baa 4536 else if (reg == 1 && fn == 3)
b7d48530
NC
4537 OUTS (outf, "DBG A1");
4538
4b7f6baa 4539 else if (reg == 3 && fn == 3)
b7d48530
NC
4540 OUTS (outf, "ABORT");
4541
4b7f6baa 4542 else if (reg == 4 && fn == 3)
b7d48530
NC
4543 OUTS (outf, "HLT");
4544
4b7f6baa 4545 else if (reg == 5 && fn == 3)
b7d48530
NC
4546 OUTS (outf, "DBGHALT");
4547
4b7f6baa
CM
4548 else if (reg == 6 && fn == 3)
4549 {
086134ec 4550 OUTS (outf, "DBGCMPLX (");
4b7f6baa
CM
4551 OUTS (outf, dregs (grp));
4552 OUTS (outf, ")");
4b7f6baa
CM
4553 }
4554 else if (reg == 7 && fn == 3)
b7d48530
NC
4555 OUTS (outf, "DBG");
4556
4b7f6baa
CM
4557 else if (grp == 0 && fn == 2)
4558 {
4b7f6baa
CM
4559 OUTS (outf, "OUTC");
4560 OUTS (outf, dregs (reg));
4b7f6baa
CM
4561 }
4562 else if (fn == 0)
4563 {
4b7f6baa
CM
4564 OUTS (outf, "DBG");
4565 OUTS (outf, allregs (reg, grp));
4b7f6baa
CM
4566 }
4567 else if (fn == 1)
4568 {
4b7f6baa
CM
4569 OUTS (outf, "PRNT");
4570 OUTS (outf, allregs (reg, grp));
4b7f6baa
CM
4571 }
4572 else
b7d48530
NC
4573 return 0;
4574
4575 return 2;
4b7f6baa
CM
4576}
4577
4578static int
4579decode_pseudodbg_assert_0 (TIword iw0, TIword iw1, disassemble_info *outf)
4580{
b7d48530
NC
4581 /* pseudodbg_assert
4582 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
4583 | 1 | 1 | 1 | 1 | 0 | - | - | - | - | - |.dbgop.....|.regtest...|
4584 |.expected......................................................|
4585 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+ */
4b7f6baa 4586 int expected = ((iw1 >> PseudoDbg_Assert_expected_bits) & PseudoDbg_Assert_expected_mask);
b7d48530
NC
4587 int dbgop = ((iw0 >> (PseudoDbg_Assert_dbgop_bits - 16)) & PseudoDbg_Assert_dbgop_mask);
4588 int regtest = ((iw0 >> (PseudoDbg_Assert_regtest_bits - 16)) & PseudoDbg_Assert_regtest_mask);
4b7f6baa
CM
4589
4590 if (dbgop == 0)
4591 {
086134ec 4592 OUTS (outf, "DBGA (");
4b7f6baa 4593 OUTS (outf, dregs_lo (regtest));
086134ec 4594 OUTS (outf, ", ");
4b7f6baa
CM
4595 OUTS (outf, uimm16 (expected));
4596 OUTS (outf, ")");
4b7f6baa
CM
4597 }
4598 else if (dbgop == 1)
4599 {
086134ec 4600 OUTS (outf, "DBGA (");
4b7f6baa 4601 OUTS (outf, dregs_hi (regtest));
086134ec 4602 OUTS (outf, ", ");
4b7f6baa
CM
4603 OUTS (outf, uimm16 (expected));
4604 OUTS (outf, ")");
4b7f6baa
CM
4605 }
4606 else if (dbgop == 2)
4607 {
086134ec 4608 OUTS (outf, "DBGAL (");
4b7f6baa 4609 OUTS (outf, dregs (regtest));
086134ec 4610 OUTS (outf, ", ");
4b7f6baa
CM
4611 OUTS (outf, uimm16 (expected));
4612 OUTS (outf, ")");
4b7f6baa
CM
4613 }
4614 else if (dbgop == 3)
4615 {
086134ec 4616 OUTS (outf, "DBGAH (");
4b7f6baa 4617 OUTS (outf, dregs (regtest));
086134ec 4618 OUTS (outf, ", ");
4b7f6baa
CM
4619 OUTS (outf, uimm16 (expected));
4620 OUTS (outf, ")");
4b7f6baa
CM
4621 }
4622 else
b7d48530
NC
4623 return 0;
4624 return 4;
4b7f6baa
CM
4625}
4626
4627int
4628_print_insn_bfin (bfd_vma pc, disassemble_info *outf)
4629{
4b7f6baa
CM
4630 bfd_byte buf[4];
4631 TIword iw0;
4632 TIword iw1;
4633 int status;
b7d48530
NC
4634 int rv = 0;
4635
4b7f6baa
CM
4636 status = (*outf->read_memory_func) (pc & ~0x1, buf, 2, outf);
4637 status = (*outf->read_memory_func) ((pc + 2) & ~0x1, buf + 2, 2, outf);
4638
4639 iw0 = bfd_getl16 (buf);
4640 iw1 = bfd_getl16 (buf + 2);
4641
4642 if ((iw0 & 0xf7ff) == 0xc003 && iw1 == 0x1800)
4643 {
086134ec 4644 OUTS (outf, "MNOP");
4b7f6baa
CM
4645 return 4;
4646 }
4647 else if ((iw0 & 0xff00) == 0x0000)
b7d48530 4648 rv = decode_ProgCtrl_0 (iw0, outf);
4b7f6baa 4649 else if ((iw0 & 0xffc0) == 0x0240)
b7d48530 4650 rv = decode_CaCTRL_0 (iw0, outf);
4b7f6baa 4651 else if ((iw0 & 0xff80) == 0x0100)
b7d48530 4652 rv = decode_PushPopReg_0 (iw0, outf);
4b7f6baa 4653 else if ((iw0 & 0xfe00) == 0x0400)
b7d48530 4654 rv = decode_PushPopMultiple_0 (iw0, outf);
4b7f6baa 4655 else if ((iw0 & 0xfe00) == 0x0600)
b7d48530 4656 rv = decode_ccMV_0 (iw0, outf);
4b7f6baa 4657 else if ((iw0 & 0xf800) == 0x0800)
b7d48530 4658 rv = decode_CCflag_0 (iw0, outf);
4b7f6baa 4659 else if ((iw0 & 0xffe0) == 0x0200)
b7d48530 4660 rv = decode_CC2dreg_0 (iw0, outf);
4b7f6baa 4661 else if ((iw0 & 0xff00) == 0x0300)
b7d48530 4662 rv = decode_CC2stat_0 (iw0, outf);
4b7f6baa 4663 else if ((iw0 & 0xf000) == 0x1000)
b7d48530 4664 rv = decode_BRCC_0 (iw0, pc, outf);
4b7f6baa 4665 else if ((iw0 & 0xf000) == 0x2000)
b7d48530 4666 rv = decode_UJUMP_0 (iw0, pc, outf);
4b7f6baa 4667 else if ((iw0 & 0xf000) == 0x3000)
b7d48530 4668 rv = decode_REGMV_0 (iw0, outf);
4b7f6baa 4669 else if ((iw0 & 0xfc00) == 0x4000)
b7d48530 4670 rv = decode_ALU2op_0 (iw0, outf);
4b7f6baa 4671 else if ((iw0 & 0xfe00) == 0x4400)
b7d48530 4672 rv = decode_PTR2op_0 (iw0, outf);
4b7f6baa 4673 else if ((iw0 & 0xf800) == 0x4800)
b7d48530 4674 rv = decode_LOGI2op_0 (iw0, outf);
4b7f6baa 4675 else if ((iw0 & 0xf000) == 0x5000)
b7d48530 4676 rv = decode_COMP3op_0 (iw0, outf);
4b7f6baa 4677 else if ((iw0 & 0xf800) == 0x6000)
b7d48530 4678 rv = decode_COMPI2opD_0 (iw0, outf);
4b7f6baa 4679 else if ((iw0 & 0xf800) == 0x6800)
b7d48530 4680 rv = decode_COMPI2opP_0 (iw0, outf);
4b7f6baa 4681 else if ((iw0 & 0xf000) == 0x8000)
b7d48530 4682 rv = decode_LDSTpmod_0 (iw0, outf);
4b7f6baa 4683 else if ((iw0 & 0xff60) == 0x9e60)
b7d48530 4684 rv = decode_dagMODim_0 (iw0, outf);
4b7f6baa 4685 else if ((iw0 & 0xfff0) == 0x9f60)
b7d48530 4686 rv = decode_dagMODik_0 (iw0, outf);
4b7f6baa 4687 else if ((iw0 & 0xfc00) == 0x9c00)
b7d48530 4688 rv = decode_dspLDST_0 (iw0, outf);
4b7f6baa 4689 else if ((iw0 & 0xf000) == 0x9000)
b7d48530 4690 rv = decode_LDST_0 (iw0, outf);
4b7f6baa 4691 else if ((iw0 & 0xfc00) == 0xb800)
b7d48530 4692 rv = decode_LDSTiiFP_0 (iw0, outf);
4b7f6baa 4693 else if ((iw0 & 0xe000) == 0xA000)
b7d48530 4694 rv = decode_LDSTii_0 (iw0, outf);
4b7f6baa 4695 else if ((iw0 & 0xff80) == 0xe080 && (iw1 & 0x0C00) == 0x0000)
b7d48530 4696 rv = decode_LoopSetup_0 (iw0, iw1, pc, outf);
4b7f6baa 4697 else if ((iw0 & 0xff00) == 0xe100 && (iw1 & 0x0000) == 0x0000)
b7d48530 4698 rv = decode_LDIMMhalf_0 (iw0, iw1, outf);
4b7f6baa 4699 else if ((iw0 & 0xfe00) == 0xe200 && (iw1 & 0x0000) == 0x0000)
b7d48530 4700 rv = decode_CALLa_0 (iw0, iw1, pc, outf);
4b7f6baa 4701 else if ((iw0 & 0xfc00) == 0xe400 && (iw1 & 0x0000) == 0x0000)
b7d48530 4702 rv = decode_LDSTidxI_0 (iw0, iw1, outf);
4b7f6baa 4703 else if ((iw0 & 0xfffe) == 0xe800 && (iw1 & 0x0000) == 0x0000)
b7d48530 4704 rv = decode_linkage_0 (iw0, iw1, outf);
4b7f6baa 4705 else if ((iw0 & 0xf600) == 0xc000 && (iw1 & 0x0000) == 0x0000)
b7d48530 4706 rv = decode_dsp32mac_0 (iw0, iw1, outf);
4b7f6baa 4707 else if ((iw0 & 0xf600) == 0xc200 && (iw1 & 0x0000) == 0x0000)
b7d48530 4708 rv = decode_dsp32mult_0 (iw0, iw1, outf);
4b7f6baa 4709 else if ((iw0 & 0xf7c0) == 0xc400 && (iw1 & 0x0000) == 0x0000)
b7d48530 4710 rv = decode_dsp32alu_0 (iw0, iw1, outf);
4b7f6baa 4711 else if ((iw0 & 0xf780) == 0xc600 && (iw1 & 0x01c0) == 0x0000)
b7d48530 4712 rv = decode_dsp32shift_0 (iw0, iw1, outf);
4b7f6baa 4713 else if ((iw0 & 0xf780) == 0xc680 && (iw1 & 0x0000) == 0x0000)
b7d48530 4714 rv = decode_dsp32shiftimm_0 (iw0, iw1, outf);
4b7f6baa 4715 else if ((iw0 & 0xff00) == 0xf800)
b7d48530 4716 rv = decode_pseudoDEBUG_0 (iw0, outf);
4b7f6baa 4717#if 0
4b7f6baa 4718 else if ((iw0 & 0xFF00) == 0xF900)
b7d48530 4719 rv = decode_pseudoOChar_0 (iw0, iw1, pc, outf);
4b7f6baa 4720#endif
4b7f6baa 4721 else if ((iw0 & 0xFFC0) == 0xf000 && (iw1 & 0x0000) == 0x0000)
b7d48530 4722 rv = decode_pseudodbg_assert_0 (iw0, iw1, outf);
4b7f6baa 4723
b7d48530 4724 return rv;
4b7f6baa
CM
4725}
4726
4727
4728int
4729print_insn_bfin (bfd_vma pc, disassemble_info *outf)
4730{
471e4e36
JZ
4731 bfd_byte buf[2];
4732 unsigned short iw0;
4733 int status;
4b7f6baa 4734 int count = 0;
471e4e36
JZ
4735
4736 status = (*outf->read_memory_func) (pc & ~0x01, buf, 2, outf);
4737 iw0 = bfd_getl16 (buf);
4b7f6baa
CM
4738
4739 count += _print_insn_bfin (pc, outf);
471e4e36 4740
4b7f6baa 4741 /* Proper display of multiple issue instructions. */
471e4e36 4742
4b7f6baa 4743 if ((iw0 & 0xc000) == 0xc000 && (iw0 & BIT_MULTI_INS)
b7d48530 4744 && ((iw0 & 0xe800) != 0xe800 /* Not Linkage. */ ))
4b7f6baa 4745 {
086134ec 4746 parallel = 1;
4b7f6baa
CM
4747 outf->fprintf_func (outf->stream, " || ");
4748 count += _print_insn_bfin (pc + 4, outf);
4749 outf->fprintf_func (outf->stream, " || ");
4750 count += _print_insn_bfin (pc + 6, outf);
086134ec 4751 parallel = 0;
4b7f6baa
CM
4752 }
4753 if (count == 0)
4754 {
4755 outf->fprintf_func (outf->stream, "ILLEGAL");
4756 return 2;
4757 }
086134ec
BS
4758 if (!comment)
4759 outf->fprintf_func (outf->stream, ";");
4760
4761 comment = 0;
4762
4b7f6baa
CM
4763 return count;
4764}