1 /* Disassemble ADI Blackfin Instructions.
2 Copyright 2005 Free Software Foundation, Inc.
4 This program is free software; you can redistribute it and/or modify
5 it under the terms of the GNU General Public License as published by
6 the Free Software Foundation; either version 2 of the License, or
7 (at your option) any later version.
9 This program is distributed in the hope that it will be useful,
10 but WITHOUT ANY WARRANTY; without even the implied warranty of
11 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 GNU General Public License for more details.
14 You should have received a copy of the GNU General Public License
15 along with this program; if not, write to the Free Software
16 Foundation, Inc., 51 Franklin Street - Fifth Floor, Boston,
17 MA 02110-1301, USA. */
23 #include "opcode/bfin.h"
45 #define HOST_LONG_WORD_SIZE (sizeof(long)*8)
47 #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))
56 c_0
, c_1
, c_4
, c_2
, c_uimm2
, c_uimm3
, c_imm3
, c_pcrel4
,
57 c_imm4
, c_uimm4s4
, c_uimm4
, c_uimm4s2
, c_negimm5s4
, c_imm5
, c_uimm5
, c_imm6
,
58 c_imm7
, c_imm8
, c_uimm8
, c_pcrel8
, c_uimm8s4
, c_pcrel8s4
, c_lppcrel10
, c_pcrel10
,
59 c_pcrel12
, c_imm16s4
, c_luimm16
, c_imm16
, c_huimm16
, c_rimm16
, c_imm16s2
, c_uimm16s4
,
74 } constant_formats
[] =
76 { "0", 0, 0, 1, 0, 0, 0, 0, 0},
77 { "1", 0, 0, 1, 0, 0, 0, 0, 0},
78 { "4", 0, 0, 1, 0, 0, 0, 0, 0},
79 { "2", 0, 0, 1, 0, 0, 0, 0, 0},
80 { "uimm2", 2, 0, 0, 0, 0, 0, 0, 0},
81 { "uimm3", 3, 0, 0, 0, 0, 0, 0, 0},
82 { "imm3", 3, 0, 1, 0, 0, 0, 0, 0},
83 { "pcrel4", 4, 1, 0, 1, 1, 0, 0, 0},
84 { "imm4", 4, 0, 1, 0, 0, 0, 0, 0},
85 { "uimm4s4", 4, 0, 0, 0, 2, 0, 0, 1},
86 { "uimm4", 4, 0, 0, 0, 0, 0, 0, 0},
87 { "uimm4s2", 4, 0, 0, 0, 1, 0, 0, 1},
88 { "negimm5s4", 5, 0, 1, 0, 2, 0, 1, 0},
89 { "imm5", 5, 0, 1, 0, 0, 0, 0, 0},
90 { "uimm5", 5, 0, 0, 0, 0, 0, 0, 0},
91 { "imm6", 6, 0, 1, 0, 0, 0, 0, 0},
92 { "imm7", 7, 0, 1, 0, 0, 0, 0, 0},
93 { "imm8", 8, 0, 1, 0, 0, 0, 0, 0},
94 { "uimm8", 8, 0, 0, 0, 0, 0, 0, 0},
95 { "pcrel8", 8, 1, 0, 1, 1, 0, 0, 0},
96 { "uimm8s4", 8, 0, 0, 0, 2, 0, 0, 0},
97 { "pcrel8s4", 8, 1, 1, 1, 2, 0, 0, 0},
98 { "lppcrel10", 10, 1, 0, 1, 1, 0, 0, 0},
99 { "pcrel10", 10, 1, 1, 1, 1, 0, 0, 0},
100 { "pcrel12", 12, 1, 1, 1, 1, 0, 0, 0},
101 { "imm16s4", 16, 0, 1, 0, 2, 0, 0, 0},
102 { "luimm16", 16, 1, 0, 0, 0, 0, 0, 0},
103 { "imm16", 16, 0, 1, 0, 0, 0, 0, 0},
104 { "huimm16", 16, 1, 0, 0, 0, 0, 0, 0},
105 { "rimm16", 16, 1, 1, 0, 0, 0, 0, 0},
106 { "imm16s2", 16, 0, 1, 0, 1, 0, 0, 0},
107 { "uimm16s4", 16, 0, 0, 0, 2, 0, 0, 0},
108 { "uimm16", 16, 0, 0, 0, 0, 0, 0, 0},
109 { "pcrel24", 24, 1, 1, 1, 1, 0, 0, 0}
112 int _print_insn_bfin (bfd_vma pc
, disassemble_info
* outf
);
113 int print_insn_bfin (bfd_vma pc
, disassemble_info
* outf
);
116 fmtconst (const_forms_t cf
, TIword x
, bfd_vma pc
, disassemble_info
* outf
)
120 if (constant_formats
[cf
].reloc
)
122 bfd_vma ea
= (((constant_formats
[cf
].pcrel
? SIGNEXTEND (x
, constant_formats
[cf
].nbits
)
123 : x
) + constant_formats
[cf
].offset
) << constant_formats
[cf
].scale
);
124 if (constant_formats
[cf
].pcrel
)
127 outf
->print_address_func (ea
, outf
);
131 /* Negative constants have an implied sign bit. */
132 if (constant_formats
[cf
].negative
)
134 int nb
= constant_formats
[cf
].nbits
+ 1;
135 x
= x
| (1 << constant_formats
[cf
].nbits
);
136 x
= SIGNEXTEND (x
, nb
);
139 x
= constant_formats
[cf
].issigned
? SIGNEXTEND (x
, constant_formats
[cf
].nbits
) : x
;
141 if (constant_formats
[cf
].offset
)
142 x
+= constant_formats
[cf
].offset
;
144 if (constant_formats
[cf
].scale
)
145 x
<<= constant_formats
[cf
].scale
;
147 if (constant_formats
[cf
].issigned
&& x
< 0)
148 sprintf (buf
, "%ld", x
);
150 sprintf (buf
, "0x%lx", x
);
157 #undef HOST_LONG_WORD_SIZE
158 #define HOST_LONG_WORD_SIZE (sizeof(long)*8)
159 #define SIGNEXTEND(v, n) (((long)(v) << (HOST_LONG_WORD_SIZE - (n))) >> (HOST_LONG_WORD_SIZE - (n)))
160 #define MASKBITS(val, bits) (val & (( 1 << bits)-1))
162 enum machine_registers
164 REG_RL0
, REG_RL1
, REG_RL2
, REG_RL3
, REG_RL4
, REG_RL5
, REG_RL6
, REG_RL7
,
165 REG_RH0
, REG_RH1
, REG_RH2
, REG_RH3
, REG_RH4
, REG_RH5
, REG_RH6
, REG_RH7
,
166 REG_R0
, REG_R1
, REG_R2
, REG_R3
, REG_R4
, REG_R5
, REG_R6
, REG_R7
,
167 REG_R1_0
, REG_R3_2
, REG_R5_4
, REG_R7_6
, REG_P0
, REG_P1
, REG_P2
, REG_P3
,
168 REG_P4
, REG_P5
, REG_SP
, REG_FP
, REG_A0x
, REG_A1x
, REG_A0w
, REG_A1w
,
169 REG_A0
, REG_A1
, REG_I0
, REG_I1
, REG_I2
, REG_I3
, REG_M0
, REG_M1
,
170 REG_M2
, REG_M3
, REG_B0
, REG_B1
, REG_B2
, REG_B3
, REG_L0
, REG_L1
,
172 REG_AZ
, REG_AN
, REG_AC0
, REG_AC1
, REG_AV0
, REG_AV1
, REG_AV0S
, REG_AV1S
,
173 REG_AQ
, REG_V
, REG_VS
,
174 REG_sftreset
, REG_omode
, REG_excause
, REG_emucause
, REG_idle_req
, REG_hwerrcause
, REG_CC
, REG_LC0
,
175 REG_LC1
, REG_GP
, REG_ASTAT
, REG_RETS
, REG_LT0
, REG_LB0
, REG_LT1
, REG_LB1
,
176 REG_CYCLES
, REG_CYCLES2
, REG_USP
, REG_SEQSTAT
, REG_SYSCFG
, REG_RETI
, REG_RETX
, REG_RETN
,
177 REG_RETE
, REG_EMUDAT
, REG_BR0
, REG_BR1
, REG_BR2
, REG_BR3
, REG_BR4
, REG_BR5
, REG_BR6
,
178 REG_BR7
, REG_PL0
, REG_PL1
, REG_PL2
, REG_PL3
, REG_PL4
, REG_PL5
, REG_SLP
, REG_FLP
,
179 REG_PH0
, REG_PH1
, REG_PH2
, REG_PH3
, REG_PH4
, REG_PH5
, REG_SHP
, REG_FHP
,
180 REG_IL0
, REG_IL1
, REG_IL2
, REG_IL3
, REG_ML0
, REG_ML1
, REG_ML2
, REG_ML3
,
181 REG_BL0
, REG_BL1
, REG_BL2
, REG_BL3
, REG_LL0
, REG_LL1
, REG_LL2
, REG_LL3
,
182 REG_IH0
, REG_IH1
, REG_IH2
, REG_IH3
, REG_MH0
, REG_MH1
, REG_MH2
, REG_MH3
,
183 REG_BH0
, REG_BH1
, REG_BH2
, REG_BH3
, REG_LH0
, REG_LH1
, REG_LH2
, REG_LH3
,
189 rc_dregs_lo
, rc_dregs_hi
, rc_dregs
, rc_dregs_pair
, rc_pregs
, rc_spfp
, rc_dregs_hilo
, rc_accum_ext
,
190 rc_accum_word
, rc_accum
, rc_iregs
, rc_mregs
, rc_bregs
, rc_lregs
, rc_dpregs
, rc_gregs
,
191 rc_regs
, rc_statbits
, rc_ignore_bits
, rc_ccstat
, rc_counters
, rc_dregs2_sysregs1
, rc_open
, rc_sysregs2
,
192 rc_sysregs3
, rc_allregs
,
196 static char *reg_names
[] =
198 "R0.L", "R1.L", "R2.L", "R3.L", "R4.L", "R5.L", "R6.L", "R7.L",
199 "R0.H", "R1.H", "R2.H", "R3.H", "R4.H", "R5.H", "R6.H", "R7.H",
200 "R0", "R1", "R2", "R3", "R4", "R5", "R6", "R7",
201 "R1:0", "R3:2", "R5:4", "R7:6", "P0", "P1", "P2", "P3",
202 "P4", "P5", "SP", "FP", "A0.x", "A1.x", "A0.w", "A1.w",
203 "A0", "A1", "I0", "I1", "I2", "I3", "M0", "M1",
204 "M2", "M3", "B0", "B1", "B2", "B3", "L0", "L1",
206 "AZ", "AN", "AC0", "AC1", "AV0", "AV1", "AV0S", "AV1S",
208 "sftreset", "omode", "excause", "emucause", "idle_req", "hwerrcause", "CC", "LC0",
209 "LC1", "GP", "ASTAT", "RETS", "LT0", "LB0", "LT1", "LB1",
210 "CYCLES", "CYCLES2", "USP", "SEQSTAT", "SYSCFG", "RETI", "RETX", "RETN",
212 "R0.B", "R1.B", "R2.B", "R3.B", "R4.B", "R5.B", "R6.B", "R7.B",
213 "P0.L", "P1.L", "P2.L", "P3.L", "P4.L", "P5.L", "SP.L", "FP.L",
214 "P0.H", "P1.H", "P2.H", "P3.H", "P4.H", "P5.H", "SP.H", "FP.H",
215 "I0.L", "I1.L", "I2.L", "I3.L", "M0.L", "M1.L", "M2.L", "M3.L",
216 "B0.L", "B1.L", "B2.L", "B3.L", "L0.L", "L1.L", "L2.L", "L3.L",
217 "I0.H", "I1.H", "I2.H", "I3.H", "M0.H", "M1.H", "M2.H", "M3.H",
218 "B0.H", "B1.H", "B2.H", "B3.H", "L0.H", "L1.H", "L2.H", "L3.H",
223 #define REGNAME(x) ((x) < REG_LASTREG ? (reg_names[x]) : "...... Illegal register .......")
226 static enum machine_registers decode_dregs_lo
[] =
228 REG_RL0
, REG_RL1
, REG_RL2
, REG_RL3
, REG_RL4
, REG_RL5
, REG_RL6
, REG_RL7
,
231 #define dregs_lo(x) REGNAME(decode_dregs_lo[(x) & 7])
234 static enum machine_registers decode_dregs_hi
[] =
236 REG_RH0
, REG_RH1
, REG_RH2
, REG_RH3
, REG_RH4
, REG_RH5
, REG_RH6
, REG_RH7
,
239 #define dregs_hi(x) REGNAME(decode_dregs_hi[(x) & 7])
242 static enum machine_registers decode_dregs
[] =
244 REG_R0
, REG_R1
, REG_R2
, REG_R3
, REG_R4
, REG_R5
, REG_R6
, REG_R7
,
247 #define dregs(x) REGNAME(decode_dregs[(x) & 7])
250 static enum machine_registers decode_dregs_byte
[] =
252 REG_BR0
, REG_BR1
, REG_BR2
, REG_BR3
, REG_BR4
, REG_BR5
, REG_BR6
, REG_BR7
,
255 #define dregs_byte(x) REGNAME(decode_dregs_byte[(x) & 7])
256 #define dregs_pair(x) REGNAME(decode_dregs_pair[(x) & 7])
259 static enum machine_registers decode_pregs
[] =
261 REG_P0
, REG_P1
, REG_P2
, REG_P3
, REG_P4
, REG_P5
, REG_SP
, REG_FP
,
264 #define pregs(x) REGNAME(decode_pregs[(x) & 7])
265 #define spfp(x) REGNAME(decode_spfp[(x) & 1])
266 #define dregs_hilo(x,i) REGNAME(decode_dregs_hilo[((i)<<3)|x])
267 #define accum_ext(x) REGNAME(decode_accum_ext[(x) & 1])
268 #define accum_word(x) REGNAME(decode_accum_word[(x) & 1])
269 #define accum(x) REGNAME(decode_accum[(x) & 1])
272 static enum machine_registers decode_iregs
[] =
274 REG_I0
, REG_I1
, REG_I2
, REG_I3
,
277 #define iregs(x) REGNAME(decode_iregs[(x) & 3])
280 static enum machine_registers decode_mregs
[] =
282 REG_M0
, REG_M1
, REG_M2
, REG_M3
,
285 #define mregs(x) REGNAME(decode_mregs[(x) & 3])
286 #define bregs(x) REGNAME(decode_bregs[(x) & 3])
287 #define lregs(x) REGNAME(decode_lregs[(x) & 3])
290 static enum machine_registers decode_dpregs
[] =
292 REG_R0
, REG_R1
, REG_R2
, REG_R3
, REG_R4
, REG_R5
, REG_R6
, REG_R7
,
293 REG_P0
, REG_P1
, REG_P2
, REG_P3
, REG_P4
, REG_P5
, REG_SP
, REG_FP
,
296 #define dpregs(x) REGNAME(decode_dpregs[(x) & 15])
299 static enum machine_registers decode_gregs
[] =
301 REG_R0
, REG_R1
, REG_R2
, REG_R3
, REG_R4
, REG_R5
, REG_R6
, REG_R7
,
302 REG_P0
, REG_P1
, REG_P2
, REG_P3
, REG_P4
, REG_P5
, REG_SP
, REG_FP
,
305 #define gregs(x,i) REGNAME(decode_gregs[((i)<<3)|x])
307 /* [dregs pregs (iregs mregs) (bregs lregs)]. */
308 static enum machine_registers decode_regs
[] =
310 REG_R0
, REG_R1
, REG_R2
, REG_R3
, REG_R4
, REG_R5
, REG_R6
, REG_R7
,
311 REG_P0
, REG_P1
, REG_P2
, REG_P3
, REG_P4
, REG_P5
, REG_SP
, REG_FP
,
312 REG_I0
, REG_I1
, REG_I2
, REG_I3
, REG_M0
, REG_M1
, REG_M2
, REG_M3
,
313 REG_B0
, REG_B1
, REG_B2
, REG_B3
, REG_L0
, REG_L1
, REG_L2
, REG_L3
,
316 #define regs(x,i) REGNAME(decode_regs[((i)<<3)|x])
318 /* [dregs pregs (iregs mregs) (bregs lregs) Low Half]. */
319 static enum machine_registers decode_regs_lo
[] =
321 REG_RL0
, REG_RL1
, REG_RL2
, REG_RL3
, REG_RL4
, REG_RL5
, REG_RL6
, REG_RL7
,
322 REG_PL0
, REG_PL1
, REG_PL2
, REG_PL3
, REG_PL4
, REG_PL5
, REG_SLP
, REG_FLP
,
323 REG_IL0
, REG_IL1
, REG_IL2
, REG_IL3
, REG_ML0
, REG_ML1
, REG_ML2
, REG_ML3
,
324 REG_BL0
, REG_BL1
, REG_BL2
, REG_BL3
, REG_LL0
, REG_LL1
, REG_LL2
, REG_LL3
,
327 #define regs_lo(x,i) REGNAME(decode_regs_lo[((i)<<3)|x])
328 /* [dregs pregs (iregs mregs) (bregs lregs) High Half]. */
329 static enum machine_registers decode_regs_hi
[] =
331 REG_RH0
, REG_RH1
, REG_RH2
, REG_RH3
, REG_RH4
, REG_RH5
, REG_RH6
, REG_RH7
,
332 REG_PH0
, REG_PH1
, REG_PH2
, REG_PH3
, REG_PH4
, REG_PH5
, REG_SHP
, REG_FHP
,
333 REG_IH0
, REG_IH1
, REG_IH2
, REG_IH3
, REG_MH0
, REG_MH1
, REG_LH2
, REG_MH3
,
334 REG_BH0
, REG_BH1
, REG_BH2
, REG_BH3
, REG_LH0
, REG_LH1
, REG_LH2
, REG_LH3
,
337 #define regs_hi(x,i) REGNAME(decode_regs_hi[((i)<<3)|x])
339 static enum machine_registers decode_statbits
[] =
341 REG_AZ
, REG_AN
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_AQ
, REG_LASTREG
,
342 REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_AC0
, REG_AC1
, REG_LASTREG
, REG_LASTREG
,
343 REG_AV0
, REG_AV0S
, REG_AV1
, REG_AV1S
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
,
344 REG_V
, REG_VS
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
,
347 #define statbits(x) REGNAME(decode_statbits[(x) & 31])
348 #define ignore_bits(x) REGNAME(decode_ignore_bits[(x) & 7])
349 #define ccstat(x) REGNAME(decode_ccstat[(x) & 0])
352 static enum machine_registers decode_counters
[] =
357 #define counters(x) REGNAME(decode_counters[(x) & 1])
358 #define dregs2_sysregs1(x) REGNAME(decode_dregs2_sysregs1[(x) & 7])
360 /* [dregs pregs (iregs mregs) (bregs lregs)
361 dregs2_sysregs1 open sysregs2 sysregs3]. */
362 static enum machine_registers decode_allregs
[] =
364 REG_R0
, REG_R1
, REG_R2
, REG_R3
, REG_R4
, REG_R5
, REG_R6
, REG_R7
,
365 REG_P0
, REG_P1
, REG_P2
, REG_P3
, REG_P4
, REG_P5
, REG_SP
, REG_FP
,
366 REG_I0
, REG_I1
, REG_I2
, REG_I3
, REG_M0
, REG_M1
, REG_M2
, REG_M3
,
367 REG_B0
, REG_B1
, REG_B2
, REG_B3
, REG_L0
, REG_L1
, REG_L2
, REG_L3
,
368 REG_A0x
, REG_A0w
, REG_A1x
, REG_A1w
, REG_GP
, REG_LASTREG
, REG_ASTAT
, REG_RETS
,
369 REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
, REG_LASTREG
,
370 REG_LC0
, REG_LT0
, REG_LB0
, REG_LC1
, REG_LT1
, REG_LB1
, REG_CYCLES
, REG_CYCLES2
,
371 REG_USP
, REG_SEQSTAT
, REG_SYSCFG
, REG_RETI
, REG_RETX
, REG_RETN
, REG_RETE
, REG_EMUDAT
, REG_LASTREG
,
374 #define allregs(x,i) REGNAME(decode_allregs[((i) << 3) | x])
375 #define uimm16s4(x) fmtconst(c_uimm16s4, x, 0, outf)
376 #define pcrel4(x) fmtconst(c_pcrel4, x, pc, outf)
377 #define pcrel8(x) fmtconst(c_pcrel8, x, pc, outf)
378 #define pcrel8s4(x) fmtconst(c_pcrel8s4, x, pc, outf)
379 #define pcrel10(x) fmtconst(c_pcrel10, x, pc, outf)
380 #define pcrel12(x) fmtconst(c_pcrel12, x, pc, outf)
381 #define negimm5s4(x) fmtconst(c_negimm5s4, x, 0, outf)
382 #define rimm16(x) fmtconst(c_rimm16, x, 0, outf)
383 #define huimm16(x) fmtconst(c_huimm16, x, 0, outf)
384 #define imm16(x) fmtconst(c_imm16, x, 0, outf)
385 #define uimm2(x) fmtconst(c_uimm2, x, 0, outf)
386 #define uimm3(x) fmtconst(c_uimm3, x, 0, outf)
387 #define luimm16(x) fmtconst(c_luimm16, x, 0, outf)
388 #define uimm4(x) fmtconst(c_uimm4, x, 0, outf)
389 #define uimm5(x) fmtconst(c_uimm5, x, 0, outf)
390 #define imm16s2(x) fmtconst(c_imm16s2, x, 0, outf)
391 #define uimm8(x) fmtconst(c_uimm8, x, 0, outf)
392 #define imm16s4(x) fmtconst(c_imm16s4, x, 0, outf)
393 #define uimm4s2(x) fmtconst(c_uimm4s2, x, 0, outf)
394 #define uimm4s4(x) fmtconst(c_uimm4s4, x, 0, outf)
395 #define lppcrel10(x) fmtconst(c_lppcrel10, x, pc, outf)
396 #define imm3(x) fmtconst(c_imm3, x, 0, outf)
397 #define imm4(x) fmtconst(c_imm4, x, 0, outf)
398 #define uimm8s4(x) fmtconst(c_uimm8s4, x, 0, outf)
399 #define imm5(x) fmtconst(c_imm5, x, 0, outf)
400 #define imm6(x) fmtconst(c_imm6, x, 0, outf)
401 #define imm7(x) fmtconst(c_imm7, x, 0, outf)
402 #define imm8(x) fmtconst(c_imm8, x, 0, outf)
403 #define pcrel24(x) fmtconst(c_pcrel24, x, pc, outf)
404 #define uimm16(x) fmtconst(c_uimm16, x, 0, outf)
406 /* (arch.pm)arch_disassembler_functions. */
410 #define OUTS(p,txt) ((p) ? (((txt)[0]) ? (p->fprintf_func)(p->stream, txt) :0) :0)
415 amod0 (int s0
, int x0
, disassemble_info
*outf
)
417 if (s0
== 0 && x0
== 0)
422 else if (s0
== 1 && x0
== 0)
428 else if (s0
== 0 && x0
== 1)
434 else if (s0
== 1 && x0
== 1)
437 OUTS (outf
, "(SCO)");
441 goto illegal_instruction
;
447 amod1 (int s0
, int x0
, disassemble_info
*outf
)
449 if (s0
== 0 && x0
== 0)
455 else if (s0
== 1 && x0
== 0)
462 goto illegal_instruction
;
468 amod0amod2 (int s0
, int x0
, int aop0
, disassemble_info
*outf
)
470 if (s0
== 0 && x0
== 0 && aop0
== 0)
475 else if (s0
== 1 && x0
== 0 && aop0
== 0)
481 else if (s0
== 0 && x0
== 1 && aop0
== 0)
487 else if (s0
== 1 && x0
== 1 && aop0
== 0)
490 OUTS (outf
, "(SCO)");
493 else if (s0
== 0 && x0
== 0 && aop0
== 2)
496 OUTS (outf
, "(ASR)");
499 else if (s0
== 1 && x0
== 0 && aop0
== 2)
501 notethat ("(S,ASR)");
502 OUTS (outf
, "(S,ASR)");
505 else if (s0
== 0 && x0
== 1 && aop0
== 2)
507 notethat ("(CO,ASR)");
508 OUTS (outf
, "(CO,ASR)");
511 else if (s0
== 1 && x0
== 1 && aop0
== 2)
513 notethat ("(SCO,ASR)");
514 OUTS (outf
, "(SCO,ASR)");
517 else if (s0
== 0 && x0
== 0 && aop0
== 3)
520 OUTS (outf
, "(ASL)");
523 else if (s0
== 1 && x0
== 0 && aop0
== 3)
525 notethat ("(S,ASL)");
526 OUTS (outf
, "(S,ASL)");
529 else if (s0
== 0 && x0
== 1 && aop0
== 3)
531 notethat ("(CO,ASL)");
532 OUTS (outf
, "(CO,ASL)");
535 else if (s0
== 1 && x0
== 1 && aop0
== 3)
537 notethat ("(SCO,ASL)");
538 OUTS (outf
, "(SCO,ASL)");
542 goto illegal_instruction
;
548 searchmod (int r0
, disassemble_info
*outf
)
575 goto illegal_instruction
;
581 aligndir (int r0
, disassemble_info
*outf
)
595 goto illegal_instruction
;
601 decode_multfunc (int h0
, int h1
, int src0
, int src1
, disassemble_info
* outf
)
606 s0
= dregs_hi (src0
);
608 s0
= dregs_lo (src0
);
611 s1
= dregs_hi (src1
);
613 s1
= dregs_lo (src1
);
622 decode_macfunc (int which
, int op
, int h0
, int h1
, int src0
, int src1
, disassemble_info
* outf
)
625 char *sop
= "<unknown op>";
655 decode_multfunc (h0
, h1
, src0
, src1
, outf
);
661 decode_optmode (int mod
, int MM
, disassemble_info
*outf
)
663 if (mod
== 0 && MM
== 0)
678 OUTS (outf
, "S2RND");
681 else if (mod
== M_W32
)
683 else if (mod
== M_FU
)
685 else if (mod
== M_TFU
)
687 else if (mod
== M_IS
)
689 else if (mod
== M_ISS2
)
691 else if (mod
== M_IH
)
693 else if (mod
== M_IU
)
701 decode_ProgCtrl_0 (TIword iw0
, disassemble_info
*outf
)
704 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
705 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |.prgfunc.......|.poprnd........|
706 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
708 int poprnd
= ((iw0
>> ProgCtrl_poprnd_bits
) & ProgCtrl_poprnd_mask
);
709 int prgfunc
= ((iw0
>> ProgCtrl_prgfunc_bits
) & ProgCtrl_prgfunc_mask
);
711 if (prgfunc
== 0 && poprnd
== 0)
717 else if (prgfunc
== 1 && poprnd
== 0)
723 else if (prgfunc
== 1 && poprnd
== 1)
729 else if (prgfunc
== 1 && poprnd
== 2)
735 else if (prgfunc
== 1 && poprnd
== 3)
741 else if (prgfunc
== 1 && poprnd
== 4)
747 else if (prgfunc
== 2 && poprnd
== 0)
753 else if (prgfunc
== 2 && poprnd
== 3)
756 OUTS (outf
, "CSYNC");
759 else if (prgfunc
== 2 && poprnd
== 4)
762 OUTS (outf
, "SSYNC");
765 else if (prgfunc
== 2 && poprnd
== 5)
767 notethat ("EMUEXCPT");
768 OUTS (outf
, "EMUEXCPT");
771 else if (prgfunc
== 3)
773 notethat ("CLI dregs");
775 OUTS (outf
, dregs (poprnd
));
778 else if (prgfunc
== 4)
780 notethat ("STI dregs");
782 OUTS (outf
, dregs (poprnd
));
785 else if (prgfunc
== 5)
787 notethat ("JUMP ( pregs )");
788 OUTS (outf
, "JUMP (");
789 OUTS (outf
, pregs (poprnd
));
793 else if (prgfunc
== 6)
795 notethat ("CALL ( pregs )");
796 OUTS (outf
, "CALL (");
797 OUTS (outf
, pregs (poprnd
));
801 else if (prgfunc
== 7)
803 notethat ("CALL ( PC + pregs )");
804 OUTS (outf
, "CALL (PC+");
805 OUTS (outf
, pregs (poprnd
));
809 else if (prgfunc
== 8)
811 notethat ("JUMP ( PC + pregs )");
812 OUTS (outf
, "JUMP (PC+");
813 OUTS (outf
, pregs (poprnd
));
817 else if (prgfunc
== 9)
819 notethat ("RAISE uimm4");
820 OUTS (outf
, "RAISE ");
821 OUTS (outf
, uimm4 (poprnd
));
824 else if (prgfunc
== 10)
826 notethat ("EXCPT uimm4");
827 OUTS (outf
, "EXCPT ");
828 OUTS (outf
, uimm4 (poprnd
));
831 else if (prgfunc
== 11)
833 notethat ("TESTSET ( pregs )");
834 OUTS (outf
, "TESTSET (");
835 OUTS (outf
, pregs (poprnd
));
840 goto illegal_instruction
;
846 decode_CaCTRL_0 (TIword iw0
, disassemble_info
*outf
)
849 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
850 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 1 |.a.|.op....|.reg.......|
851 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
853 int a
= ((iw0
>> CaCTRL_a_bits
) & CaCTRL_a_mask
);
854 int op
= ((iw0
>> CaCTRL_op_bits
) & CaCTRL_op_mask
);
855 int reg
= ((iw0
>> CaCTRL_reg_bits
) & CaCTRL_reg_mask
);
857 if (a
== 0 && op
== 0)
859 notethat ("PREFETCH [ pregs ]");
860 OUTS (outf
, "PREFETCH[");
861 OUTS (outf
, pregs (reg
));
865 else if (a
== 0 && op
== 1)
867 notethat ("FLUSHINV [ pregs ]");
868 OUTS (outf
, "FLUSHINV[");
869 OUTS (outf
, pregs (reg
));
873 else if (a
== 0 && op
== 2)
875 notethat ("FLUSH [ pregs ]");
876 OUTS (outf
, "FLUSH[");
877 OUTS (outf
, pregs (reg
));
881 else if (a
== 0 && op
== 3)
883 notethat ("IFLUSH [ pregs ]");
884 OUTS (outf
, "IFLUSH[");
885 OUTS (outf
, pregs (reg
));
889 else if (a
== 1 && op
== 0)
891 notethat ("PREFETCH [ pregs ++ ]");
892 OUTS (outf
, "PREFETCH[");
893 OUTS (outf
, pregs (reg
));
897 else if (a
== 1 && op
== 1)
899 notethat ("FLUSHINV [ pregs ++ ]");
900 OUTS (outf
, "FLUSHINV[");
901 OUTS (outf
, pregs (reg
));
905 else if (a
== 1 && op
== 2)
907 notethat ("FLUSH [ pregs ++ ]");
908 OUTS (outf
, "FLUSH[");
909 OUTS (outf
, pregs (reg
));
913 else if (a
== 1 && op
== 3)
915 notethat ("IFLUSH [ pregs ++ ]");
916 OUTS (outf
, "IFLUSH[");
917 OUTS (outf
, pregs (reg
));
922 goto illegal_instruction
;
928 decode_PushPopReg_0 (TIword iw0
, disassemble_info
*outf
)
932 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
933 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |.W.|.grp.......|.reg.......|
934 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
936 int W
= ((iw0
>> PushPopReg_W_bits
) & PushPopReg_W_mask
);
937 int grp
= ((iw0
>> PushPopReg_grp_bits
) & PushPopReg_grp_mask
);
938 int reg
= ((iw0
>> PushPopReg_reg_bits
) & PushPopReg_reg_mask
);
942 notethat ("allregs = [ SP ++ ]");
943 OUTS (outf
, allregs (reg
, grp
));
944 OUTS (outf
, " = [SP++]");
949 notethat ("[ -- SP ] = allregs");
950 OUTS (outf
, "[--SP] = ");
951 OUTS (outf
, allregs (reg
, grp
));
955 goto illegal_instruction
;
961 decode_PushPopMultiple_0 (TIword iw0
, disassemble_info
*outf
)
964 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
965 | 0 | 0 | 0 | 0 | 0 | 1 | 0 |.d.|.p.|.W.|.dr........|.pr........|
966 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
968 int p
= ((iw0
>> PushPopMultiple_p_bits
) & PushPopMultiple_p_mask
);
969 int d
= ((iw0
>> PushPopMultiple_d_bits
) & PushPopMultiple_d_mask
);
970 int W
= ((iw0
>> PushPopMultiple_W_bits
) & PushPopMultiple_W_mask
);
971 int dr
= ((iw0
>> PushPopMultiple_dr_bits
) & PushPopMultiple_dr_mask
);
972 int pr
= ((iw0
>> PushPopMultiple_pr_bits
) & PushPopMultiple_pr_mask
);
975 sprintf (ps
, "%d", pr
);
976 sprintf (ds
, "%d", dr
);
978 if (W
== 1 && d
== 1 && p
== 1)
980 notethat ("[ -- SP ] = ( R7 : reglim , P5 : reglim )");
981 OUTS (outf
, "[--SP] = (R7:");
983 OUTS (outf
, ", P5:");
988 else if (W
== 1 && d
== 1 && p
== 0)
990 notethat ("[ -- SP ] = ( R7 : reglim )");
991 OUTS (outf
, "[--SP] = (R7:");
996 else if (W
== 1 && d
== 0 && p
== 1)
998 notethat ("[ -- SP ] = ( P5 : reglim )");
999 OUTS (outf
, "[--SP] = (P5:");
1004 else if (W
== 0 && d
== 1 && p
== 1)
1006 notethat ("( R7 : reglim , P5 : reglim ) = [ SP ++ ]");
1007 OUTS (outf
, "(R7:");
1009 OUTS (outf
, ", P5:");
1011 OUTS (outf
, ") = [SP++]");
1014 else if (W
== 0 && d
== 1 && p
== 0)
1016 notethat ("( R7 : reglim ) = [ SP ++ ]");
1017 OUTS (outf
, "(R7:");
1019 OUTS (outf
, ") = [SP++]");
1022 else if (W
== 0 && d
== 0 && p
== 1)
1024 notethat ("( P5 : reglim ) = [ SP ++ ]");
1025 OUTS (outf
, "(P5:");
1027 OUTS (outf
, ") = [SP++]");
1031 goto illegal_instruction
;
1032 illegal_instruction
:
1037 decode_ccMV_0 (TIword iw0
, disassemble_info
*outf
)
1040 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1041 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |.T.|.d.|.s.|.dst.......|.src.......|
1042 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1044 int s
= ((iw0
>> CCmv_s_bits
) & CCmv_s_mask
);
1045 int d
= ((iw0
>> CCmv_d_bits
) & CCmv_d_mask
);
1046 int T
= ((iw0
>> CCmv_T_bits
) & CCmv_T_mask
);
1047 int src
= ((iw0
>> CCmv_src_bits
) & CCmv_src_mask
);
1048 int dst
= ((iw0
>> CCmv_dst_bits
) & CCmv_dst_mask
);
1052 notethat ("IF CC gregs = gregs");
1053 OUTS (outf
, "IF CC ");
1054 OUTS (outf
, gregs (dst
, d
));
1056 OUTS (outf
, gregs (src
, s
));
1061 notethat ("IF ! CC gregs = gregs");
1062 OUTS (outf
, "IF ! CC ");
1063 OUTS (outf
, gregs (dst
, d
));
1065 OUTS (outf
, gregs (src
, s
));
1069 goto illegal_instruction
;
1070 illegal_instruction
:
1075 decode_CCflag_0 (TIword iw0
, disassemble_info
*outf
)
1078 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1079 | 0 | 0 | 0 | 0 | 1 |.I.|.opc.......|.G.|.y.........|.x.........|
1080 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1082 int x
= ((iw0
>> CCflag_x_bits
) & CCflag_x_mask
);
1083 int y
= ((iw0
>> CCflag_y_bits
) & CCflag_y_mask
);
1084 int I
= ((iw0
>> CCflag_I_bits
) & CCflag_I_mask
);
1085 int G
= ((iw0
>> CCflag_G_bits
) & CCflag_G_mask
);
1086 int opc
= ((iw0
>> CCflag_opc_bits
) & CCflag_opc_mask
);
1088 if (opc
== 0 && I
== 0 && G
== 0)
1090 notethat ("CC = dregs == dregs");
1092 OUTS (outf
, dregs (x
));
1094 OUTS (outf
, dregs (y
));
1097 else if (opc
== 1 && I
== 0 && G
== 0)
1099 notethat ("CC = dregs < dregs");
1101 OUTS (outf
, dregs (x
));
1103 OUTS (outf
, dregs (y
));
1106 else if (opc
== 2 && I
== 0 && G
== 0)
1108 notethat ("CC = dregs <= dregs");
1110 OUTS (outf
, dregs (x
));
1112 OUTS (outf
, dregs (y
));
1115 else if (opc
== 3 && I
== 0 && G
== 0)
1117 notethat ("CC = dregs < dregs ( IU )");
1119 OUTS (outf
, dregs (x
));
1121 OUTS (outf
, dregs (y
));
1122 OUTS (outf
, "(IU)");
1125 else if (opc
== 4 && I
== 0 && G
== 0)
1127 notethat ("CC = dregs <= dregs ( IU )");
1129 OUTS (outf
, dregs (x
));
1131 OUTS (outf
, dregs (y
));
1132 OUTS (outf
, "(IU)");
1135 else if (opc
== 0 && I
== 1 && G
== 0)
1137 notethat ("CC = dregs == imm3");
1139 OUTS (outf
, dregs (x
));
1141 OUTS (outf
, imm3 (y
));
1144 else if (opc
== 1 && I
== 1 && G
== 0)
1146 notethat ("CC = dregs < imm3");
1148 OUTS (outf
, dregs (x
));
1150 OUTS (outf
, imm3 (y
));
1153 else if (opc
== 2 && I
== 1 && G
== 0)
1155 notethat ("CC = dregs <= imm3");
1157 OUTS (outf
, dregs (x
));
1159 OUTS (outf
, imm3 (y
));
1162 else if (opc
== 3 && I
== 1 && G
== 0)
1164 notethat ("CC = dregs < uimm3 ( IU )");
1166 OUTS (outf
, dregs (x
));
1168 OUTS (outf
, uimm3 (y
));
1169 OUTS (outf
, "(IU)");
1172 else if (opc
== 4 && I
== 1 && G
== 0)
1174 notethat ("CC = dregs <= uimm3 ( IU )");
1176 OUTS (outf
, dregs (x
));
1178 OUTS (outf
, uimm3 (y
));
1179 OUTS (outf
, "(IU)");
1182 else if (opc
== 0 && I
== 0 && G
== 1)
1184 notethat ("CC = pregs == pregs");
1186 OUTS (outf
, pregs (x
));
1188 OUTS (outf
, pregs (y
));
1191 else if (opc
== 1 && I
== 0 && G
== 1)
1193 notethat ("CC = pregs < pregs");
1195 OUTS (outf
, pregs (x
));
1197 OUTS (outf
, pregs (y
));
1200 else if (opc
== 2 && I
== 0 && G
== 1)
1202 notethat ("CC = pregs <= pregs");
1204 OUTS (outf
, pregs (x
));
1206 OUTS (outf
, pregs (y
));
1209 else if (opc
== 3 && I
== 0 && G
== 1)
1211 notethat ("CC = pregs < pregs ( IU )");
1213 OUTS (outf
, pregs (x
));
1215 OUTS (outf
, pregs (y
));
1216 OUTS (outf
, "(IU)");
1219 else if (opc
== 4 && I
== 0 && G
== 1)
1221 notethat ("CC = pregs <= pregs ( IU )");
1223 OUTS (outf
, pregs (x
));
1225 OUTS (outf
, pregs (y
));
1226 OUTS (outf
, "(IU)");
1229 else if (opc
== 0 && I
== 1 && G
== 1)
1231 notethat ("CC = pregs == imm3");
1233 OUTS (outf
, pregs (x
));
1235 OUTS (outf
, imm3 (y
));
1238 else if (opc
== 1 && I
== 1 && G
== 1)
1240 notethat ("CC = pregs < imm3");
1242 OUTS (outf
, pregs (x
));
1244 OUTS (outf
, imm3 (y
));
1247 else if (opc
== 2 && I
== 1 && G
== 1)
1249 notethat ("CC = pregs <= imm3");
1251 OUTS (outf
, pregs (x
));
1253 OUTS (outf
, imm3 (y
));
1256 else if (opc
== 3 && I
== 1 && G
== 1)
1258 notethat ("CC = pregs < uimm3 ( IU )");
1260 OUTS (outf
, pregs (x
));
1262 OUTS (outf
, uimm3 (y
));
1263 OUTS (outf
, "(IU)");
1266 else if (opc
== 4 && I
== 1 && G
== 1)
1268 notethat ("CC = pregs <= uimm3 ( IU )");
1270 OUTS (outf
, pregs (x
));
1272 OUTS (outf
, uimm3 (y
));
1273 OUTS (outf
, "(IU)");
1276 else if (opc
== 5 && I
== 0 && G
== 0)
1278 notethat ("CC = A0 == A1");
1279 OUTS (outf
, "CC=A0==A1");
1282 else if (opc
== 6 && I
== 0 && G
== 0)
1284 notethat ("CC = A0 < A1");
1285 OUTS (outf
, "CC=A0<A1");
1288 else if (opc
== 7 && I
== 0 && G
== 0)
1290 notethat ("CC = A0 <= A1");
1291 OUTS (outf
, "CC=A0<=A1");
1295 goto illegal_instruction
;
1296 illegal_instruction
:
1301 decode_CC2dreg_0 (TIword iw0
, disassemble_info
*outf
)
1304 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1305 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 0 | 0 | 0 | 0 |.op....|.reg.......|
1306 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1308 int op
= ((iw0
>> CC2dreg_op_bits
) & CC2dreg_op_mask
);
1309 int reg
= ((iw0
>> CC2dreg_reg_bits
) & CC2dreg_reg_mask
);
1313 notethat ("dregs = CC");
1314 OUTS (outf
, dregs (reg
));
1320 notethat ("CC = dregs");
1322 OUTS (outf
, dregs (reg
));
1327 notethat ("CC =! CC");
1328 OUTS (outf
, "CC=!CC");
1332 goto illegal_instruction
;
1333 illegal_instruction
:
1338 decode_CC2stat_0 (TIword iw0
, disassemble_info
*outf
)
1341 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1342 | 0 | 0 | 0 | 0 | 0 | 0 | 1 | 1 |.D.|.op....|.cbit..............|
1343 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1345 int D
= ((iw0
>> CC2stat_D_bits
) & CC2stat_D_mask
);
1346 int op
= ((iw0
>> CC2stat_op_bits
) & CC2stat_op_mask
);
1347 int cbit
= ((iw0
>> CC2stat_cbit_bits
) & CC2stat_cbit_mask
);
1349 if (op
== 0 && D
== 0)
1351 notethat ("CC = statbits");
1352 OUTS (outf
, "CC = ");
1353 OUTS (outf
, statbits (cbit
));
1356 else if (op
== 1 && D
== 0)
1358 notethat ("CC |= statbits");
1359 OUTS (outf
, "CC|=");
1360 OUTS (outf
, statbits (cbit
));
1363 else if (op
== 2 && D
== 0)
1365 notethat ("CC &= statbits");
1366 OUTS (outf
, "CC&=");
1367 OUTS (outf
, statbits (cbit
));
1370 else if (op
== 3 && D
== 0)
1372 notethat ("CC ^= statbits");
1373 OUTS (outf
, "CC^=");
1374 OUTS (outf
, statbits (cbit
));
1377 else if (op
== 0 && D
== 1)
1379 notethat ("statbits = CC");
1380 OUTS (outf
, statbits (cbit
));
1384 else if (op
== 1 && D
== 1)
1386 notethat ("statbits |= CC");
1387 OUTS (outf
, statbits (cbit
));
1388 OUTS (outf
, "|=CC");
1391 else if (op
== 2 && D
== 1)
1393 notethat ("statbits &= CC");
1394 OUTS (outf
, statbits (cbit
));
1395 OUTS (outf
, "&=CC");
1398 else if (op
== 3 && D
== 1)
1400 notethat ("statbits ^= CC");
1401 OUTS (outf
, statbits (cbit
));
1402 OUTS (outf
, "^=CC");
1406 goto illegal_instruction
;
1407 illegal_instruction
:
1412 decode_BRCC_0 (TIword iw0
, bfd_vma pc
, disassemble_info
*outf
)
1415 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1416 | 0 | 0 | 0 | 1 |.T.|.B.|.offset................................|
1417 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1419 int B
= ((iw0
>> BRCC_B_bits
) & BRCC_B_mask
);
1420 int T
= ((iw0
>> BRCC_T_bits
) & BRCC_T_mask
);
1421 int offset
= ((iw0
>> BRCC_offset_bits
) & BRCC_offset_mask
);
1423 if (T
== 1 && B
== 1)
1425 notethat ("IF CC JUMP pcrel10 ( BP )");
1426 OUTS (outf
, "IF CC JUMP ");
1427 OUTS (outf
, pcrel10 (offset
));
1428 OUTS (outf
, "(BP)");
1431 else if (T
== 0 && B
== 1)
1433 notethat ("IF !CC JUMP pcrel10 ( BP )");
1434 OUTS (outf
, "IF ! CC JUMP ");
1435 OUTS (outf
, pcrel10 (offset
));
1436 OUTS (outf
, "(BP)");
1441 notethat ("IF CC JUMP pcrel10");
1442 OUTS (outf
, "IF CC JUMP ");
1443 OUTS (outf
, pcrel10 (offset
));
1448 notethat ("IF !CC JUMP pcrel10");
1449 OUTS (outf
, "IF ! CC JUMP ");
1450 OUTS (outf
, pcrel10 (offset
));
1454 goto illegal_instruction
;
1455 illegal_instruction
:
1460 decode_UJUMP_0 (TIword iw0
, bfd_vma pc
, disassemble_info
*outf
)
1463 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1464 | 0 | 0 | 1 | 0 |.offset........................................|
1465 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1467 int offset
= ((iw0
>> UJump_offset_bits
) & UJump_offset_mask
);
1469 notethat ("JUMP.S pcrel12");
1470 OUTS (outf
, "JUMP.S ");
1471 OUTS (outf
, pcrel12 (offset
));
1476 decode_REGMV_0 (TIword iw0
, disassemble_info
*outf
)
1479 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1480 | 0 | 0 | 1 | 1 |.gd........|.gs........|.dst.......|.src.......|
1481 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1483 int gs
= ((iw0
>> RegMv_gs_bits
) & RegMv_gs_mask
);
1484 int gd
= ((iw0
>> RegMv_gd_bits
) & RegMv_gd_mask
);
1485 int src
= ((iw0
>> RegMv_src_bits
) & RegMv_src_mask
);
1486 int dst
= ((iw0
>> RegMv_dst_bits
) & RegMv_dst_mask
);
1488 notethat ("allregs = allregs");
1489 OUTS (outf
, allregs (dst
, gd
));
1491 OUTS (outf
, allregs (src
, gs
));
1496 decode_ALU2op_0 (TIword iw0
, disassemble_info
*outf
)
1499 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1500 | 0 | 1 | 0 | 0 | 0 | 0 |.opc...........|.src.......|.dst.......|
1501 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1503 int src
= ((iw0
>> ALU2op_src_bits
) & ALU2op_src_mask
);
1504 int opc
= ((iw0
>> ALU2op_opc_bits
) & ALU2op_opc_mask
);
1505 int dst
= ((iw0
>> ALU2op_dst_bits
) & ALU2op_dst_mask
);
1509 notethat ("dregs >>>= dregs");
1510 OUTS (outf
, dregs (dst
));
1511 OUTS (outf
, ">>>=");
1512 OUTS (outf
, dregs (src
));
1517 notethat ("dregs >>= dregs");
1518 OUTS (outf
, dregs (dst
));
1520 OUTS (outf
, dregs (src
));
1525 notethat ("dregs <<= dregs");
1526 OUTS (outf
, dregs (dst
));
1528 OUTS (outf
, dregs (src
));
1533 notethat ("dregs *= dregs");
1534 OUTS (outf
, dregs (dst
));
1536 OUTS (outf
, dregs (src
));
1541 notethat ("dregs = (dregs + dregs) << 1");
1542 OUTS (outf
, dregs (dst
));
1544 OUTS (outf
, dregs (dst
));
1546 OUTS (outf
, dregs (src
));
1547 OUTS (outf
, ")<<1");
1552 notethat ("dregs = (dregs + dregs) << 2");
1553 OUTS (outf
, dregs (dst
));
1555 OUTS (outf
, dregs (dst
));
1557 OUTS (outf
, dregs (src
));
1558 OUTS (outf
, ")<<2");
1563 notethat ("DIVQ (dregs , dregs)");
1564 OUTS (outf
, "DIVQ(");
1565 OUTS (outf
, dregs (dst
));
1567 OUTS (outf
, dregs (src
));
1573 notethat ("DIVS (dregs , dregs)");
1574 OUTS (outf
, "DIVS(");
1575 OUTS (outf
, dregs (dst
));
1577 OUTS (outf
, dregs (src
));
1583 notethat ("dregs = dregs_lo (X)");
1584 OUTS (outf
, dregs (dst
));
1586 OUTS (outf
, dregs_lo (src
));
1592 notethat ("dregs = dregs_lo (Z)");
1593 OUTS (outf
, dregs (dst
));
1595 OUTS (outf
, dregs_lo (src
));
1601 notethat ("dregs = dregs_byte (X)");
1602 OUTS (outf
, dregs (dst
));
1604 OUTS (outf
, dregs_byte (src
));
1610 notethat ("dregs = dregs_byte (Z)");
1611 OUTS (outf
, dregs (dst
));
1613 OUTS (outf
, dregs_byte (src
));
1619 notethat ("dregs = - dregs");
1620 OUTS (outf
, dregs (dst
));
1622 OUTS (outf
, dregs (src
));
1627 notethat ("dregs = ~ dregs");
1628 OUTS (outf
, dregs (dst
));
1630 OUTS (outf
, dregs (src
));
1634 goto illegal_instruction
;
1635 illegal_instruction
:
1640 decode_PTR2op_0 (TIword iw0
, disassemble_info
*outf
)
1643 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1644 | 0 | 1 | 0 | 0 | 0 | 1 | 0 |.opc.......|.src.......|.dst.......|
1645 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1647 int src
= ((iw0
>> PTR2op_src_bits
) & PTR2op_dst_mask
);
1648 int opc
= ((iw0
>> PTR2op_opc_bits
) & PTR2op_opc_mask
);
1649 int dst
= ((iw0
>> PTR2op_dst_bits
) & PTR2op_dst_mask
);
1653 notethat ("pregs -= pregs");
1654 OUTS (outf
, pregs (dst
));
1656 OUTS (outf
, pregs (src
));
1661 notethat ("pregs = pregs << 2");
1662 OUTS (outf
, pregs (dst
));
1664 OUTS (outf
, pregs (src
));
1670 notethat ("pregs = pregs >> 2");
1671 OUTS (outf
, pregs (dst
));
1673 OUTS (outf
, pregs (src
));
1679 notethat ("pregs = pregs >> 1");
1680 OUTS (outf
, pregs (dst
));
1682 OUTS (outf
, pregs (src
));
1688 notethat ("pregs += pregs ( BREV )");
1689 OUTS (outf
, pregs (dst
));
1691 OUTS (outf
, pregs (src
));
1692 OUTS (outf
, "(BREV)");
1697 notethat ("pregs = (pregs + pregs) << 1");
1698 OUTS (outf
, pregs (dst
));
1700 OUTS (outf
, pregs (dst
));
1702 OUTS (outf
, pregs (src
));
1703 OUTS (outf
, ")<<1");
1708 notethat ("pregs = (pregs + pregs) << 2");
1709 OUTS (outf
, pregs (dst
));
1711 OUTS (outf
, pregs (dst
));
1713 OUTS (outf
, pregs (src
));
1714 OUTS (outf
, ")<<2");
1718 goto illegal_instruction
;
1719 illegal_instruction
:
1724 decode_LOGI2op_0 (TIword iw0
, disassemble_info
*outf
)
1727 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1728 | 0 | 1 | 0 | 0 | 1 |.opc.......|.src...............|.dst.......|
1729 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1731 int src
= ((iw0
>> LOGI2op_src_bits
) & LOGI2op_src_mask
);
1732 int opc
= ((iw0
>> LOGI2op_opc_bits
) & LOGI2op_opc_mask
);
1733 int dst
= ((iw0
>> LOGI2op_dst_bits
) & LOGI2op_dst_mask
);
1737 notethat ("CC = ! BITTST ( dregs , uimm5 )");
1738 OUTS (outf
, "CC = ! BITTST (");
1739 OUTS (outf
, dregs (dst
));
1741 OUTS (outf
, uimm5 (src
));
1747 notethat ("CC = BITTST ( dregs , uimm5 )");
1748 OUTS (outf
, "CC = BITTST (");
1749 OUTS (outf
, dregs (dst
));
1751 OUTS (outf
, uimm5 (src
));
1757 notethat ("BITSET ( dregs , uimm5 )");
1758 OUTS (outf
, "BITSET (");
1759 OUTS (outf
, dregs (dst
));
1761 OUTS (outf
, uimm5 (src
));
1767 notethat ("BITTGL ( dregs , uimm5 )");
1768 OUTS (outf
, "BITTGL (");
1769 OUTS (outf
, dregs (dst
));
1771 OUTS (outf
, uimm5 (src
));
1777 notethat ("BITCLR ( dregs , uimm5 )");
1778 OUTS (outf
, "BITCLR (");
1779 OUTS (outf
, dregs (dst
));
1781 OUTS (outf
, uimm5 (src
));
1787 notethat ("dregs >>>= uimm5");
1788 OUTS (outf
, dregs (dst
));
1789 OUTS (outf
, ">>>=");
1790 OUTS (outf
, uimm5 (src
));
1795 notethat ("dregs >>= uimm5");
1796 OUTS (outf
, dregs (dst
));
1798 OUTS (outf
, uimm5 (src
));
1803 notethat ("dregs <<= uimm5");
1804 OUTS (outf
, dregs (dst
));
1806 OUTS (outf
, uimm5 (src
));
1810 goto illegal_instruction
;
1811 illegal_instruction
:
1816 decode_COMP3op_0 (TIword iw0
, disassemble_info
*outf
)
1819 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1820 | 0 | 1 | 0 | 1 |.opc.......|.dst.......|.src1......|.src0......|
1821 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1823 int opc
= ((iw0
>> COMP3op_opc_bits
) & COMP3op_opc_mask
);
1824 int dst
= ((iw0
>> COMP3op_dst_bits
) & COMP3op_dst_mask
);
1825 int src0
= ((iw0
>> COMP3op_src0_bits
) & COMP3op_src0_mask
);
1826 int src1
= ((iw0
>> COMP3op_src1_bits
) & COMP3op_src1_mask
);
1828 if (opc
== 5 && src1
== src0
)
1830 notethat ("pregs = pregs << 1");
1831 OUTS (outf
, pregs (dst
));
1833 OUTS (outf
, pregs (src0
));
1839 notethat ("dregs = dregs - dregs");
1840 OUTS (outf
, dregs (dst
));
1842 OUTS (outf
, dregs (src0
));
1844 OUTS (outf
, dregs (src1
));
1849 notethat ("dregs = dregs & dregs");
1850 OUTS (outf
, dregs (dst
));
1852 OUTS (outf
, dregs (src0
));
1854 OUTS (outf
, dregs (src1
));
1859 notethat ("dregs = dregs | dregs");
1860 OUTS (outf
, dregs (dst
));
1862 OUTS (outf
, dregs (src0
));
1864 OUTS (outf
, dregs (src1
));
1869 notethat ("dregs = dregs ^ dregs");
1870 OUTS (outf
, dregs (dst
));
1872 OUTS (outf
, dregs (src0
));
1874 OUTS (outf
, dregs (src1
));
1879 notethat ("pregs = pregs + pregs");
1880 OUTS (outf
, pregs (dst
));
1882 OUTS (outf
, pregs (src0
));
1884 OUTS (outf
, pregs (src1
));
1889 notethat ("pregs = pregs + (pregs << 1)");
1890 OUTS (outf
, pregs (dst
));
1892 OUTS (outf
, pregs (src0
));
1894 OUTS (outf
, pregs (src1
));
1895 OUTS (outf
, "<<1)");
1900 notethat ("pregs = pregs + (pregs << 2)");
1901 OUTS (outf
, pregs (dst
));
1903 OUTS (outf
, pregs (src0
));
1905 OUTS (outf
, pregs (src1
));
1906 OUTS (outf
, "<<2)");
1911 notethat ("dregs = dregs + dregs");
1912 OUTS (outf
, dregs (dst
));
1914 OUTS (outf
, dregs (src0
));
1916 OUTS (outf
, dregs (src1
));
1920 goto illegal_instruction
;
1921 illegal_instruction
:
1926 decode_COMPI2opD_0 (TIword iw0
, disassemble_info
*outf
)
1929 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1930 | 0 | 1 | 1 | 0 | 0 |.op|..src......................|.dst.......|
1931 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1933 int op
= ((iw0
>> COMPI2opD_op_bits
) & COMPI2opD_op_mask
);
1934 int dst
= ((iw0
>> COMPI2opD_dst_bits
) & COMPI2opD_dst_mask
);
1935 int src
= ((iw0
>> COMPI2opD_src_bits
) & COMPI2opD_src_mask
);
1939 notethat ("dregs = imm7 (x)");
1940 OUTS (outf
, dregs (dst
));
1942 OUTS (outf
, imm7 (src
));
1948 notethat ("dregs += imm7");
1949 OUTS (outf
, dregs (dst
));
1951 OUTS (outf
, imm7 (src
));
1955 goto illegal_instruction
;
1956 illegal_instruction
:
1961 decode_COMPI2opP_0 (TIword iw0
, disassemble_info
*outf
)
1964 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1965 | 0 | 1 | 1 | 0 | 1 |.op|.src.......................|.dst.......|
1966 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1968 int op
= ((iw0
>> COMPI2opP_op_bits
) & COMPI2opP_op_mask
);
1969 int src
= ((iw0
>> COMPI2opP_src_bits
) & COMPI2opP_src_mask
);
1970 int dst
= ((iw0
>> COMPI2opP_dst_bits
) & COMPI2opP_dst_mask
);
1974 notethat ("pregs = imm7");
1975 OUTS (outf
, pregs (dst
));
1977 OUTS (outf
, imm7 (src
));
1982 notethat ("pregs += imm7");
1983 OUTS (outf
, pregs (dst
));
1985 OUTS (outf
, imm7 (src
));
1989 goto illegal_instruction
;
1990 illegal_instruction
:
1995 decode_LDSTpmod_0 (TIword iw0
, disassemble_info
*outf
)
1998 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
1999 | 1 | 0 | 0 | 0 |.W.|.aop...|.reg.......|.idx.......|.ptr.......|
2000 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2002 int W
= ((iw0
>> LDSTpmod_W_bits
) & LDSTpmod_W_mask
);
2003 int aop
= ((iw0
>> LDSTpmod_aop_bits
) & LDSTpmod_aop_mask
);
2004 int idx
= ((iw0
>> LDSTpmod_idx_bits
) & LDSTpmod_idx_mask
);
2005 int ptr
= ((iw0
>> LDSTpmod_ptr_bits
) & LDSTpmod_ptr_mask
);
2006 int reg
= ((iw0
>> LDSTpmod_reg_bits
) & LDSTpmod_reg_mask
);
2008 if (aop
== 1 && W
== 0 && idx
== ptr
)
2010 notethat ("dregs_lo = W [ pregs ]");
2011 OUTS (outf
, dregs_lo (reg
));
2013 OUTS (outf
, pregs (ptr
));
2017 else if (aop
== 2 && W
== 0 && idx
== ptr
)
2019 notethat ("dregs_hi = W [ pregs ]");
2020 OUTS (outf
, dregs_hi (reg
));
2022 OUTS (outf
, pregs (ptr
));
2026 else if (aop
== 1 && W
== 1 && idx
== ptr
)
2028 notethat ("W [ pregs ] = dregs_lo");
2030 OUTS (outf
, pregs (ptr
));
2032 OUTS (outf
, dregs_lo (reg
));
2035 else if (aop
== 2 && W
== 1 && idx
== ptr
)
2037 notethat ("W [ pregs ] = dregs_hi");
2039 OUTS (outf
, pregs (ptr
));
2041 OUTS (outf
, dregs_hi (reg
));
2044 else if (aop
== 0 && W
== 0)
2046 notethat ("dregs = [ pregs ++ pregs ]");
2047 OUTS (outf
, dregs (reg
));
2049 OUTS (outf
, pregs (ptr
));
2051 OUTS (outf
, pregs (idx
));
2055 else if (aop
== 1 && W
== 0)
2057 notethat ("dregs_lo = W [ pregs ++ pregs ]");
2058 OUTS (outf
, dregs_lo (reg
));
2060 OUTS (outf
, pregs (ptr
));
2062 OUTS (outf
, pregs (idx
));
2066 else if (aop
== 2 && W
== 0)
2068 notethat ("dregs_hi = W [ pregs ++ pregs ]");
2069 OUTS (outf
, dregs_hi (reg
));
2071 OUTS (outf
, pregs (ptr
));
2073 OUTS (outf
, pregs (idx
));
2077 else if (aop
== 3 && W
== 0)
2079 notethat ("dregs = W [ pregs ++ pregs ] (Z)");
2080 OUTS (outf
, dregs (reg
));
2082 OUTS (outf
, pregs (ptr
));
2084 OUTS (outf
, pregs (idx
));
2085 OUTS (outf
, "] (Z)");
2088 else if (aop
== 3 && W
== 1)
2090 notethat ("dregs = W [ pregs ++ pregs ] (X)");
2091 OUTS (outf
, dregs (reg
));
2093 OUTS (outf
, pregs (ptr
));
2095 OUTS (outf
, pregs (idx
));
2096 OUTS (outf
, "](X)");
2099 else if (aop
== 0 && W
== 1)
2101 notethat ("[ pregs ++ pregs ] = dregs");
2103 OUTS (outf
, pregs (ptr
));
2105 OUTS (outf
, pregs (idx
));
2107 OUTS (outf
, dregs (reg
));
2110 else if (aop
== 1 && W
== 1)
2112 notethat (" W [ pregs ++ pregs ] = dregs_lo");
2114 OUTS (outf
, pregs (ptr
));
2116 OUTS (outf
, pregs (idx
));
2118 OUTS (outf
, dregs_lo (reg
));
2121 else if (aop
== 2 && W
== 1)
2123 notethat (" W[ pregs ++ pregs ] = dregs_hi");
2125 OUTS (outf
, pregs (ptr
));
2127 OUTS (outf
, pregs (idx
));
2129 OUTS (outf
, dregs_hi (reg
));
2133 goto illegal_instruction
;
2134 illegal_instruction
:
2139 decode_dagMODim_0 (TIword iw0
, disassemble_info
*outf
)
2142 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2143 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 0 |.br| 1 | 1 |.op|.m.....|.i.....|
2144 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2146 int i
= ((iw0
>> DagMODim_i_bits
) & DagMODim_i_mask
);
2147 int m
= ((iw0
>> DagMODim_m_bits
) & DagMODim_m_mask
);
2148 int br
= ((iw0
>> DagMODim_br_bits
) & DagMODim_br_mask
);
2149 int op
= ((iw0
>> DagMODim_op_bits
) & DagMODim_op_mask
);
2151 if (op
== 0 && br
== 1)
2153 notethat ("iregs += mregs ( BREV )");
2154 OUTS (outf
, iregs (i
));
2156 OUTS (outf
, mregs (m
));
2157 OUTS (outf
, "(BREV)");
2162 notethat ("iregs += mregs");
2163 OUTS (outf
, iregs (i
));
2165 OUTS (outf
, mregs (m
));
2170 notethat ("iregs -= mregs");
2171 OUTS (outf
, iregs (i
));
2173 OUTS (outf
, mregs (m
));
2177 goto illegal_instruction
;
2178 illegal_instruction
:
2183 decode_dagMODik_0 (TIword iw0
, disassemble_info
*outf
)
2186 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2187 | 1 | 0 | 0 | 1 | 1 | 1 | 1 | 1 | 0 | 1 | 1 | 0 |.op....|.i.....|
2188 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2190 int i
= ((iw0
>> DagMODik_i_bits
) & DagMODik_i_mask
);
2191 int op
= ((iw0
>> DagMODik_op_bits
) & DagMODik_op_mask
);
2195 notethat ("iregs += 2");
2196 OUTS (outf
, iregs (i
));
2202 notethat ("iregs -= 2");
2203 OUTS (outf
, iregs (i
));
2209 notethat ("iregs += 4");
2210 OUTS (outf
, iregs (i
));
2216 notethat ("iregs -= 4");
2217 OUTS (outf
, iregs (i
));
2222 goto illegal_instruction
;
2223 illegal_instruction
:
2228 decode_dspLDST_0 (TIword iw0
, disassemble_info
*outf
)
2231 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2232 | 1 | 0 | 0 | 1 | 1 | 1 |.W.|.aop...|.m.....|.i.....|.reg.......|
2233 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2235 int i
= ((iw0
>> DspLDST_i_bits
) & DspLDST_i_mask
);
2236 int m
= ((iw0
>> DspLDST_m_bits
) & DspLDST_m_mask
);
2237 int W
= ((iw0
>> DspLDST_W_bits
) & DspLDST_W_mask
);
2238 int aop
= ((iw0
>> DspLDST_aop_bits
) & DspLDST_aop_mask
);
2239 int reg
= ((iw0
>> DspLDST_reg_bits
) & DspLDST_reg_mask
);
2241 if (aop
== 0 && W
== 0 && m
== 0)
2243 notethat ("dregs = [ iregs ++ ]");
2244 OUTS (outf
, dregs (reg
));
2246 OUTS (outf
, iregs (i
));
2250 else if (aop
== 0 && W
== 0 && m
== 1)
2252 notethat ("dregs_lo = W [ iregs ++ ]");
2253 OUTS (outf
, dregs_lo (reg
));
2255 OUTS (outf
, iregs (i
));
2259 else if (aop
== 0 && W
== 0 && m
== 2)
2261 notethat ("dregs_hi = W [ iregs ++ ]");
2262 OUTS (outf
, dregs_hi (reg
));
2264 OUTS (outf
, iregs (i
));
2268 else if (aop
== 1 && W
== 0 && m
== 0)
2270 notethat ("dregs = [ iregs -- ]");
2271 OUTS (outf
, dregs (reg
));
2273 OUTS (outf
, iregs (i
));
2277 else if (aop
== 1 && W
== 0 && m
== 1)
2279 notethat ("dregs_lo = W [ iregs -- ]");
2280 OUTS (outf
, dregs_lo (reg
));
2282 OUTS (outf
, iregs (i
));
2286 else if (aop
== 1 && W
== 0 && m
== 2)
2288 notethat ("dregs_hi = W [ iregs -- ]");
2289 OUTS (outf
, dregs_hi (reg
));
2291 OUTS (outf
, iregs (i
));
2295 else if (aop
== 2 && W
== 0 && m
== 0)
2297 notethat ("dregs = [ iregs ]");
2298 OUTS (outf
, dregs (reg
));
2300 OUTS (outf
, iregs (i
));
2304 else if (aop
== 2 && W
== 0 && m
== 1)
2306 notethat ("dregs_lo = W [ iregs ]");
2307 OUTS (outf
, dregs_lo (reg
));
2309 OUTS (outf
, iregs (i
));
2313 else if (aop
== 2 && W
== 0 && m
== 2)
2315 notethat ("dregs_hi = W [ iregs ]");
2316 OUTS (outf
, dregs_hi (reg
));
2318 OUTS (outf
, iregs (i
));
2322 else if (aop
== 0 && W
== 1 && m
== 0)
2324 notethat ("[ iregs ++ ] = dregs");
2326 OUTS (outf
, iregs (i
));
2327 OUTS (outf
, "++]=");
2328 OUTS (outf
, dregs (reg
));
2331 else if (aop
== 0 && W
== 1 && m
== 1)
2333 notethat ("W [ iregs ++ ] = dregs_lo");
2335 OUTS (outf
, iregs (i
));
2336 OUTS (outf
, "++]=");
2337 OUTS (outf
, dregs_lo (reg
));
2340 else if (aop
== 0 && W
== 1 && m
== 2)
2342 notethat ("W [ iregs ++ ] = dregs_hi");
2344 OUTS (outf
, iregs (i
));
2345 OUTS (outf
, "++]=");
2346 OUTS (outf
, dregs_hi (reg
));
2349 else if (aop
== 1 && W
== 1 && m
== 0)
2351 notethat ("[ iregs -- ] = dregs");
2353 OUTS (outf
, iregs (i
));
2354 OUTS (outf
, "--]=");
2355 OUTS (outf
, dregs (reg
));
2358 else if (aop
== 1 && W
== 1 && m
== 1)
2360 notethat ("W [ iregs -- ] = dregs_lo");
2362 OUTS (outf
, iregs (i
));
2363 OUTS (outf
, "--]=");
2364 OUTS (outf
, dregs_lo (reg
));
2367 else if (aop
== 1 && W
== 1 && m
== 2)
2369 notethat ("W [ iregs -- ] = dregs_hi");
2371 OUTS (outf
, iregs (i
));
2372 OUTS (outf
, "--]=");
2373 OUTS (outf
, dregs_hi (reg
));
2376 else if (aop
== 2 && W
== 1 && m
== 0)
2378 notethat ("[ iregs ] = dregs");
2380 OUTS (outf
, iregs (i
));
2382 OUTS (outf
, dregs (reg
));
2385 else if (aop
== 2 && W
== 1 && m
== 1)
2387 notethat (" W [ iregs ] = dregs_lo");
2389 OUTS (outf
, iregs (i
));
2391 OUTS (outf
, dregs_lo (reg
));
2394 else if (aop
== 2 && W
== 1 && m
== 2)
2396 notethat (" W [ iregs ] = dregs_hi");
2398 OUTS (outf
, iregs (i
));
2400 OUTS (outf
, dregs_hi (reg
));
2403 else if (aop
== 3 && W
== 0)
2405 notethat ("dregs = [ iregs ++ mregs ]");
2406 OUTS (outf
, dregs (reg
));
2408 OUTS (outf
, iregs (i
));
2410 OUTS (outf
, mregs (m
));
2414 else if (aop
== 3 && W
== 1)
2416 notethat ("[ iregs ++ mregs ] = dregs");
2418 OUTS (outf
, iregs (i
));
2420 OUTS (outf
, mregs (m
));
2422 OUTS (outf
, dregs (reg
));
2426 goto illegal_instruction
;
2427 illegal_instruction
:
2432 decode_LDST_0 (TIword iw0
, disassemble_info
*outf
)
2435 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2436 | 1 | 0 | 0 | 1 |.sz....|.W.|.aop...|.Z.|.ptr.......|.reg.......|
2437 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2439 int Z
= ((iw0
>> LDST_Z_bits
) & LDST_Z_mask
);
2440 int W
= ((iw0
>> LDST_W_bits
) & LDST_W_mask
);
2441 int sz
= ((iw0
>> LDST_sz_bits
) & LDST_sz_mask
);
2442 int aop
= ((iw0
>> LDST_aop_bits
) & LDST_aop_mask
);
2443 int reg
= ((iw0
>> LDST_reg_bits
) & LDST_reg_mask
);
2444 int ptr
= ((iw0
>> LDST_ptr_bits
) & LDST_ptr_mask
);
2446 if (aop
== 0 && sz
== 0 && Z
== 0 && W
== 0)
2448 notethat ("dregs = [ pregs ++ ]");
2449 OUTS (outf
, dregs (reg
));
2451 OUTS (outf
, pregs (ptr
));
2455 else if (aop
== 0 && sz
== 0 && Z
== 1 && W
== 0)
2457 notethat ("pregs = [ pregs ++ ]");
2458 OUTS (outf
, pregs (reg
));
2460 OUTS (outf
, pregs (ptr
));
2464 else if (aop
== 0 && sz
== 1 && Z
== 0 && W
== 0)
2466 notethat ("dregs = W [ pregs ++ ] (z)");
2467 OUTS (outf
, dregs (reg
));
2469 OUTS (outf
, pregs (ptr
));
2470 OUTS (outf
, "++] (Z)");
2473 else if (aop
== 0 && sz
== 1 && Z
== 1 && W
== 0)
2475 notethat ("dregs = W [ pregs ++ ] (X)");
2476 OUTS (outf
, dregs (reg
));
2478 OUTS (outf
, pregs (ptr
));
2479 OUTS (outf
, "++](X)");
2482 else if (aop
== 0 && sz
== 2 && Z
== 0 && W
== 0)
2484 notethat ("dregs = B [ pregs ++ ] (Z)");
2485 OUTS (outf
, dregs (reg
));
2487 OUTS (outf
, pregs (ptr
));
2488 OUTS (outf
, "++] (Z)");
2491 else if (aop
== 0 && sz
== 2 && Z
== 1 && W
== 0)
2493 notethat ("dregs = B [ pregs ++ ] (X)");
2494 OUTS (outf
, dregs (reg
));
2496 OUTS (outf
, pregs (ptr
));
2497 OUTS (outf
, "++](X)");
2500 else if (aop
== 1 && sz
== 0 && Z
== 0 && W
== 0)
2502 notethat ("dregs = [ pregs -- ]");
2503 OUTS (outf
, dregs (reg
));
2505 OUTS (outf
, pregs (ptr
));
2509 else if (aop
== 1 && sz
== 0 && Z
== 1 && W
== 0)
2511 notethat ("pregs = [ pregs -- ]");
2512 OUTS (outf
, pregs (reg
));
2514 OUTS (outf
, pregs (ptr
));
2518 else if (aop
== 1 && sz
== 1 && Z
== 0 && W
== 0)
2520 notethat ("dregs = W [ pregs -- ] (Z)");
2521 OUTS (outf
, dregs (reg
));
2523 OUTS (outf
, pregs (ptr
));
2524 OUTS (outf
, "--] (Z)");
2527 else if (aop
== 1 && sz
== 1 && Z
== 1 && W
== 0)
2529 notethat ("dregs = W [ pregs -- ] (X)");
2530 OUTS (outf
, dregs (reg
));
2532 OUTS (outf
, pregs (ptr
));
2533 OUTS (outf
, "--](X)");
2536 else if (aop
== 1 && sz
== 2 && Z
== 0 && W
== 0)
2538 notethat ("dregs = B [ pregs -- ] (Z)");
2539 OUTS (outf
, dregs (reg
));
2541 OUTS (outf
, pregs (ptr
));
2542 OUTS (outf
, "--] (Z)");
2545 else if (aop
== 1 && sz
== 2 && Z
== 1 && W
== 0)
2547 notethat ("dregs = B [ pregs -- ] (X)");
2548 OUTS (outf
, dregs (reg
));
2550 OUTS (outf
, pregs (ptr
));
2551 OUTS (outf
, "--](X)");
2554 else if (aop
== 2 && sz
== 0 && Z
== 0 && W
== 0)
2556 notethat ("dregs = [ pregs ]");
2557 OUTS (outf
, dregs (reg
));
2559 OUTS (outf
, pregs (ptr
));
2563 else if (aop
== 2 && sz
== 0 && Z
== 1 && W
== 0)
2565 notethat ("pregs = [ pregs ]");
2566 OUTS (outf
, pregs (reg
));
2568 OUTS (outf
, pregs (ptr
));
2572 else if (aop
== 2 && sz
== 1 && Z
== 0 && W
== 0)
2574 notethat ("dregs = W [ pregs ] (Z)");
2575 OUTS (outf
, dregs (reg
));
2577 OUTS (outf
, pregs (ptr
));
2578 OUTS (outf
, "] (Z)");
2581 else if (aop
== 2 && sz
== 1 && Z
== 1 && W
== 0)
2583 notethat ("dregs = W [ pregs ] (X)");
2584 OUTS (outf
, dregs (reg
));
2586 OUTS (outf
, pregs (ptr
));
2587 OUTS (outf
, "](X)");
2590 else if (aop
== 2 && sz
== 2 && Z
== 0 && W
== 0)
2592 notethat ("dregs = B [ pregs ] (Z)");
2593 OUTS (outf
, dregs (reg
));
2595 OUTS (outf
, pregs (ptr
));
2596 OUTS (outf
, "] (Z)");
2599 else if (aop
== 2 && sz
== 2 && Z
== 1 && W
== 0)
2601 notethat ("dregs = B [ pregs ] (X)");
2602 OUTS (outf
, dregs (reg
));
2604 OUTS (outf
, pregs (ptr
));
2605 OUTS (outf
, "](X)");
2608 else if (aop
== 0 && sz
== 0 && Z
== 0 && W
== 1)
2610 notethat ("[ pregs ++ ] = dregs");
2612 OUTS (outf
, pregs (ptr
));
2613 OUTS (outf
, "++]=");
2614 OUTS (outf
, dregs (reg
));
2617 else if (aop
== 0 && sz
== 0 && Z
== 1 && W
== 1)
2619 notethat ("[ pregs ++ ] = pregs");
2621 OUTS (outf
, pregs (ptr
));
2622 OUTS (outf
, "++]=");
2623 OUTS (outf
, pregs (reg
));
2626 else if (aop
== 0 && sz
== 1 && Z
== 0 && W
== 1)
2628 notethat ("W [ pregs ++ ] = dregs");
2630 OUTS (outf
, pregs (ptr
));
2631 OUTS (outf
, "++]=");
2632 OUTS (outf
, dregs (reg
));
2635 else if (aop
== 0 && sz
== 2 && Z
== 0 && W
== 1)
2637 notethat ("B [ pregs ++ ] = dregs");
2639 OUTS (outf
, pregs (ptr
));
2640 OUTS (outf
, "++]=");
2641 OUTS (outf
, dregs (reg
));
2644 else if (aop
== 1 && sz
== 0 && Z
== 0 && W
== 1)
2646 notethat ("[ pregs -- ] = dregs");
2648 OUTS (outf
, pregs (ptr
));
2649 OUTS (outf
, "--]=");
2650 OUTS (outf
, dregs (reg
));
2653 else if (aop
== 1 && sz
== 0 && Z
== 1 && W
== 1)
2655 notethat ("[ pregs -- ] = pregs");
2657 OUTS (outf
, pregs (ptr
));
2658 OUTS (outf
, "--]=");
2659 OUTS (outf
, pregs (reg
));
2662 else if (aop
== 1 && sz
== 1 && Z
== 0 && W
== 1)
2664 notethat ("W [ pregs -- ] = dregs");
2666 OUTS (outf
, pregs (ptr
));
2667 OUTS (outf
, "--]=");
2668 OUTS (outf
, dregs (reg
));
2671 else if (aop
== 1 && sz
== 2 && Z
== 0 && W
== 1)
2673 notethat ("B [ pregs -- ] = dregs");
2675 OUTS (outf
, pregs (ptr
));
2676 OUTS (outf
, "--]=");
2677 OUTS (outf
, dregs (reg
));
2680 else if (aop
== 2 && sz
== 0 && Z
== 0 && W
== 1)
2682 notethat ("[ pregs ] = dregs");
2684 OUTS (outf
, pregs (ptr
));
2686 OUTS (outf
, dregs (reg
));
2689 else if (aop
== 2 && sz
== 0 && Z
== 1 && W
== 1)
2691 notethat ("[ pregs ] = pregs");
2693 OUTS (outf
, pregs (ptr
));
2695 OUTS (outf
, pregs (reg
));
2698 else if (aop
== 2 && sz
== 1 && Z
== 0 && W
== 1)
2700 notethat ("W [ pregs ] = dregs");
2702 OUTS (outf
, pregs (ptr
));
2704 OUTS (outf
, dregs (reg
));
2707 else if (aop
== 2 && sz
== 2 && Z
== 0 && W
== 1)
2709 notethat ("B [ pregs ] = dregs");
2711 OUTS (outf
, pregs (ptr
));
2713 OUTS (outf
, dregs (reg
));
2717 goto illegal_instruction
;
2718 illegal_instruction
:
2723 decode_LDSTiiFP_0 (TIword iw0
, disassemble_info
*outf
)
2726 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2727 | 1 | 0 | 1 | 1 | 1 | 0 |.W.|.offset............|.reg...........|
2728 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2730 int reg
= ((iw0
>> LDSTiiFP_reg_bits
) & LDSTiiFP_reg_mask
);
2731 int offset
= ((iw0
>> LDSTiiFP_offset_bits
) & LDSTiiFP_offset_mask
);
2732 int W
= ((iw0
>> LDSTiiFP_W_bits
) & LDSTiiFP_W_mask
);
2736 notethat ("dpregs = [ FP - negimm5s4 ]");
2737 OUTS (outf
, dpregs (reg
));
2738 OUTS (outf
, "=[FP");
2739 OUTS (outf
, negimm5s4 (offset
));
2745 notethat ("[ FP - negimm5s4 ] = dpregs");
2747 OUTS (outf
, negimm5s4 (offset
));
2749 OUTS (outf
, dpregs (reg
));
2753 goto illegal_instruction
;
2754 illegal_instruction
:
2759 decode_LDSTii_0 (TIword iw0
, disassemble_info
*outf
)
2762 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2763 | 1 | 0 | 1 |.W.|.op....|.offset........|.ptr.......|.reg.......|
2764 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2766 int reg
= ((iw0
>> LDSTii_reg_bit
) & LDSTii_reg_mask
);
2767 int ptr
= ((iw0
>> LDSTii_ptr_bit
) & LDSTii_ptr_mask
);
2768 int offset
= ((iw0
>> LDSTii_offset_bit
) & LDSTii_offset_mask
);
2769 int op
= ((iw0
>> LDSTii_op_bit
) & LDSTii_op_mask
);
2770 int W
= ((iw0
>> LDSTii_W_bit
) & LDSTii_W_mask
);
2772 if (W
== 0 && op
== 0)
2774 notethat ("dregs = [ pregs + uimm4s4 ]");
2775 OUTS (outf
, dregs (reg
));
2777 OUTS (outf
, pregs (ptr
));
2779 OUTS (outf
, uimm4s4 (offset
));
2783 else if (W
== 0 && op
== 1)
2785 notethat ("dregs = W [ pregs + uimm4s2 ] (Z)");
2786 OUTS (outf
, dregs (reg
));
2788 OUTS (outf
, pregs (ptr
));
2790 OUTS (outf
, uimm4s2 (offset
));
2791 OUTS (outf
, "] (Z)");
2794 else if (W
== 0 && op
== 2)
2796 notethat ("dregs = W [ pregs + uimm4s2 ] (X)");
2797 OUTS (outf
, dregs (reg
));
2799 OUTS (outf
, pregs (ptr
));
2801 OUTS (outf
, uimm4s2 (offset
));
2802 OUTS (outf
, "](X)");
2805 else if (W
== 0 && op
== 3)
2807 notethat ("pregs = [ pregs + uimm4s4 ]");
2808 OUTS (outf
, pregs (reg
));
2810 OUTS (outf
, pregs (ptr
));
2812 OUTS (outf
, uimm4s4 (offset
));
2816 else if (W
== 1 && op
== 0)
2818 notethat ("[ pregs + uimm4s4 ] = dregs");
2820 OUTS (outf
, pregs (ptr
));
2822 OUTS (outf
, uimm4s4 (offset
));
2824 OUTS (outf
, dregs (reg
));
2827 else if (W
== 1 && op
== 1)
2829 notethat ("W [ pregs + uimm4s2 ] = dregs");
2832 OUTS (outf
, pregs (ptr
));
2834 OUTS (outf
, uimm4s2 (offset
));
2837 OUTS (outf
, dregs (reg
));
2840 else if (W
== 1 && op
== 3)
2842 notethat ("[ pregs + uimm4s4 ] = pregs");
2844 OUTS (outf
, pregs (ptr
));
2846 OUTS (outf
, uimm4s4 (offset
));
2848 OUTS (outf
, pregs (reg
));
2852 goto illegal_instruction
;
2853 illegal_instruction
:
2858 decode_LoopSetup_0 (TIword iw0
, TIword iw1
, bfd_vma pc
, disassemble_info
*outf
)
2861 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2862 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 0 | 1 |.rop...|.c.|.soffset.......|
2863 |.reg...........| - | - |.eoffset...............................|
2864 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2866 int c
= ((iw0
>> (LoopSetup_c_bits
- 16)) & LoopSetup_c_mask
);
2867 int reg
= ((iw1
>> LoopSetup_reg_bits
) & LoopSetup_reg_mask
);
2868 int rop
= ((iw0
>> (LoopSetup_rop_bits
- 16)) & LoopSetup_rop_mask
);
2869 int soffset
= ((iw0
>> (LoopSetup_soffset_bits
- 16)) & LoopSetup_soffset_mask
);
2870 int eoffset
= ((iw1
>> LoopSetup_eoffset_bits
) & LoopSetup_eoffset_mask
);
2874 notethat ("LSETUP ( pcrel4 , lppcrel10 ) counters");
2875 OUTS (outf
, "LSETUP");
2877 OUTS (outf
, pcrel4 (soffset
));
2879 OUTS (outf
, lppcrel10 (eoffset
));
2881 OUTS (outf
, counters (c
));
2886 notethat ("LSETUP ( pcrel4 , lppcrel10 ) counters = pregs");
2887 OUTS (outf
, "LSETUP");
2889 OUTS (outf
, pcrel4 (soffset
));
2891 OUTS (outf
, lppcrel10 (eoffset
));
2893 OUTS (outf
, counters (c
));
2895 OUTS (outf
, pregs (reg
));
2900 notethat ("LSETUP ( pcrel4 , lppcrel10 ) counters = pregs >> 1");
2901 OUTS (outf
, "LSETUP");
2903 OUTS (outf
, pcrel4 (soffset
));
2905 OUTS (outf
, lppcrel10 (eoffset
));
2907 OUTS (outf
, counters (c
));
2909 OUTS (outf
, pregs (reg
));
2914 goto illegal_instruction
;
2915 illegal_instruction
:
2920 decode_LDIMMhalf_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
2923 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2924 | 1 | 1 | 1 | 0 | 0 | 0 | 0 | 1 |.Z.|.H.|.S.|.grp...|.reg.......|
2925 |.hword.........................................................|
2926 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
2928 int H
= ((iw0
>> (LDIMMhalf_H_bits
- 16)) & LDIMMhalf_H_mask
);
2929 int Z
= ((iw0
>> (LDIMMhalf_Z_bits
- 16)) & LDIMMhalf_Z_mask
);
2930 int S
= ((iw0
>> (LDIMMhalf_S_bits
- 16)) & LDIMMhalf_S_mask
);
2931 int reg
= ((iw0
>> (LDIMMhalf_reg_bits
- 16)) & LDIMMhalf_reg_mask
);
2932 int grp
= ((iw0
>> (LDIMMhalf_grp_bits
- 16)) & LDIMMhalf_grp_mask
);
2933 int hword
= ((iw1
>> LDIMMhalf_hword_bits
) & LDIMMhalf_hword_mask
);
2935 if (grp
== 0 && H
== 0 && S
== 0 && Z
== 0)
2937 notethat ("dregs_lo = imm16");
2938 OUTS (outf
, dregs_lo (reg
));
2940 OUTS (outf
, imm16 (hword
));
2943 else if (grp
== 0 && H
== 1 && S
== 0 && Z
== 0)
2945 notethat ("dregs_hi = imm16");
2946 OUTS (outf
, dregs_hi (reg
));
2948 OUTS (outf
, imm16 (hword
));
2951 else if (grp
== 0 && H
== 0 && S
== 1 && Z
== 0)
2953 notethat ("dregs = imm16 (x)");
2954 OUTS (outf
, dregs (reg
));
2956 OUTS (outf
, imm16 (hword
));
2957 OUTS (outf
, " (X)");
2960 else if (H
== 0 && S
== 1 && Z
== 0)
2962 notethat ("regs = imm16 (x)");
2963 OUTS (outf
, regs (reg
, grp
));
2965 OUTS (outf
, imm16 (hword
));
2966 OUTS (outf
, " (X)");
2969 else if (H
== 0 && S
== 0 && Z
== 1)
2971 notethat ("regs = luimm16 (Z)");
2972 OUTS (outf
, regs (reg
, grp
));
2974 OUTS (outf
, luimm16 (hword
));
2978 else if (H
== 0 && S
== 0 && Z
== 0)
2980 notethat ("regs_lo = luimm16");
2981 OUTS (outf
, regs_lo (reg
, grp
));
2983 OUTS (outf
, luimm16 (hword
));
2986 else if (H
== 1 && S
== 0 && Z
== 0)
2988 notethat ("regs_hi = huimm16");
2989 OUTS (outf
, regs_hi (reg
, grp
));
2991 OUTS (outf
, huimm16 (hword
));
2995 goto illegal_instruction
;
2996 illegal_instruction
:
3001 decode_CALLa_0 (TIword iw0
, TIword iw1
, bfd_vma pc
, disassemble_info
*outf
)
3004 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
3005 | 1 | 1 | 1 | 0 | 0 | 0 | 1 |.S.|.msw...........................|
3006 |.lsw...........................................................|
3007 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
3009 int S
= ((iw0
>> (CALLa_S_bits
- 16)) & CALLa_S_mask
);
3010 int lsw
= ((iw1
>> 0) & 0xffff);
3011 int msw
= ((iw0
>> 0) & 0xff);
3015 notethat ("CALL pcrel24");
3016 OUTS (outf
, "CALL ");
3017 OUTS (outf
, pcrel24 (((msw
) << 16) | (lsw
)));
3022 notethat ("JUMP.L pcrel24");
3023 OUTS (outf
, "JUMP.L ");
3024 OUTS (outf
, pcrel24 (((msw
) << 16) | (lsw
)));
3028 goto illegal_instruction
;
3029 illegal_instruction
:
3034 decode_LDSTidxI_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
3037 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
3038 | 1 | 1 | 1 | 0 | 0 | 1 |.W.|.Z.|.sz....|.ptr.......|.reg.......|
3039 |.offset........................................................|
3040 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
3042 int Z
= ((iw0
>> (LDSTidxI_Z_bits
- 16)) & LDSTidxI_Z_mask
);
3043 int W
= ((iw0
>> (LDSTidxI_W_bits
- 16)) & LDSTidxI_W_mask
);
3044 int sz
= ((iw0
>> (LDSTidxI_sz_bits
- 16)) & LDSTidxI_sz_mask
);
3045 int reg
= ((iw0
>> (LDSTidxI_reg_bits
- 16)) & LDSTidxI_reg_mask
);
3046 int ptr
= ((iw0
>> (LDSTidxI_ptr_bits
- 16)) & LDSTidxI_ptr_mask
);
3047 int offset
= ((iw1
>> LDSTidxI_offset_bits
) & LDSTidxI_offset_mask
);
3049 if (W
== 0 && sz
== 0 && Z
== 0)
3051 notethat ("dregs = [ pregs + imm16s4 ]");
3052 OUTS (outf
, dregs (reg
));
3054 OUTS (outf
, pregs (ptr
));
3056 OUTS (outf
, imm16s4 (offset
));
3060 else if (W
== 0 && sz
== 0 && Z
== 1)
3062 notethat ("pregs = [ pregs + imm16s4 ]");
3063 OUTS (outf
, pregs (reg
));
3065 OUTS (outf
, pregs (ptr
));
3067 OUTS (outf
, imm16s4 (offset
));
3071 else if (W
== 0 && sz
== 1 && Z
== 0)
3073 notethat ("dregs = W [ pregs + imm16s2 ] (Z)");
3074 OUTS (outf
, dregs (reg
));
3076 OUTS (outf
, pregs (ptr
));
3078 OUTS (outf
, imm16s2 (offset
));
3079 OUTS (outf
, "] (Z)");
3082 else if (W
== 0 && sz
== 1 && Z
== 1)
3084 notethat ("dregs = W [ pregs + imm16s2 ] (X)");
3085 OUTS (outf
, dregs (reg
));
3087 OUTS (outf
, pregs (ptr
));
3089 OUTS (outf
, imm16s2 (offset
));
3090 OUTS (outf
, "](X)");
3093 else if (W
== 0 && sz
== 2 && Z
== 0)
3095 notethat ("dregs = B [ pregs + imm16 ] (Z)");
3096 OUTS (outf
, dregs (reg
));
3098 OUTS (outf
, pregs (ptr
));
3100 OUTS (outf
, imm16 (offset
));
3101 OUTS (outf
, "] (Z)");
3104 else if (W
== 0 && sz
== 2 && Z
== 1)
3106 notethat ("dregs = B [ pregs + imm16 ] (X)");
3107 OUTS (outf
, dregs (reg
));
3109 OUTS (outf
, pregs (ptr
));
3111 OUTS (outf
, imm16 (offset
));
3112 OUTS (outf
, "](X)");
3115 else if (W
== 1 && sz
== 0 && Z
== 0)
3117 notethat ("[ pregs + imm16s4 ] = dregs");
3119 OUTS (outf
, pregs (ptr
));
3121 OUTS (outf
, imm16s4 (offset
));
3123 OUTS (outf
, dregs (reg
));
3126 else if (W
== 1 && sz
== 0 && Z
== 1)
3128 notethat ("[ pregs + imm16s4 ] = pregs");
3130 OUTS (outf
, pregs (ptr
));
3132 OUTS (outf
, imm16s4 (offset
));
3134 OUTS (outf
, pregs (reg
));
3137 else if (W
== 1 && sz
== 1 && Z
== 0)
3139 notethat ("W [ pregs + imm16s2 ] = dregs");
3141 OUTS (outf
, pregs (ptr
));
3143 OUTS (outf
, imm16s2 (offset
));
3145 OUTS (outf
, dregs (reg
));
3148 else if (W
== 1 && sz
== 2 && Z
== 0)
3150 notethat ("B [ pregs + imm16 ] = dregs");
3152 OUTS (outf
, pregs (ptr
));
3154 OUTS (outf
, imm16 (offset
));
3156 OUTS (outf
, dregs (reg
));
3160 goto illegal_instruction
;
3161 illegal_instruction
:
3166 decode_linkage_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
3169 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
3170 | 1 | 1 | 1 | 0 | 1 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 | 0 |.R.|
3171 |.framesize.....................................................|
3172 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
3174 int R
= ((iw0
>> (Linkage_R_bits
- 16)) & Linkage_R_mask
);
3175 int framesize
= ((iw1
>> Linkage_framesize_bits
) & Linkage_framesize_mask
);
3179 notethat ("LINK uimm16s4");
3180 OUTS (outf
, "LINK ");
3181 OUTS (outf
, uimm16s4 (framesize
));
3186 notethat ("UNLINK");
3187 OUTS (outf
, "UNLINK");
3191 goto illegal_instruction
;
3192 illegal_instruction
:
3197 decode_dsp32mac_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
3200 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
3201 | 1 | 1 | 0 | 0 |.M.| 0 | 0 |.mmod..........|.MM|.P.|.w1|.op1...|
3202 |.h01|.h11|.w0|.op0...|.h00|.h10|.dst.......|.src0......|.src1......|
3203 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
3205 int op1
= ((iw0
>> (DSP32Mac_op1_bits
- 16)) & DSP32Mac_op1_mask
);
3206 int w1
= ((iw0
>> (DSP32Mac_w1_bits
- 16)) & DSP32Mac_w1_mask
);
3207 int P
= ((iw0
>> (DSP32Mac_p_bits
- 16)) & DSP32Mac_p_mask
);
3208 int MM
= ((iw0
>> (DSP32Mac_MM_bits
- 16)) & DSP32Mac_MM_mask
);
3209 int mmod
= ((iw0
>> (DSP32Mac_mmod_bits
- 16)) & DSP32Mac_mmod_mask
);
3210 int w0
= ((iw1
>> DSP32Mac_w0_bits
) & DSP32Mac_w0_mask
);
3211 int src0
= ((iw1
>> DSP32Mac_src0_bits
) & DSP32Mac_src0_mask
);
3212 int src1
= ((iw1
>> DSP32Mac_src1_bits
) & DSP32Mac_src1_mask
);
3213 int dst
= ((iw1
>> DSP32Mac_dst_bits
) & DSP32Mac_dst_mask
);
3214 int h10
= ((iw1
>> DSP32Mac_h10_bits
) & DSP32Mac_h10_mask
);
3215 int h00
= ((iw1
>> DSP32Mac_h00_bits
) & DSP32Mac_h00_mask
);
3216 int op0
= ((iw1
>> DSP32Mac_op0_bits
) & DSP32Mac_op0_mask
);
3217 int h11
= ((iw1
>> DSP32Mac_h11_bits
) & DSP32Mac_h11_mask
);
3218 int h01
= ((iw1
>> DSP32Mac_h01_bits
) & DSP32Mac_h01_mask
);
3220 if (w0
== 0 && w1
== 0 && op1
== 3 && op0
== 3)
3226 if ((w1
|| w0
) && mmod
== M_W32
)
3229 if (((1 << mmod
) & (P
? 0x31b : 0x1b5f)) == 0)
3232 if (w1
== 1 || op1
!= 3)
3235 OUTS (outf
, P
? dregs (dst
+ 1) : dregs_hi (dst
));
3238 OUTS (outf
, " = A1");
3242 OUTS (outf
, " = (");
3243 decode_macfunc (1, op1
, h01
, h11
, src0
, src1
, outf
);
3248 if (w0
== 1 || op0
!= 3)
3251 OUTS (outf
, " (M)");
3257 if (w0
== 1 || op0
!= 3)
3260 OUTS (outf
, P
? dregs (dst
) : dregs_lo (dst
));
3263 OUTS (outf
, " = A0");
3267 OUTS (outf
, " = (");
3268 decode_macfunc (0, op0
, h00
, h10
, src0
, src1
, outf
);
3274 decode_optmode (mmod
, MM
, outf
);
3280 decode_dsp32mult_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
3283 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
3284 | 1 | 1 | 0 | 0 |.M.| 0 | 1 |.mmod..........|.MM|.P.|.w1|.op1...|
3285 |.h01|.h11|.w0|.op0...|.h00|.h10|.dst.......|.src0......|.src1......|
3286 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
3288 int w1
= ((iw0
>> (DSP32Mac_w1_bits
- 16)) & DSP32Mac_w1_mask
);
3289 int P
= ((iw0
>> (DSP32Mac_p_bits
- 16)) & DSP32Mac_p_mask
);
3290 int MM
= ((iw0
>> (DSP32Mac_MM_bits
- 16)) & DSP32Mac_MM_mask
);
3291 int mmod
= ((iw0
>> (DSP32Mac_mmod_bits
- 16)) & DSP32Mac_mmod_mask
);
3292 int w0
= ((iw1
>> DSP32Mac_w0_bits
) & DSP32Mac_w0_mask
);
3293 int src0
= ((iw1
>> DSP32Mac_src0_bits
) & DSP32Mac_src0_mask
);
3294 int src1
= ((iw1
>> DSP32Mac_src1_bits
) & DSP32Mac_src1_mask
);
3295 int dst
= ((iw1
>> DSP32Mac_dst_bits
) & DSP32Mac_dst_mask
);
3296 int h10
= ((iw1
>> DSP32Mac_h10_bits
) & DSP32Mac_h10_mask
);
3297 int h00
= ((iw1
>> DSP32Mac_h00_bits
) & DSP32Mac_h00_mask
);
3298 int h11
= ((iw1
>> DSP32Mac_h11_bits
) & DSP32Mac_h11_mask
);
3299 int h01
= ((iw1
>> DSP32Mac_h01_bits
) & DSP32Mac_h01_mask
);
3301 if (w1
== 0 && w0
== 0)
3303 if (((1 << mmod
) & (P
? 0x313 : 0x1b57)) == 0)
3308 OUTS (outf
, P
? dregs (dst
| 1) : dregs_hi (dst
));
3310 decode_multfunc (h01
, h11
, src0
, src1
, outf
);
3315 OUTS (outf
, " (M)");
3323 OUTS (outf
, dregs (dst
));
3325 decode_multfunc (h00
, h10
, src0
, src1
, outf
);
3328 decode_optmode (mmod
, MM
, outf
);
3333 decode_dsp32alu_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
3336 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
3337 | 1 | 1 | 0 | 0 |.M.| 1 | 0 | - | - | - |.HL|.aopcde............|
3338 |.aop...|.s.|.x.|.dst0......|.dst1......|.src0......|.src1......|
3339 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
3341 int s
= ((iw1
>> DSP32Alu_s_bits
) & DSP32Alu_s_mask
);
3342 int x
= ((iw1
>> DSP32Alu_x_bits
) & DSP32Alu_x_mask
);
3343 int aop
= ((iw1
>> DSP32Alu_aop_bits
) & DSP32Alu_aop_mask
);
3344 int src0
= ((iw1
>> DSP32Alu_src0_bits
) & DSP32Alu_src0_mask
);
3345 int src1
= ((iw1
>> DSP32Alu_src1_bits
) & DSP32Alu_src1_mask
);
3346 int dst0
= ((iw1
>> DSP32Alu_dst0_bits
) & DSP32Alu_dst0_mask
);
3347 int dst1
= ((iw1
>> DSP32Alu_dst1_bits
) & DSP32Alu_dst1_mask
);
3348 int HL
= ((iw0
>> (DSP32Alu_HL_bits
- 16)) & DSP32Alu_HL_mask
);
3349 int aopcde
= ((iw0
>> (DSP32Alu_aopcde_bits
- 16)) & DSP32Alu_aopcde_mask
);
3351 if (aop
== 0 && aopcde
== 9 && HL
== 0 && s
== 0)
3353 notethat ("A0.L = dregs_lo");
3354 OUTS (outf
, "A0.L=");
3355 OUTS (outf
, dregs_lo (src0
));
3358 else if (aop
== 2 && aopcde
== 9 && HL
== 1 && s
== 0)
3360 notethat ("A1.H = dregs_hi");
3361 OUTS (outf
, "A1.H=");
3362 OUTS (outf
, dregs_hi (src0
));
3365 else if (aop
== 2 && aopcde
== 9 && HL
== 0 && s
== 0)
3367 notethat ("A1.L = dregs_lo");
3368 OUTS (outf
, "A1.L=");
3369 OUTS (outf
, dregs_lo (src0
));
3372 else if (aop
== 0 && aopcde
== 9 && HL
== 1 && s
== 0)
3374 notethat ("A0.H = dregs_hi");
3375 OUTS (outf
, "A0.H=");
3376 OUTS (outf
, dregs_hi (src0
));
3379 else if (x
== 1 && HL
== 1 && aop
== 3 && aopcde
== 5)
3381 notethat ("dregs_hi = dregs - dregs (RND20)");
3382 OUTS (outf
, dregs_hi (dst0
));
3384 OUTS (outf
, dregs (src0
));
3386 OUTS (outf
, dregs (src1
));
3387 OUTS (outf
, "(RND20)");
3390 else if (x
== 1 && HL
== 1 && aop
== 2 && aopcde
== 5)
3392 notethat ("dregs_hi = dregs + dregs (RND20)");
3393 OUTS (outf
, dregs_hi (dst0
));
3395 OUTS (outf
, dregs (src0
));
3397 OUTS (outf
, dregs (src1
));
3398 OUTS (outf
, "(RND20)");
3401 else if (x
== 0 && HL
== 0 && aop
== 1 && aopcde
== 5)
3403 notethat ("dregs_lo = dregs - dregs (RND12)");
3404 OUTS (outf
, dregs_lo (dst0
));
3406 OUTS (outf
, dregs (src0
));
3408 OUTS (outf
, dregs (src1
));
3409 OUTS (outf
, "(RND12)");
3412 else if (x
== 0 && HL
== 0 && aop
== 0 && aopcde
== 5)
3414 notethat ("dregs_lo = dregs + dregs (RND12)");
3415 OUTS (outf
, dregs_lo (dst0
));
3417 OUTS (outf
, dregs (src0
));
3419 OUTS (outf
, dregs (src1
));
3420 OUTS (outf
, "(RND12)");
3423 else if (x
== 1 && HL
== 0 && aop
== 3 && aopcde
== 5)
3425 notethat ("dregs_lo = dregs - dregs (RND20)");
3426 OUTS (outf
, dregs_lo (dst0
));
3428 OUTS (outf
, dregs (src0
));
3430 OUTS (outf
, dregs (src1
));
3431 OUTS (outf
, "(RND20)");
3434 else if (x
== 0 && HL
== 1 && aop
== 0 && aopcde
== 5)
3436 notethat ("dregs_hi = dregs + dregs (RND12)");
3437 OUTS (outf
, dregs_hi (dst0
));
3439 OUTS (outf
, dregs (src0
));
3441 OUTS (outf
, dregs (src1
));
3442 OUTS (outf
, "(RND12)");
3445 else if (x
== 1 && HL
== 0 && aop
== 2 && aopcde
== 5)
3447 notethat ("dregs_lo = dregs + dregs (RND20)");
3448 OUTS (outf
, dregs_lo (dst0
));
3450 OUTS (outf
, dregs (src0
));
3452 OUTS (outf
, dregs (src1
));
3453 OUTS (outf
, "(RND20)");
3456 else if (x
== 0 && HL
== 1 && aop
== 1 && aopcde
== 5)
3458 notethat ("dregs_hi = dregs - dregs (RND12)");
3459 OUTS (outf
, dregs_hi (dst0
));
3461 OUTS (outf
, dregs (src0
));
3463 OUTS (outf
, dregs (src1
));
3464 OUTS (outf
, "(RND12)");
3467 else if (HL
== 1 && aop
== 0 && aopcde
== 2)
3469 notethat ("dregs_hi = dregs_lo + dregs_lo amod1");
3470 OUTS (outf
, dregs_hi (dst0
));
3472 OUTS (outf
, dregs_lo (src0
));
3474 OUTS (outf
, dregs_lo (src1
));
3479 else if (HL
== 1 && aop
== 1 && aopcde
== 2)
3481 notethat ("dregs_hi = dregs_lo + dregs_hi amod1");
3482 OUTS (outf
, dregs_hi (dst0
));
3484 OUTS (outf
, dregs_lo (src0
));
3486 OUTS (outf
, dregs_hi (src1
));
3491 else if (HL
== 1 && aop
== 2 && aopcde
== 2)
3493 notethat ("dregs_hi = dregs_hi + dregs_lo amod1");
3494 OUTS (outf
, dregs_hi (dst0
));
3496 OUTS (outf
, dregs_hi (src0
));
3498 OUTS (outf
, dregs_lo (src1
));
3503 else if (HL
== 1 && aop
== 3 && aopcde
== 2)
3505 notethat ("dregs_hi = dregs_hi + dregs_hi amod1");
3506 OUTS (outf
, dregs_hi (dst0
));
3508 OUTS (outf
, dregs_hi (src0
));
3510 OUTS (outf
, dregs_hi (src1
));
3515 else if (HL
== 0 && aop
== 0 && aopcde
== 3)
3517 notethat ("dregs_lo = dregs_lo - dregs_lo amod1");
3518 OUTS (outf
, dregs_lo (dst0
));
3520 OUTS (outf
, dregs_lo (src0
));
3522 OUTS (outf
, dregs_lo (src1
));
3527 else if (HL
== 0 && aop
== 1 && aopcde
== 3)
3529 notethat ("dregs_lo = dregs_lo - dregs_hi amod1");
3530 OUTS (outf
, dregs_lo (dst0
));
3532 OUTS (outf
, dregs_lo (src0
));
3534 OUTS (outf
, dregs_hi (src1
));
3539 else if (HL
== 0 && aop
== 3 && aopcde
== 2)
3541 notethat ("dregs_lo = dregs_hi + dregs_hi amod1");
3542 OUTS (outf
, dregs_lo (dst0
));
3544 OUTS (outf
, dregs_hi (src0
));
3546 OUTS (outf
, dregs_hi (src1
));
3551 else if (HL
== 1 && aop
== 0 && aopcde
== 3)
3553 notethat ("dregs_hi = dregs_lo - dregs_lo amod1");
3554 OUTS (outf
, dregs_hi (dst0
));
3556 OUTS (outf
, dregs_lo (src0
));
3558 OUTS (outf
, dregs_lo (src1
));
3563 else if (HL
== 1 && aop
== 1 && aopcde
== 3)
3565 notethat ("dregs_hi = dregs_lo - dregs_hi amod1");
3566 OUTS (outf
, dregs_hi (dst0
));
3568 OUTS (outf
, dregs_lo (src0
));
3570 OUTS (outf
, dregs_hi (src1
));
3575 else if (HL
== 1 && aop
== 2 && aopcde
== 3)
3577 notethat ("dregs_hi = dregs_hi - dregs_lo amod1");
3578 OUTS (outf
, dregs_hi (dst0
));
3580 OUTS (outf
, dregs_hi (src0
));
3582 OUTS (outf
, dregs_lo (src1
));
3587 else if (HL
== 1 && aop
== 3 && aopcde
== 3)
3589 notethat ("dregs_hi = dregs_hi - dregs_hi amod1");
3590 OUTS (outf
, dregs_hi (dst0
));
3592 OUTS (outf
, dregs_hi (src0
));
3594 OUTS (outf
, dregs_hi (src1
));
3599 else if (HL
== 0 && aop
== 2 && aopcde
== 2)
3601 notethat ("dregs_lo = dregs_hi + dregs_lo amod1");
3602 OUTS (outf
, dregs_lo (dst0
));
3604 OUTS (outf
, dregs_hi (src0
));
3606 OUTS (outf
, dregs_lo (src1
));
3611 else if (HL
== 0 && aop
== 1 && aopcde
== 2)
3613 notethat ("dregs_lo = dregs_lo + dregs_hi amod1");
3614 OUTS (outf
, dregs_lo (dst0
));
3616 OUTS (outf
, dregs_lo (src0
));
3618 OUTS (outf
, dregs_hi (src1
));
3623 else if (HL
== 0 && aop
== 2 && aopcde
== 3)
3625 notethat ("dregs_lo = dregs_hi - dregs_lo amod1");
3626 OUTS (outf
, dregs_lo (dst0
));
3628 OUTS (outf
, dregs_hi (src0
));
3630 OUTS (outf
, dregs_lo (src1
));
3635 else if (HL
== 0 && aop
== 3 && aopcde
== 3)
3637 notethat ("dregs_lo = dregs_hi - dregs_hi amod1");
3638 OUTS (outf
, dregs_lo (dst0
));
3640 OUTS (outf
, dregs_hi (src0
));
3642 OUTS (outf
, dregs_hi (src1
));
3647 else if (HL
== 0 && aop
== 0 && aopcde
== 2)
3649 notethat ("dregs_lo = dregs_lo + dregs_lo amod1");
3650 OUTS (outf
, dregs_lo (dst0
));
3652 OUTS (outf
, dregs_lo (src0
));
3654 OUTS (outf
, dregs_lo (src1
));
3659 else if (aop
== 0 && aopcde
== 9 && s
== 1)
3661 notethat ("A0 = dregs");
3663 OUTS (outf
, dregs (src0
));
3666 else if (aop
== 3 && aopcde
== 11 && s
== 0)
3668 notethat ("A0 -= A1");
3669 OUTS (outf
, "A0-=A1");
3672 else if (aop
== 3 && aopcde
== 11 && s
== 1)
3674 notethat ("A0 -= A1 (W32)");
3675 OUTS (outf
, "A0-=A1(W32)");
3678 else if (aop
== 3 && aopcde
== 22 && HL
== 1)
3680 notethat ("dregs = BYTEOP2M ( dregs_pair , dregs_pair ) (TH , R)");
3681 OUTS (outf
, dregs (dst0
));
3682 OUTS (outf
, "=BYTEOP2M(");
3683 OUTS (outf
, dregs (src0
+ 1));
3685 OUTS (outf
, imm5 (src0
));
3687 OUTS (outf
, dregs (src1
+ 1));
3689 OUTS (outf
, imm5 (src1
));
3690 OUTS (outf
, ")(TH");
3692 OUTS (outf
, ", R)");
3697 else if (aop
== 3 && aopcde
== 22 && HL
== 0)
3699 notethat ("dregs = BYTEOP2M ( dregs_pair , dregs_pair ) (TL , R)");
3700 OUTS (outf
, dregs (dst0
));
3701 OUTS (outf
, "=BYTEOP2M(");
3702 OUTS (outf
, dregs (src0
+ 1));
3704 OUTS (outf
, imm5 (src0
));
3706 OUTS (outf
, dregs (src1
+ 1));
3708 OUTS (outf
, imm5 (src1
));
3709 OUTS (outf
, ")(TL");
3711 OUTS (outf
, ", R)");
3716 else if (aop
== 2 && aopcde
== 22 && HL
== 1)
3718 notethat ("dregs = BYTEOP2M ( dregs_pair , dregs_pair ) (RNDH , R)");
3719 OUTS (outf
, dregs (dst0
));
3720 OUTS (outf
, "=BYTEOP2M(");
3721 OUTS (outf
, dregs (src0
+ 1));
3723 OUTS (outf
, imm5 (src0
));
3725 OUTS (outf
, dregs (src1
+ 1));
3727 OUTS (outf
, imm5 (src1
));
3728 OUTS (outf
, ")(RNDH");
3730 OUTS (outf
, ", R)");
3735 else if (aop
== 2 && aopcde
== 22 && HL
== 0)
3737 notethat ("dregs = BYTEOP2M ( dregs_pair , dregs_pair ) (RNDL , R)");
3738 OUTS (outf
, dregs (dst0
));
3739 OUTS (outf
, "=BYTEOP2M(");
3740 OUTS (outf
, dregs (src0
+ 1));
3742 OUTS (outf
, imm5 (src0
));
3744 OUTS (outf
, dregs (src1
+ 1));
3746 OUTS (outf
, imm5 (src1
));
3747 OUTS (outf
, ")(RNDL");
3749 OUTS (outf
, ", R)");
3754 else if (aop
== 1 && aopcde
== 22 && HL
== 1)
3756 notethat ("dregs = BYTEOP2P ( dregs_pair , dregs_pair ) (TH , R)");
3757 OUTS (outf
, dregs (dst0
));
3758 OUTS (outf
, "=BYTEOP2P(");
3759 OUTS (outf
, dregs (src0
+ 1));
3761 OUTS (outf
, imm5 (src0
));
3763 OUTS (outf
, dregs (src1
+ 1));
3765 OUTS (outf
, imm5 (src1
));
3766 OUTS (outf
, ")(TH");
3768 OUTS (outf
, ", R)");
3773 else if (aop
== 1 && aopcde
== 22 && HL
== 0)
3775 notethat ("dregs = BYTEOP2P ( dregs_pair , dregs_pair ) (TL , R)");
3776 OUTS (outf
, dregs (dst0
));
3777 OUTS (outf
, "=BYTEOP2P(");
3778 OUTS (outf
, dregs (src0
+ 1));
3780 OUTS (outf
, imm5 (src0
));
3782 OUTS (outf
, dregs (src1
+ 1));
3784 OUTS (outf
, imm5 (src1
));
3785 OUTS (outf
, ")(TL");
3787 OUTS (outf
, ", R)");
3792 else if (aop
== 0 && aopcde
== 22 && HL
== 1)
3794 notethat ("dregs = BYTEOP2P ( dregs_pair , dregs_pair ) (RNDH , R)");
3795 OUTS (outf
, dregs (dst0
));
3796 OUTS (outf
, "=BYTEOP2P(");
3797 OUTS (outf
, dregs (src0
+ 1));
3799 OUTS (outf
, imm5 (src0
));
3801 OUTS (outf
, dregs (src1
+ 1));
3803 OUTS (outf
, imm5 (src1
));
3804 OUTS (outf
, ")(RNDH");
3806 OUTS (outf
, ", R)");
3811 else if (aop
== 0 && aopcde
== 22 && HL
== 0)
3813 notethat ("dregs = BYTEOP2P ( dregs_pair , dregs_pair ) (RNDL , aligndir)");
3814 OUTS (outf
, dregs (dst0
));
3815 OUTS (outf
, "=BYTEOP2P(");
3816 OUTS (outf
, dregs (src0
+ 1));
3818 OUTS (outf
, imm5 (src0
));
3820 OUTS (outf
, dregs (src1
+ 1));
3822 OUTS (outf
, imm5 (src1
));
3823 OUTS (outf
, ")(RNDL");
3825 OUTS (outf
, ", R)");
3830 else if (aop
== 0 && s
== 0 && aopcde
== 8)
3832 notethat ("A0 = 0");
3833 OUTS (outf
, "A0=0");
3836 else if (aop
== 0 && s
== 1 && aopcde
== 8)
3838 notethat ("A0 = A0 (S)");
3839 OUTS (outf
, "A0=A0(S)");
3842 else if (aop
== 1 && s
== 0 && aopcde
== 8)
3844 notethat ("A1 = 0");
3845 OUTS (outf
, "A1=0");
3848 else if (aop
== 1 && s
== 1 && aopcde
== 8)
3850 notethat ("A1 = A1 (S)");
3851 OUTS (outf
, "A1=A1(S)");
3854 else if (aop
== 2 && s
== 0 && aopcde
== 8)
3856 notethat ("A1 = A0 = 0");
3857 OUTS (outf
, "A1=A0=0");
3860 else if (aop
== 2 && s
== 1 && aopcde
== 8)
3862 notethat ("A1 = A1 (S) , A0 = A0 (S)");
3863 OUTS (outf
, "A1=A1(S),A0=A0(S)");
3866 else if (aop
== 3 && s
== 0 && aopcde
== 8)
3868 notethat ("A0 = A1");
3869 OUTS (outf
, "A0=A1");
3872 else if (aop
== 3 && s
== 1 && aopcde
== 8)
3874 notethat ("A1 = A0");
3875 OUTS (outf
, "A1=A0");
3878 else if (aop
== 1 && aopcde
== 9 && s
== 0)
3880 notethat ("A0.x = dregs_lo");
3881 OUTS (outf
, "A0.x=");
3882 OUTS (outf
, dregs_lo (src0
));
3885 else if (aop
== 1 && HL
== 0 && aopcde
== 11)
3887 notethat ("dregs_lo = ( A0 += A1 )");
3888 OUTS (outf
, dregs_lo (dst0
));
3889 OUTS (outf
, "=(A0+=A1)");
3892 else if (aop
== 3 && HL
== 0 && aopcde
== 16)
3894 notethat ("A1 = ABS A1, A0 = ABS A0");
3895 OUTS (outf
, "A1= ABS A0,A0= ABS A0");
3898 else if (aop
== 0 && aopcde
== 23 && HL
== 1)
3900 notethat ("dregs = BYTEOP3P ( dregs_pair , dregs_pair ) (HI , R)");
3901 OUTS (outf
, dregs (dst0
));
3902 OUTS (outf
, "=BYTEOP3P(");
3903 OUTS (outf
, dregs (src0
+ 1));
3905 OUTS (outf
, imm5 (src0
));
3907 OUTS (outf
, dregs (src1
+ 1));
3909 OUTS (outf
, imm5 (src1
));
3910 OUTS (outf
, ")(HI");
3912 OUTS (outf
, ", R)");
3917 else if (aop
== 3 && aopcde
== 9 && s
== 0)
3919 notethat ("A1.x = dregs_lo");
3920 OUTS (outf
, "A1.x=");
3921 OUTS (outf
, dregs_lo (src0
));
3924 else if (aop
== 1 && HL
== 1 && aopcde
== 16)
3926 notethat ("A1 = ABS A1");
3927 OUTS (outf
, "A1= ABS A1");
3930 else if (aop
== 0 && HL
== 1 && aopcde
== 16)
3932 notethat ("A1 = ABS A0");
3933 OUTS (outf
, "A1= ABS A0");
3936 else if (aop
== 2 && aopcde
== 9 && s
== 1)
3938 notethat ("A1 = dregs");
3940 OUTS (outf
, dregs (src0
));
3943 else if (HL
== 0 && aop
== 3 && aopcde
== 12)
3945 notethat ("dregs_lo = dregs (RND)");
3946 OUTS (outf
, dregs_lo (dst0
));
3948 OUTS (outf
, dregs (src0
));
3949 OUTS (outf
, "(RND)");
3952 else if (aop
== 1 && HL
== 0 && aopcde
== 16)
3954 notethat ("A0 = ABS A1");
3955 OUTS (outf
, "A0= ABS A1");
3958 else if (aop
== 0 && HL
== 0 && aopcde
== 16)
3960 notethat ("A0 = ABS A0");
3961 OUTS (outf
, "A0= ABS A0");
3964 else if (aop
== 3 && HL
== 0 && aopcde
== 15)
3966 notethat ("dregs = - dregs (V)");
3967 OUTS (outf
, dregs (dst0
));
3969 OUTS (outf
, dregs (src0
));
3973 else if (aop
== 3 && s
== 1 && HL
== 0 && aopcde
== 7)
3975 notethat ("dregs = - dregs (S)");
3976 OUTS (outf
, dregs (dst0
));
3978 OUTS (outf
, dregs (src0
));
3982 else if (aop
== 3 && s
== 0 && HL
== 0 && aopcde
== 7)
3984 notethat ("dregs = - dregs (NS)");
3985 OUTS (outf
, dregs (dst0
));
3987 OUTS (outf
, dregs (src0
));
3988 OUTS (outf
, "(NS)");
3991 else if (aop
== 1 && HL
== 1 && aopcde
== 11)
3993 notethat ("dregs_hi = ( A0 += A1 )");
3994 OUTS (outf
, dregs_hi (dst0
));
3995 OUTS (outf
, "=(A0+=A1)");
3998 else if (aop
== 2 && aopcde
== 11 && s
== 0)
4000 notethat ("A0 += A1");
4001 OUTS (outf
, "A0+=A1");
4004 else if (aop
== 2 && aopcde
== 11 && s
== 1)
4006 notethat ("A0 += A1 (W32)");
4007 OUTS (outf
, "A0+=A1(W32)");
4010 else if (aop
== 3 && HL
== 0 && aopcde
== 14)
4012 notethat ("A1 = - A1 , A0 = - A0");
4013 OUTS (outf
, "A1=-A1,A0=-A0");
4016 else if (HL
== 1 && aop
== 3 && aopcde
== 12)
4018 notethat ("dregs_hi = dregs (RND)");
4019 OUTS (outf
, dregs_hi (dst0
));
4021 OUTS (outf
, dregs (src0
));
4022 OUTS (outf
, "(RND)");
4025 else if (aop
== 0 && aopcde
== 23 && HL
== 0)
4027 notethat ("dregs = BYTEOP3P ( dregs_pair , dregs_pair ) (LO , R)");
4028 OUTS (outf
, dregs (dst0
));
4029 OUTS (outf
, "=BYTEOP3P(");
4030 OUTS (outf
, dregs (src0
+ 1));
4032 OUTS (outf
, imm5 (src0
));
4034 OUTS (outf
, dregs (src1
+ 1));
4036 OUTS (outf
, imm5 (src1
));
4037 OUTS (outf
, ")(LO");
4039 OUTS (outf
, ", R)");
4044 else if (aop
== 0 && HL
== 0 && aopcde
== 14)
4046 notethat ("A0 = - A0");
4047 OUTS (outf
, "A0=-A0");
4050 else if (aop
== 1 && HL
== 0 && aopcde
== 14)
4052 notethat ("A0 = - A1");
4053 OUTS (outf
, "A0=-A1");
4056 else if (aop
== 0 && HL
== 1 && aopcde
== 14)
4058 notethat ("A1 = - A0");
4059 OUTS (outf
, "A1=-A0");
4062 else if (aop
== 1 && HL
== 1 && aopcde
== 14)
4064 notethat ("A1 = - A1");
4065 OUTS (outf
, "A1=-A1");
4068 else if (aop
== 0 && aopcde
== 12)
4070 notethat ("dregs_hi=dregs_lo=SIGN(dregs_hi)*dregs_hi + SIGN(dregs_lo)*dregs_lo)");
4071 OUTS (outf
, dregs_hi (dst0
));
4073 OUTS (outf
, dregs_lo (dst0
));
4074 OUTS (outf
, "=SIGN(");
4075 OUTS (outf
, dregs_hi (src0
));
4077 OUTS (outf
, dregs_hi (src1
));
4078 OUTS (outf
, "+SIGN(");
4079 OUTS (outf
, dregs_lo (src0
));
4081 OUTS (outf
, dregs_lo (src1
));
4085 else if (aop
== 2 && aopcde
== 0)
4087 notethat ("dregs = dregs -|+ dregs amod0");
4088 OUTS (outf
, dregs (dst0
));
4090 OUTS (outf
, dregs (src0
));
4092 OUTS (outf
, dregs (src1
));
4097 else if (aop
== 1 && aopcde
== 12)
4099 notethat ("dregs = A1.L + A1.H , dregs = A0.L + A0.H");
4100 OUTS (outf
, dregs (dst1
));
4101 OUTS (outf
, "=A1.L+A1.H,");
4102 OUTS (outf
, dregs (dst0
));
4103 OUTS (outf
, "=A0.L+A0.H");
4106 else if (aop
== 2 && aopcde
== 4)
4108 notethat ("dregs = dregs + dregs , dregs = dregs - dregs amod1");
4109 OUTS (outf
, dregs (dst1
));
4111 OUTS (outf
, dregs (src0
));
4113 OUTS (outf
, dregs (src1
));
4115 OUTS (outf
, dregs (dst0
));
4117 OUTS (outf
, dregs (src0
));
4119 OUTS (outf
, dregs (src1
));
4124 else if (HL
== 0 && aopcde
== 1)
4126 notethat ("dregs = dregs +|+ dregs , dregs = dregs -|- dregs (amod0, amod2)");
4127 OUTS (outf
, dregs (dst1
));
4129 OUTS (outf
, dregs (src0
));
4131 OUTS (outf
, dregs (src1
));
4133 OUTS (outf
, dregs (dst0
));
4135 OUTS (outf
, dregs (src0
));
4137 OUTS (outf
, dregs (src1
));
4138 amod0amod2 (s
, x
, aop
, outf
);
4141 else if (aop
== 0 && aopcde
== 11)
4143 notethat ("dregs = ( A0 += A1 )");
4144 OUTS (outf
, dregs (dst0
));
4145 OUTS (outf
, "=(A0+=A1)");
4148 else if (aop
== 0 && aopcde
== 10)
4150 notethat ("dregs_lo = A0.x");
4151 OUTS (outf
, dregs_lo (dst0
));
4152 OUTS (outf
, "=A0.x");
4155 else if (aop
== 1 && aopcde
== 10)
4157 notethat ("dregs_lo = A1.x");
4158 OUTS (outf
, dregs_lo (dst0
));
4159 OUTS (outf
, "=A1.x");
4162 else if (aop
== 1 && aopcde
== 0)
4164 notethat ("dregs = dregs +|- dregs amod0");
4165 OUTS (outf
, dregs (dst0
));
4167 OUTS (outf
, dregs (src0
));
4169 OUTS (outf
, dregs (src1
));
4174 else if (aop
== 3 && aopcde
== 0)
4176 notethat ("dregs = dregs -|- dregs amod0");
4177 OUTS (outf
, dregs (dst0
));
4179 OUTS (outf
, dregs (src0
));
4181 OUTS (outf
, dregs (src1
));
4186 else if (aop
== 1 && aopcde
== 4)
4188 notethat ("dregs = dregs - dregs amod1");
4189 OUTS (outf
, dregs (dst0
));
4191 OUTS (outf
, dregs (src0
));
4193 OUTS (outf
, dregs (src1
));
4198 else if (aop
== 0 && aopcde
== 17)
4200 notethat ("dregs = A1 + A0, dregs = A1 - A0 amod1");
4201 OUTS (outf
, dregs (dst1
));
4202 OUTS (outf
, "=A1+A0,");
4203 OUTS (outf
, dregs (dst0
));
4204 OUTS (outf
, "=A1-A0 ");
4208 else if (aop
== 1 && aopcde
== 17)
4210 notethat ("dregs = A0 + A1, dregs = A0 - A1 amod1");
4211 OUTS (outf
, dregs (dst1
));
4212 OUTS (outf
, "=A0+A1,");
4213 OUTS (outf
, dregs (dst0
));
4214 OUTS (outf
, "=A0-A1 ");
4218 else if (aop
== 0 && aopcde
== 18)
4220 notethat ("SAA ( dregs_pair , dregs_pair ) aligndir");
4221 OUTS (outf
, "SAA(");
4222 OUTS (outf
, dregs (src0
+ 1));
4224 OUTS (outf
, imm5 (src0
));
4226 OUTS (outf
, dregs (src1
+ 1));
4228 OUTS (outf
, imm5 (src1
));
4233 else if (aop
== 3 && aopcde
== 18)
4235 notethat ("DISALGNEXCPT");
4236 OUTS (outf
, "DISALGNEXCPT");
4239 else if (aop
== 0 && aopcde
== 20)
4241 notethat ("dregs = BYTEOP1P ( dregs_pair , dregs_pair ) aligndir");
4242 OUTS (outf
, dregs (dst0
));
4243 OUTS (outf
, "=BYTEOP1P(");
4244 OUTS (outf
, dregs (src0
+ 1));
4246 OUTS (outf
, imm5 (src0
));
4248 OUTS (outf
, dregs (src1
+ 1));
4250 OUTS (outf
, imm5 (src1
));
4255 else if (aop
== 1 && aopcde
== 20)
4257 notethat ("dregs = BYTEOP1P ( dregs_pair , dregs_pair ) (T, R)");
4258 OUTS (outf
, dregs (dst0
));
4259 OUTS (outf
, "=BYTEOP1P(");
4260 OUTS (outf
, dregs (src0
+ 1));
4262 OUTS (outf
, imm5 (src0
));
4264 OUTS (outf
, dregs (src1
+ 1));
4266 OUTS (outf
, imm5 (src1
));
4269 OUTS (outf
, ", R)");
4274 else if (aop
== 0 && aopcde
== 21)
4276 notethat ("( dregs , dregs ) = BYTEOP16P ( dregs_pair , dregs_pair ) aligndir");
4278 OUTS (outf
, dregs (dst1
));
4280 OUTS (outf
, dregs (dst0
));
4281 OUTS (outf
, ")=BYTEOP16P(");
4282 OUTS (outf
, dregs (src0
+ 1));
4284 OUTS (outf
, imm5 (src0
));
4286 OUTS (outf
, dregs (src1
+ 1));
4288 OUTS (outf
, imm5 (src1
));
4293 else if (aop
== 1 && aopcde
== 21)
4295 notethat ("( dregs , dregs ) = BYTEOP16M ( dregs_pair , dregs_pair ) aligndir");
4297 OUTS (outf
, dregs (dst1
));
4299 OUTS (outf
, dregs (dst0
));
4300 OUTS (outf
, ")=BYTEOP16M(");
4301 OUTS (outf
, dregs (src0
+ 1));
4303 OUTS (outf
, imm5 (src0
));
4305 OUTS (outf
, dregs (src1
+ 1));
4307 OUTS (outf
, imm5 (src1
));
4312 else if (aop
== 2 && aopcde
== 7)
4314 notethat ("dregs = ABS dregs");
4315 OUTS (outf
, dregs (dst0
));
4316 OUTS (outf
, "= ABS ");
4317 OUTS (outf
, dregs (src0
));
4320 else if (aop
== 1 && aopcde
== 7)
4322 notethat ("dregs = MIN ( dregs , dregs )");
4323 OUTS (outf
, dregs (dst0
));
4324 OUTS (outf
, "=MIN(");
4325 OUTS (outf
, dregs (src0
));
4327 OUTS (outf
, dregs (src1
));
4331 else if (aop
== 0 && aopcde
== 7)
4333 notethat ("dregs = MAX ( dregs , dregs )");
4334 OUTS (outf
, dregs (dst0
));
4335 OUTS (outf
, "=MAX(");
4336 OUTS (outf
, dregs (src0
));
4338 OUTS (outf
, dregs (src1
));
4342 else if (aop
== 2 && aopcde
== 6)
4344 notethat ("dregs = ABS dregs (V)");
4345 OUTS (outf
, dregs (dst0
));
4346 OUTS (outf
, "= ABS ");
4347 OUTS (outf
, dregs (src0
));
4351 else if (aop
== 1 && aopcde
== 6)
4353 notethat ("dregs = MIN ( dregs , dregs ) (V)");
4354 OUTS (outf
, dregs (dst0
));
4355 OUTS (outf
, "=MIN(");
4356 OUTS (outf
, dregs (src0
));
4358 OUTS (outf
, dregs (src1
));
4359 OUTS (outf
, ")(V)");
4362 else if (aop
== 0 && aopcde
== 6)
4364 notethat ("dregs = MAX ( dregs , dregs ) (V)");
4365 OUTS (outf
, dregs (dst0
));
4366 OUTS (outf
, "=MAX(");
4367 OUTS (outf
, dregs (src0
));
4369 OUTS (outf
, dregs (src1
));
4370 OUTS (outf
, ")(V)");
4373 else if (HL
== 1 && aopcde
== 1)
4375 notethat ("dregs = dregs +|- dregs, dregs = dregs -|+ dregs (amod0, amod2)");
4376 OUTS (outf
, dregs (dst1
));
4378 OUTS (outf
, dregs (src0
));
4380 OUTS (outf
, dregs (src1
));
4382 OUTS (outf
, dregs (dst0
));
4384 OUTS (outf
, dregs (src0
));
4386 OUTS (outf
, dregs (src1
));
4387 amod0amod2 (s
, x
, aop
, outf
);
4390 else if (aop
== 0 && aopcde
== 4)
4392 notethat ("dregs = dregs + dregs amod1");
4393 OUTS (outf
, dregs (dst0
));
4395 OUTS (outf
, dregs (src0
));
4397 OUTS (outf
, dregs (src1
));
4402 else if (aop
== 0 && aopcde
== 0)
4404 notethat ("dregs = dregs +|+ dregs amod0");
4405 OUTS (outf
, dregs (dst0
));
4407 OUTS (outf
, dregs (src0
));
4409 OUTS (outf
, dregs (src1
));
4414 else if (aop
== 0 && aopcde
== 24)
4416 notethat ("dregs = BYTEPACK ( dregs , dregs )");
4417 OUTS (outf
, dregs (dst0
));
4418 OUTS (outf
, "=BYTEPACK(");
4419 OUTS (outf
, dregs (src0
));
4421 OUTS (outf
, dregs (src1
));
4425 else if (aop
== 1 && aopcde
== 24)
4427 notethat ("( dregs , dregs ) = BYTEUNPACK dregs_pair aligndir");
4429 OUTS (outf
, dregs (dst1
));
4431 OUTS (outf
, dregs (dst0
));
4432 OUTS (outf
, ") = BYTEUNPACK ");
4433 OUTS (outf
, dregs (src0
+ 1));
4435 OUTS (outf
, imm5 (src0
));
4440 else if (aopcde
== 13)
4442 notethat ("( dregs , dregs ) = SEARCH dregs (searchmod)");
4444 OUTS (outf
, dregs (dst1
));
4446 OUTS (outf
, dregs (dst0
));
4447 OUTS (outf
, ") = SEARCH ");
4448 OUTS (outf
, dregs (src0
));
4450 searchmod (aop
, outf
);
4455 goto illegal_instruction
;
4456 illegal_instruction
:
4461 decode_dsp32shift_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
4464 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
4465 | 1 | 1 | 0 | 0 |.M.| 1 | 1 | 0 | 0 | - | - |.sopcde............|
4466 |.sop...|.HLs...|.dst0......| - | - | - |.src0......|.src1......|
4467 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
4469 int HLs
= ((iw1
>> DSP32Shift_HLs_bits
) & DSP32Shift_HLs_mask
);
4470 int sop
= ((iw1
>> DSP32Shift_sop_bits
) & DSP32Shift_sop_mask
);
4471 int src0
= ((iw1
>> DSP32Shift_src0_bits
) & DSP32Shift_src0_mask
);
4472 int src1
= ((iw1
>> DSP32Shift_src1_bits
) & DSP32Shift_src1_mask
);
4473 int dst0
= ((iw1
>> DSP32Shift_dst0_bits
) & DSP32Shift_dst0_mask
);
4474 int sopcde
= ((iw0
>> (DSP32Shift_sopcde_bits
- 16)) & DSP32Shift_sopcde_mask
);
4475 const char *acc01
= (HLs
& 1) == 0 ? "A0" : "A1";
4478 if (HLs
== 0 && sop
== 0 && sopcde
== 0)
4480 notethat ("dregs_lo = ASHIFT dregs_lo BY dregs_lo");
4481 OUTS (outf
, dregs_lo (dst0
));
4482 OUTS (outf
, "= ASHIFT ");
4483 OUTS (outf
, dregs_lo (src1
));
4484 OUTS (outf
, " BY ");
4485 OUTS (outf
, dregs_lo (src0
));
4488 else if (HLs
== 1 && sop
== 0 && sopcde
== 0)
4490 notethat ("dregs_lo = ASHIFT dregs_hi BY dregs_lo");
4491 OUTS (outf
, dregs_lo (dst0
));
4492 OUTS (outf
, "= ASHIFT ");
4493 OUTS (outf
, dregs_hi (src1
));
4494 OUTS (outf
, " BY ");
4495 OUTS (outf
, dregs_lo (src0
));
4498 else if (HLs
== 2 && sop
== 0 && sopcde
== 0)
4500 notethat ("dregs_hi = ASHIFT dregs_lo BY dregs_lo");
4501 OUTS (outf
, dregs_hi (dst0
));
4502 OUTS (outf
, "= ASHIFT ");
4503 OUTS (outf
, dregs_lo (src1
));
4504 OUTS (outf
, " BY ");
4505 OUTS (outf
, dregs_lo (src0
));
4508 else if (HLs
== 3 && sop
== 0 && sopcde
== 0)
4510 notethat ("dregs_hi = ASHIFT dregs_hi BY dregs_lo");
4511 OUTS (outf
, dregs_hi (dst0
));
4512 OUTS (outf
, "= ASHIFT ");
4513 OUTS (outf
, dregs_hi (src1
));
4514 OUTS (outf
, " BY ");
4515 OUTS (outf
, dregs_lo (src0
));
4518 else if (HLs
== 0 && sop
== 1 && sopcde
== 0)
4520 notethat ("dregs_lo = ASHIFT dregs_lo BY dregs_lo (S)");
4521 OUTS (outf
, dregs_lo (dst0
));
4522 OUTS (outf
, "= ASHIFT ");
4523 OUTS (outf
, dregs_lo (src1
));
4524 OUTS (outf
, " BY ");
4525 OUTS (outf
, dregs_lo (src0
));
4529 else if (HLs
== 1 && sop
== 1 && sopcde
== 0)
4531 notethat ("dregs_lo = ASHIFT dregs_hi BY dregs_lo (S)");
4532 OUTS (outf
, dregs_lo (dst0
));
4533 OUTS (outf
, "= ASHIFT ");
4534 OUTS (outf
, dregs_hi (src1
));
4535 OUTS (outf
, " BY ");
4536 OUTS (outf
, dregs_lo (src0
));
4540 else if (HLs
== 2 && sop
== 1 && sopcde
== 0)
4542 notethat ("dregs_hi = ASHIFT dregs_lo BY dregs_lo (S)");
4543 OUTS (outf
, dregs_hi (dst0
));
4544 OUTS (outf
, "= ASHIFT ");
4545 OUTS (outf
, dregs_lo (src1
));
4546 OUTS (outf
, " BY ");
4547 OUTS (outf
, dregs_lo (src0
));
4551 else if (HLs
== 3 && sop
== 1 && sopcde
== 0)
4553 notethat ("dregs_hi = ASHIFT dregs_hi BY dregs_lo (S)");
4554 OUTS (outf
, dregs_hi (dst0
));
4555 OUTS (outf
, "= ASHIFT ");
4556 OUTS (outf
, dregs_hi (src1
));
4557 OUTS (outf
, " BY ");
4558 OUTS (outf
, dregs_lo (src0
));
4562 else if (sop
== 2 && sopcde
== 0)
4564 notethat ("dregs_hilo = LSHIFT dregs_hilo BY dregs_lo");
4565 OUTS (outf
, (HLs
& 2) == 0 ? dregs_lo (dst0
) : dregs_hi (dst0
));
4566 OUTS (outf
, "= LSHIFT ");
4567 OUTS (outf
, (HLs
& 1) == 0 ? dregs_lo (src1
) : dregs_hi (src1
));
4568 OUTS (outf
, " BY ");
4569 OUTS (outf
, dregs_lo (src0
));
4572 else if (sop
== 0 && sopcde
== 3)
4574 notethat ("An = ASHIFT An BY dregs_lo");
4576 OUTS (outf
, "= ASHIFT ");
4578 OUTS (outf
, " BY ");
4579 OUTS (outf
, dregs_lo (src0
));
4582 else if (sop
== 1 && sopcde
== 3)
4584 notethat ("An = LSHIFT An BY dregs_lo");
4586 OUTS (outf
, "= LSHIFT ");
4588 OUTS (outf
, " BY ");
4589 OUTS (outf
, dregs_lo (src0
));
4592 else if (sop
== 2 && sopcde
== 3)
4594 notethat ("An = ROT An BY dregs_lo");
4596 OUTS (outf
, "= ROT ");
4598 OUTS (outf
, " BY ");
4599 OUTS (outf
, dregs_lo (src0
));
4602 else if (sop
== 3 && sopcde
== 3)
4604 notethat ("dregs = ROT dregs BY dregs_lo");
4605 OUTS (outf
, dregs (dst0
));
4606 OUTS (outf
, "= ROT ");
4607 OUTS (outf
, dregs (src1
));
4608 OUTS (outf
, " BY ");
4609 OUTS (outf
, dregs_lo (src0
));
4612 else if (sop
== 1 && sopcde
== 1)
4614 notethat ("dregs = ASHIFT dregs BY dregs_lo (V, S)");
4615 OUTS (outf
, dregs (dst0
));
4616 OUTS (outf
, "= ASHIFT ");
4617 OUTS (outf
, dregs (src1
));
4618 OUTS (outf
, " BY ");
4619 OUTS (outf
, dregs_lo (src0
));
4620 OUTS (outf
, "(V,S)");
4623 else if (sop
== 0 && sopcde
== 1)
4625 notethat ("dregs = ASHIFT dregs BY dregs_lo (V)");
4626 OUTS (outf
, dregs (dst0
));
4627 OUTS (outf
, "= ASHIFT ");
4628 OUTS (outf
, dregs (src1
));
4629 OUTS (outf
, " BY ");
4630 OUTS (outf
, dregs_lo (src0
));
4634 else if (sop
== 0 && sopcde
== 2)
4636 notethat ("dregs = ASHIFT dregs BY dregs_lo");
4637 OUTS (outf
, dregs (dst0
));
4638 OUTS (outf
, "= ASHIFT ");
4639 OUTS (outf
, dregs (src1
));
4640 OUTS (outf
, " BY ");
4641 OUTS (outf
, dregs_lo (src0
));
4644 else if (sop
== 1 && sopcde
== 2)
4646 notethat ("dregs = ASHIFT dregs BY dregs_lo (S)");
4647 OUTS (outf
, dregs (dst0
));
4648 OUTS (outf
, "= ASHIFT ");
4649 OUTS (outf
, dregs (src1
));
4650 OUTS (outf
, " BY ");
4651 OUTS (outf
, dregs_lo (src0
));
4655 else if (sop
== 2 && sopcde
== 2)
4657 notethat ("dregs = SHIFT dregs BY dregs_lo");
4658 OUTS (outf
, dregs (dst0
));
4659 OUTS (outf
, "=SHIFT ");
4660 OUTS (outf
, dregs (src1
));
4661 OUTS (outf
, " BY ");
4662 OUTS (outf
, dregs_lo (src0
));
4665 else if (sop
== 3 && sopcde
== 2)
4667 notethat ("dregs = ROT dregs BY dregs_lo");
4668 OUTS (outf
, dregs (dst0
));
4669 OUTS (outf
, "= ROT ");
4670 OUTS (outf
, dregs (src1
));
4671 OUTS (outf
, " BY ");
4672 OUTS (outf
, dregs_lo (src0
));
4675 else if (sop
== 2 && sopcde
== 1)
4677 notethat ("dregs = SHIFT dregs BY dregs_lo (V)");
4678 OUTS (outf
, dregs (dst0
));
4679 OUTS (outf
, "=SHIFT ");
4680 OUTS (outf
, dregs (src1
));
4681 OUTS (outf
, " BY ");
4682 OUTS (outf
, dregs_lo (src0
));
4686 else if (sop
== 0 && sopcde
== 4)
4688 notethat ("dregs = PACK ( dregs_lo , dregs_lo )");
4689 OUTS (outf
, dregs (dst0
));
4690 OUTS (outf
, "=PACK");
4692 OUTS (outf
, dregs_lo (src1
));
4694 OUTS (outf
, dregs_lo (src0
));
4698 else if (sop
== 1 && sopcde
== 4)
4700 notethat ("dregs = PACK ( dregs_lo , dregs_hi )");
4701 OUTS (outf
, dregs (dst0
));
4702 OUTS (outf
, "=PACK(");
4703 OUTS (outf
, dregs_lo (src1
));
4705 OUTS (outf
, dregs_hi (src0
));
4709 else if (sop
== 2 && sopcde
== 4)
4711 notethat ("dregs = PACK ( dregs_hi , dregs_lo )");
4712 OUTS (outf
, dregs (dst0
));
4713 OUTS (outf
, "=PACK(");
4714 OUTS (outf
, dregs_hi (src1
));
4716 OUTS (outf
, dregs_lo (src0
));
4720 else if (sop
== 3 && sopcde
== 4)
4722 notethat ("dregs = PACK ( dregs_hi , dregs_hi )");
4723 OUTS (outf
, dregs (dst0
));
4724 OUTS (outf
, "=PACK(");
4725 OUTS (outf
, dregs_hi (src1
));
4727 OUTS (outf
, dregs_hi (src0
));
4731 else if (sop
== 0 && sopcde
== 5)
4733 notethat ("dregs_lo = SIGNBITS dregs");
4734 OUTS (outf
, dregs_lo (dst0
));
4735 OUTS (outf
, "=SIGNBITS ");
4736 OUTS (outf
, dregs (src1
));
4739 else if (sop
== 1 && sopcde
== 5)
4741 notethat ("dregs_lo = SIGNBITS dregs_lo");
4742 OUTS (outf
, dregs_lo (dst0
));
4743 OUTS (outf
, "=SIGNBITS ");
4744 OUTS (outf
, dregs_lo (src1
));
4747 else if (sop
== 2 && sopcde
== 5)
4749 notethat ("dregs_lo = SIGNBITS dregs_hi");
4750 OUTS (outf
, dregs_lo (dst0
));
4751 OUTS (outf
, "=SIGNBITS ");
4752 OUTS (outf
, dregs_hi (src1
));
4755 else if (sop
== 0 && sopcde
== 6)
4757 notethat ("dregs_lo = SIGNBITS A0");
4758 OUTS (outf
, dregs_lo (dst0
));
4759 OUTS (outf
, "=SIGNBITS A0");
4762 else if (sop
== 1 && sopcde
== 6)
4764 notethat ("dregs_lo = SIGNBITS A1");
4765 OUTS (outf
, dregs_lo (dst0
));
4766 OUTS (outf
, "=SIGNBITS A1");
4769 else if (sop
== 3 && sopcde
== 6)
4771 notethat ("dregs_lo = ONES dregs");
4772 OUTS (outf
, dregs_lo (dst0
));
4773 OUTS (outf
, "=ONES ");
4774 OUTS (outf
, dregs (src1
));
4777 else if (sop
== 0 && sopcde
== 7)
4779 notethat ("dregs_lo = EXPADJ (dregs , dregs_lo)");
4780 OUTS (outf
, dregs_lo (dst0
));
4781 OUTS (outf
, "=EXPADJ (");
4782 OUTS (outf
, dregs (src1
));
4784 OUTS (outf
, dregs_lo (src0
));
4788 else if (sop
== 1 && sopcde
== 7)
4790 notethat ("dregs_lo = EXPADJ (dregs , dregs_lo) (V)");
4791 OUTS (outf
, dregs_lo (dst0
));
4792 OUTS (outf
, "=EXPADJ (");
4793 OUTS (outf
, dregs (src1
));
4795 OUTS (outf
, dregs_lo (src0
));
4796 OUTS (outf
, ") (V)");
4799 else if (sop
== 2 && sopcde
== 7)
4801 notethat ("dregs_lo = EXPADJ (dregs_lo , dregs_lo)");
4802 OUTS (outf
, dregs_lo (dst0
));
4803 OUTS (outf
, "=EXPADJ (");
4804 OUTS (outf
, dregs_lo (src1
));
4806 OUTS (outf
, dregs_lo (src0
));
4810 else if (sop
== 3 && sopcde
== 7)
4812 notethat ("dregs_lo = EXPADJ (dregs_hi , dregs_lo)");
4813 OUTS (outf
, dregs_lo (dst0
));
4814 OUTS (outf
, "=EXPADJ (");
4815 OUTS (outf
, dregs_hi (src1
));
4817 OUTS (outf
, dregs_lo (src0
));
4821 else if (sop
== 0 && sopcde
== 8)
4823 notethat ("BITMUX (dregs , dregs , A0) (ASR)");
4824 OUTS (outf
, "BITMUX (");
4825 OUTS (outf
, dregs (src0
));
4827 OUTS (outf
, dregs (src1
));
4828 OUTS (outf
, ",A0 )(ASR)");
4831 else if (sop
== 1 && sopcde
== 8)
4833 notethat ("BITMUX (dregs , dregs , A0) (ASL)");
4834 OUTS (outf
, "BITMUX (");
4835 OUTS (outf
, dregs (src0
));
4837 OUTS (outf
, dregs (src1
));
4838 OUTS (outf
, ",A0 )(ASL)");
4841 else if (sop
== 0 && sopcde
== 9)
4843 notethat ("dregs_lo = VIT_MAX (dregs) (ASL)");
4844 OUTS (outf
, dregs_lo (dst0
));
4845 OUTS (outf
, "=VIT_MAX (");
4846 OUTS (outf
, dregs (src1
));
4847 OUTS (outf
, ") (ASL)");
4850 else if (sop
== 1 && sopcde
== 9)
4852 notethat ("dregs_lo = VIT_MAX (dregs) (ASR)");
4853 OUTS (outf
, dregs_lo (dst0
));
4854 OUTS (outf
, "=VIT_MAX (");
4855 OUTS (outf
, dregs (src1
));
4856 OUTS (outf
, ") (ASR)");
4859 else if (sop
== 2 && sopcde
== 9)
4861 notethat ("dregs = VIT_MAX ( dregs , dregs ) (ASL)");
4862 OUTS (outf
, dregs (dst0
));
4863 OUTS (outf
, "=VIT_MAX(");
4864 OUTS (outf
, dregs (src1
));
4866 OUTS (outf
, dregs (src0
));
4867 OUTS (outf
, ")(ASL)");
4870 else if (sop
== 3 && sopcde
== 9)
4872 notethat ("dregs = VIT_MAX ( dregs , dregs ) (ASR)");
4873 OUTS (outf
, dregs (dst0
));
4874 OUTS (outf
, "=VIT_MAX(");
4875 OUTS (outf
, dregs (src1
));
4877 OUTS (outf
, dregs (src0
));
4878 OUTS (outf
, ")(ASR)");
4881 else if (sop
== 0 && sopcde
== 10)
4883 notethat ("dregs = EXTRACT ( dregs , dregs_lo ) (Z)");
4884 OUTS (outf
, dregs (dst0
));
4885 OUTS (outf
, "=EXTRACT(");
4886 OUTS (outf
, dregs (src1
));
4888 OUTS (outf
, dregs_lo (src0
));
4889 OUTS (outf
, ") (Z)");
4892 else if (sop
== 1 && sopcde
== 10)
4894 notethat ("dregs = EXTRACT ( dregs , dregs_lo ) (X)");
4895 OUTS (outf
, dregs (dst0
));
4896 OUTS (outf
, "=EXTRACT(");
4897 OUTS (outf
, dregs (src1
));
4899 OUTS (outf
, dregs_lo (src0
));
4900 OUTS (outf
, ")(X)");
4903 else if (sop
== 2 && sopcde
== 10)
4905 notethat ("dregs = DEPOSIT ( dregs , dregs )");
4906 OUTS (outf
, dregs (dst0
));
4907 OUTS (outf
, "=DEPOSIT(");
4908 OUTS (outf
, dregs (src1
));
4910 OUTS (outf
, dregs (src0
));
4914 else if (sop
== 3 && sopcde
== 10)
4916 notethat ("dregs = DEPOSIT ( dregs , dregs ) (X)");
4917 OUTS (outf
, dregs (dst0
));
4918 OUTS (outf
, "=DEPOSIT(");
4919 OUTS (outf
, dregs (src1
));
4921 OUTS (outf
, dregs (src0
));
4922 OUTS (outf
, ")(X)");
4925 else if (sop
== 0 && sopcde
== 11)
4927 notethat ("dregs_lo = CC = BXORSHIFT ( A0 , dregs )");
4928 OUTS (outf
, dregs_lo (dst0
));
4929 OUTS (outf
, "=CC=BXORSHIFT(A0,");
4930 OUTS (outf
, dregs (src0
));
4934 else if (sop
== 1 && sopcde
== 11)
4936 notethat ("dregs_lo = CC = BXOR (A0 , dregs)");
4937 OUTS (outf
, dregs_lo (dst0
));
4938 OUTS (outf
, "=CC=BXOR(A0,");
4939 OUTS (outf
, dregs (src0
));
4943 else if (sop
== 0 && sopcde
== 12)
4945 notethat ("A0 = BXORSHIFT ( A0 , A1 , CC )");
4946 OUTS (outf
, "A0=BXORSHIFT(A0,A1 ,CC)");
4949 else if (sop
== 1 && sopcde
== 12)
4951 notethat ("dregs_lo = CC = BXOR (A0 , A1 , CC)");
4952 OUTS (outf
, dregs_lo (dst0
));
4953 OUTS (outf
, "=CC=BXOR( A0,A1 ,CC )");
4956 else if (sop
== 0 && sopcde
== 13)
4958 notethat ("dregs = ALIGN8 ( dregs , dregs )");
4959 OUTS (outf
, dregs (dst0
));
4960 OUTS (outf
, "=ALIGN8(");
4961 OUTS (outf
, dregs (src1
));
4963 OUTS (outf
, dregs (src0
));
4967 else if (sop
== 1 && sopcde
== 13)
4969 notethat ("dregs = ALIGN16 ( dregs , dregs )");
4970 OUTS (outf
, dregs (dst0
));
4971 OUTS (outf
, "=ALIGN16(");
4972 OUTS (outf
, dregs (src1
));
4974 OUTS (outf
, dregs (src0
));
4978 else if (sop
== 2 && sopcde
== 13)
4980 notethat ("dregs = ALIGN24 ( dregs , dregs )");
4981 OUTS (outf
, dregs (dst0
));
4982 OUTS (outf
, "=ALIGN24(");
4983 OUTS (outf
, dregs (src1
));
4985 OUTS (outf
, dregs (src0
));
4990 goto illegal_instruction
;
4991 illegal_instruction
:
4996 decode_dsp32shiftimm_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
4999 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
5000 | 1 | 1 | 0 | 0 |.M.| 1 | 1 | 0 | 1 | - | - |.sopcde............|
5001 |.sop...|.HLs...|.dst0......|.immag.................|.src1......|
5002 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
5004 int src1
= ((iw1
>> DSP32ShiftImm_src1_bits
) & DSP32ShiftImm_src1_mask
);
5005 int sop
= ((iw1
>> DSP32ShiftImm_sop_bits
) & DSP32ShiftImm_sop_mask
);
5006 int bit8
= ((iw1
>> 8) & 0x1);
5007 int immag
= ((iw1
>> DSP32ShiftImm_immag_bits
) & DSP32ShiftImm_immag_mask
);
5008 int newimmag
= (-(iw1
>> DSP32ShiftImm_immag_bits
) & DSP32ShiftImm_immag_mask
);
5009 int dst0
= ((iw1
>> DSP32ShiftImm_dst0_bits
) & DSP32ShiftImm_dst0_mask
);
5010 int sopcde
= ((iw0
>> (DSP32ShiftImm_sopcde_bits
- 16)) & DSP32ShiftImm_sopcde_mask
);
5011 int HLs
= ((iw1
>> DSP32ShiftImm_HLs_bits
) & DSP32ShiftImm_HLs_mask
);
5014 if (HLs
== 0 && sop
== 0 && sopcde
== 0)
5016 notethat ("dregs_lo = dregs_lo >>> uimm4");
5017 OUTS (outf
, dregs_lo (dst0
));
5019 OUTS (outf
, dregs_lo (src1
));
5021 OUTS (outf
, uimm4 (newimmag
));
5024 else if (HLs
== 1 && sop
== 0 && sopcde
== 0)
5026 notethat ("dregs_lo = dregs_hi >>> uimm4");
5027 OUTS (outf
, dregs_lo (dst0
));
5029 OUTS (outf
, dregs_hi (src1
));
5031 OUTS (outf
, uimm4 (newimmag
));
5034 else if (HLs
== 2 && sop
== 0 && sopcde
== 0)
5036 notethat ("dregs_hi = dregs_lo >>> uimm4");
5037 OUTS (outf
, dregs_hi (dst0
));
5039 OUTS (outf
, dregs_lo (src1
));
5041 OUTS (outf
, uimm4 (newimmag
));
5044 else if (HLs
== 3 && sop
== 0 && sopcde
== 0)
5046 notethat ("dregs_hi = dregs_hi >>> uimm4");
5047 OUTS (outf
, dregs_hi (dst0
));
5049 OUTS (outf
, dregs_hi (src1
));
5051 OUTS (outf
, uimm4 (newimmag
));
5054 else if (HLs
== 0 && sop
== 1 && sopcde
== 0)
5056 notethat ("dregs_lo = dregs_lo << uimm4 (S)");
5057 OUTS (outf
, dregs_lo (dst0
));
5059 OUTS (outf
, dregs_lo (src1
));
5061 OUTS (outf
, uimm4 (immag
));
5065 else if (HLs
== 1 && sop
== 1 && sopcde
== 0)
5067 notethat ("dregs_lo = dregs_hi << uimm4 (S)");
5068 OUTS (outf
, dregs_lo (dst0
));
5070 OUTS (outf
, dregs_hi (src1
));
5072 OUTS (outf
, uimm4 (immag
));
5076 else if (HLs
== 2 && sop
== 1 && sopcde
== 0)
5078 notethat ("dregs_hi = dregs_lo << uimm4 (S)");
5079 OUTS (outf
, dregs_hi (dst0
));
5081 OUTS (outf
, dregs_lo (src1
));
5083 OUTS (outf
, uimm4 (immag
));
5087 else if (HLs
== 3 && sop
== 1 && sopcde
== 0)
5089 notethat ("dregs_hi = dregs_hi << uimm4 (S)");
5090 OUTS (outf
, dregs_hi (dst0
));
5092 OUTS (outf
, dregs_hi (src1
));
5094 OUTS (outf
, uimm4 (immag
));
5098 else if (HLs
== 0 && sop
== 2 && sopcde
== 0 && bit8
== 0)
5100 notethat ("dregs_lo = dregs_lo << uimm4");
5101 OUTS (outf
, dregs_lo (dst0
));
5103 OUTS (outf
, dregs_lo (src1
));
5105 OUTS (outf
, uimm4 (immag
));
5108 else if (HLs
== 0 && sop
== 2 && sopcde
== 0 && bit8
== 1)
5110 notethat ("dregs_lo = dregs_lo >> uimm4");
5111 OUTS (outf
, dregs_lo (dst0
));
5113 OUTS (outf
, dregs_lo (src1
));
5115 OUTS (outf
, uimm4 (newimmag
));
5118 else if (HLs
== 1 && sop
== 2 && sopcde
== 0)
5120 notethat ("dregs_lo = dregs_hi >> uimm4");
5121 OUTS (outf
, dregs_lo (dst0
));
5123 OUTS (outf
, dregs_hi (src1
));
5125 OUTS (outf
, uimm4 (newimmag
));
5128 else if (HLs
== 2 && sop
== 2 && sopcde
== 0 && bit8
== 1)
5130 notethat ("dregs_hi = dregs_lo >> uimm4");
5131 OUTS (outf
, dregs_hi (dst0
));
5133 OUTS (outf
, dregs_lo (src1
));
5135 OUTS (outf
, uimm4 (newimmag
));
5138 else if (HLs
== 2 && sop
== 2 && sopcde
== 0 && bit8
== 0)
5140 notethat ("dregs_hi = dregs_lo << uimm4");
5141 OUTS (outf
, dregs_hi (dst0
));
5143 OUTS (outf
, dregs_lo (src1
));
5145 OUTS (outf
, uimm4 (immag
));
5148 else if (HLs
== 3 && sop
== 2 && sopcde
== 0 && bit8
== 1)
5150 notethat ("dregs_hi = dregs_hi >> uimm4");
5151 OUTS (outf
, dregs_hi (dst0
));
5153 OUTS (outf
, dregs_hi (src1
));
5155 OUTS (outf
, uimm4 (newimmag
));
5158 else if (HLs
== 3 && sop
== 2 && sopcde
== 0 && bit8
== 0)
5160 notethat ("dregs_hi = dregs_hi << uimm4");
5161 OUTS (outf
, dregs_hi (dst0
));
5163 OUTS (outf
, dregs_hi (src1
));
5165 OUTS (outf
, uimm4 (immag
));
5168 else if (sop
== 2 && sopcde
== 3 && HLs
== 1)
5170 notethat ("A1 = ROT A1 BY imm6");
5171 OUTS (outf
, "A1= ROT A1 BY ");
5172 OUTS (outf
, imm6 (immag
));
5175 else if (sop
== 0 && sopcde
== 3 && HLs
== 0 && bit8
== 0)
5177 notethat ("A0 = A0 << uimm5");
5178 OUTS (outf
, "A0=A0<<");
5179 OUTS (outf
, uimm5 (immag
));
5182 else if (sop
== 0 && sopcde
== 3 && HLs
== 0 && bit8
== 1)
5184 notethat ("A0 = A0 >>> uimm5");
5185 OUTS (outf
, "A0=A0>>>");
5186 OUTS (outf
, uimm5 (newimmag
));
5189 else if (sop
== 0 && sopcde
== 3 && HLs
== 1 && bit8
== 0)
5191 notethat ("A1 = A1 << uimm5");
5192 OUTS (outf
, "A1=A1<<");
5193 OUTS (outf
, uimm5 (immag
));
5196 else if (sop
== 0 && sopcde
== 3 && HLs
== 1 && bit8
== 1)
5198 notethat ("A1 = A1 >>> uimm5");
5199 OUTS (outf
, "A1=A1>>>");
5200 OUTS (outf
, uimm5 (newimmag
));
5203 else if (sop
== 1 && sopcde
== 3 && HLs
== 0)
5205 notethat ("A0 = A0 >> uimm5");
5206 OUTS (outf
, "A0=A0>>");
5207 OUTS (outf
, uimm5 (newimmag
));
5210 else if (sop
== 1 && sopcde
== 3 && HLs
== 1)
5212 notethat ("A1 = A1 >> uimm5");
5213 OUTS (outf
, "A1=A1>>");
5214 OUTS (outf
, uimm5 (newimmag
));
5217 else if (sop
== 2 && sopcde
== 3 && HLs
== 0)
5219 notethat ("A0 = ROT A0 BY imm6");
5220 OUTS (outf
, "A0= ROT A0 BY ");
5221 OUTS (outf
, imm6 (immag
));
5224 else if (sop
== 1 && sopcde
== 1 && bit8
== 0)
5226 notethat ("dregs = dregs << uimm5 (V, S)");
5227 OUTS (outf
, dregs (dst0
));
5229 OUTS (outf
, dregs (src1
));
5231 OUTS (outf
, uimm5 (immag
));
5232 OUTS (outf
, " (V, S)");
5235 else if (sop
== 1 && sopcde
== 1 && bit8
== 1)
5237 notethat ("dregs = dregs >>> uimm5 (V)");
5238 OUTS (outf
, dregs (dst0
));
5240 OUTS (outf
, dregs (src1
));
5242 OUTS (outf
, imm5 (-immag
));
5243 OUTS (outf
, " (V)");
5246 else if (sop
== 2 && sopcde
== 1 && bit8
== 1)
5248 notethat ("dregs = dregs >> uimm5 (V)");
5249 OUTS (outf
, dregs (dst0
));
5251 OUTS (outf
, dregs (src1
));
5252 OUTS (outf
, " >> ");
5253 OUTS (outf
, uimm5 (newimmag
));
5254 OUTS (outf
, " (V)");
5257 else if (sop
== 2 && sopcde
== 1 && bit8
== 0)
5259 notethat ("dregs = dregs << imm5 (V)");
5260 OUTS (outf
, dregs (dst0
));
5262 OUTS (outf
, dregs (src1
));
5264 OUTS (outf
, imm5 (immag
));
5265 OUTS (outf
, " (V)");
5268 else if (sop
== 0 && sopcde
== 1)
5270 notethat ("dregs = dregs >>> uimm5 (V)");
5271 OUTS (outf
, dregs (dst0
));
5273 OUTS (outf
, dregs (src1
));
5275 OUTS (outf
, uimm5 (newimmag
));
5276 OUTS (outf
, " (V)");
5279 else if (sop
== 1 && sopcde
== 2)
5281 notethat ("dregs = dregs << uimm5 (S)");
5282 OUTS (outf
, dregs (dst0
));
5284 OUTS (outf
, dregs (src1
));
5286 OUTS (outf
, uimm5 (immag
));
5290 else if (sop
== 2 && sopcde
== 2 && bit8
== 1)
5292 notethat ("dregs = dregs >> uimm5");
5293 OUTS (outf
, dregs (dst0
));
5295 OUTS (outf
, dregs (src1
));
5297 OUTS (outf
, uimm5 (newimmag
));
5300 else if (sop
== 2 && sopcde
== 2 && bit8
== 0)
5302 notethat ("dregs = dregs << uimm5");
5303 OUTS (outf
, dregs (dst0
));
5305 OUTS (outf
, dregs (src1
));
5307 OUTS (outf
, uimm5 (immag
));
5310 else if (sop
== 3 && sopcde
== 2)
5312 notethat ("dregs = ROT dregs BY imm6");
5313 OUTS (outf
, dregs (dst0
));
5314 OUTS (outf
, "= ROT ");
5315 OUTS (outf
, dregs (src1
));
5316 OUTS (outf
, " BY ");
5317 OUTS (outf
, imm6 (immag
));
5320 else if (sop
== 0 && sopcde
== 2)
5322 notethat ("dregs = dregs >>> uimm5");
5323 OUTS (outf
, dregs (dst0
));
5325 OUTS (outf
, dregs (src1
));
5327 OUTS (outf
, uimm5 (newimmag
));
5331 goto illegal_instruction
;
5332 illegal_instruction
:
5337 decode_pseudoDEBUG_0 (TIword iw0
, disassemble_info
*outf
)
5340 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
5341 | 1 | 1 | 1 | 1 | 1 | 0 | 0 | 0 |.fn....|.grp.......|.reg.......|
5342 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
5344 int fn
= ((iw0
>> PseudoDbg_fn_bits
) & PseudoDbg_fn_mask
);
5345 int grp
= ((iw0
>> PseudoDbg_grp_bits
) & PseudoDbg_grp_mask
);
5346 int reg
= ((iw0
>> PseudoDbg_reg_bits
) & PseudoDbg_reg_mask
);
5348 if (reg
== 0 && fn
== 3)
5350 notethat ("DBG A0");
5351 OUTS (outf
, "DBG A0");
5354 else if (reg
== 1 && fn
== 3)
5356 notethat ("DBG A1");
5357 OUTS (outf
, "DBG A1");
5360 else if (reg
== 3 && fn
== 3)
5363 OUTS (outf
, "ABORT");
5366 else if (reg
== 4 && fn
== 3)
5372 else if (reg
== 5 && fn
== 3)
5374 notethat ("DBGHALT");
5375 OUTS (outf
, "DBGHALT");
5378 else if (reg
== 6 && fn
== 3)
5380 notethat ("DBGCMPLX ( dregs )");
5381 OUTS (outf
, "DBGCMPLX(");
5382 OUTS (outf
, dregs (grp
));
5386 else if (reg
== 7 && fn
== 3)
5392 else if (grp
== 0 && fn
== 2)
5394 notethat ("OUTC dregs");
5395 OUTS (outf
, "OUTC");
5396 OUTS (outf
, dregs (reg
));
5401 notethat ("DBG allregs");
5403 OUTS (outf
, allregs (reg
, grp
));
5408 notethat ("PRNT allregs");
5409 OUTS (outf
, "PRNT");
5410 OUTS (outf
, allregs (reg
, grp
));
5414 goto illegal_instruction
;
5415 illegal_instruction
:
5420 decode_pseudodbg_assert_0 (TIword iw0
, TIword iw1
, disassemble_info
*outf
)
5423 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
5424 | 1 | 1 | 1 | 1 | 0 | - | - | - | - | - |.dbgop.....|.regtest...|
5425 |.expected......................................................|
5426 +---+---+---+---|---+---+---+---|---+---+---+---|---+---+---+---+
5428 int expected
= ((iw1
>> PseudoDbg_Assert_expected_bits
) & PseudoDbg_Assert_expected_mask
);
5429 int dbgop
= ((iw0
>> (PseudoDbg_Assert_dbgop_bits
- 16)) & PseudoDbg_Assert_dbgop_mask
);
5430 int regtest
= ((iw0
>> (PseudoDbg_Assert_regtest_bits
- 16)) & PseudoDbg_Assert_regtest_mask
);
5434 notethat ("DBGA ( dregs_lo , uimm16 )");
5435 OUTS (outf
, "DBGA(");
5436 OUTS (outf
, dregs_lo (regtest
));
5438 OUTS (outf
, uimm16 (expected
));
5442 else if (dbgop
== 1)
5444 notethat ("DBGA ( dregs_hi , uimm16 )");
5445 OUTS (outf
, "DBGA(");
5446 OUTS (outf
, dregs_hi (regtest
));
5448 OUTS (outf
, uimm16 (expected
));
5452 else if (dbgop
== 2)
5454 notethat ("DBGAL ( dregs , uimm16 )");
5455 OUTS (outf
, "DBGAL(");
5456 OUTS (outf
, dregs (regtest
));
5458 OUTS (outf
, uimm16 (expected
));
5462 else if (dbgop
== 3)
5464 notethat ("DBGAH ( dregs , uimm16 )");
5465 OUTS (outf
, "DBGAH(");
5466 OUTS (outf
, dregs (regtest
));
5468 OUTS (outf
, uimm16 (expected
));
5473 goto illegal_instruction
;
5474 illegal_instruction
:
5479 _print_insn_bfin (bfd_vma pc
, disassemble_info
*outf
)
5486 status
= (*outf
->read_memory_func
) (pc
& ~0x1, buf
, 2, outf
);
5487 status
= (*outf
->read_memory_func
) ((pc
+ 2) & ~0x1, buf
+ 2, 2, outf
);
5489 iw0
= bfd_getl16 (buf
);
5490 iw1
= bfd_getl16 (buf
+ 2);
5492 if ((iw0
& 0xf7ff) == 0xc003 && iw1
== 0x1800)
5494 OUTS (outf
, "mnop");
5497 else if ((iw0
& 0xff00) == 0x0000)
5499 int rv
= decode_ProgCtrl_0 (iw0
, outf
);
5502 goto illegal_instruction
;
5504 else if ((iw0
& 0xffc0) == 0x0240)
5506 int rv
= decode_CaCTRL_0 (iw0
, outf
);
5509 goto illegal_instruction
;
5511 else if ((iw0
& 0xff80) == 0x0100)
5513 int rv
= decode_PushPopReg_0 (iw0
, outf
);
5516 goto illegal_instruction
;
5518 else if ((iw0
& 0xfe00) == 0x0400)
5520 int rv
= decode_PushPopMultiple_0 (iw0
, outf
);
5523 goto illegal_instruction
;
5525 else if ((iw0
& 0xfe00) == 0x0600)
5527 int rv
= decode_ccMV_0 (iw0
, outf
);
5530 goto illegal_instruction
;
5532 else if ((iw0
& 0xf800) == 0x0800)
5534 int rv
= decode_CCflag_0 (iw0
, outf
);
5537 goto illegal_instruction
;
5539 else if ((iw0
& 0xffe0) == 0x0200)
5541 int rv
= decode_CC2dreg_0 (iw0
, outf
);
5544 goto illegal_instruction
;
5546 else if ((iw0
& 0xff00) == 0x0300)
5548 int rv
= decode_CC2stat_0 (iw0
, outf
);
5551 goto illegal_instruction
;
5553 else if ((iw0
& 0xf000) == 0x1000)
5555 int rv
= decode_BRCC_0 (iw0
, pc
, outf
);
5558 goto illegal_instruction
;
5560 else if ((iw0
& 0xf000) == 0x2000)
5562 int rv
= decode_UJUMP_0 (iw0
, pc
, outf
);
5565 goto illegal_instruction
;
5567 else if ((iw0
& 0xf000) == 0x3000)
5569 int rv
= decode_REGMV_0 (iw0
, outf
);
5572 goto illegal_instruction
;
5574 else if ((iw0
& 0xfc00) == 0x4000)
5576 int rv
= decode_ALU2op_0 (iw0
, outf
);
5579 goto illegal_instruction
;
5581 else if ((iw0
& 0xfe00) == 0x4400)
5583 int rv
= decode_PTR2op_0 (iw0
, outf
);
5586 goto illegal_instruction
;
5588 else if ((iw0
& 0xf800) == 0x4800)
5590 int rv
= decode_LOGI2op_0 (iw0
, outf
);
5593 goto illegal_instruction
;
5595 else if ((iw0
& 0xf000) == 0x5000)
5597 int rv
= decode_COMP3op_0 (iw0
, outf
);
5600 goto illegal_instruction
;
5602 else if ((iw0
& 0xf800) == 0x6000)
5604 int rv
= decode_COMPI2opD_0 (iw0
, outf
);
5607 goto illegal_instruction
;
5609 else if ((iw0
& 0xf800) == 0x6800)
5611 int rv
= decode_COMPI2opP_0 (iw0
, outf
);
5614 goto illegal_instruction
;
5616 else if ((iw0
& 0xf000) == 0x8000)
5618 int rv
= decode_LDSTpmod_0 (iw0
, outf
);
5621 goto illegal_instruction
;
5623 else if ((iw0
& 0xff60) == 0x9e60)
5625 int rv
= decode_dagMODim_0 (iw0
, outf
);
5628 goto illegal_instruction
;
5630 else if ((iw0
& 0xfff0) == 0x9f60)
5632 int rv
= decode_dagMODik_0 (iw0
, outf
);
5635 goto illegal_instruction
;
5637 else if ((iw0
& 0xfc00) == 0x9c00)
5639 int rv
= decode_dspLDST_0 (iw0
, outf
);
5642 goto illegal_instruction
;
5644 else if ((iw0
& 0xf000) == 0x9000)
5646 int rv
= decode_LDST_0 (iw0
, outf
);
5649 goto illegal_instruction
;
5651 else if ((iw0
& 0xfc00) == 0xb800)
5653 int rv
= decode_LDSTiiFP_0 (iw0
, outf
);
5656 goto illegal_instruction
;
5658 else if ((iw0
& 0xe000) == 0xA000)
5660 int rv
= decode_LDSTii_0 (iw0
, outf
);
5663 goto illegal_instruction
;
5665 else if ((iw0
& 0xff80) == 0xe080 && (iw1
& 0x0C00) == 0x0000)
5667 int rv
= decode_LoopSetup_0 (iw0
, iw1
, pc
, outf
);
5670 goto illegal_instruction
;
5672 else if ((iw0
& 0xff00) == 0xe100 && (iw1
& 0x0000) == 0x0000)
5674 int rv
= decode_LDIMMhalf_0 (iw0
, iw1
, outf
);
5677 goto illegal_instruction
;
5679 else if ((iw0
& 0xfe00) == 0xe200 && (iw1
& 0x0000) == 0x0000)
5681 int rv
= decode_CALLa_0 (iw0
, iw1
, pc
, outf
);
5684 goto illegal_instruction
;
5686 else if ((iw0
& 0xfc00) == 0xe400 && (iw1
& 0x0000) == 0x0000)
5688 int rv
= decode_LDSTidxI_0 (iw0
, iw1
, outf
);
5691 goto illegal_instruction
;
5693 else if ((iw0
& 0xfffe) == 0xe800 && (iw1
& 0x0000) == 0x0000)
5695 int rv
= decode_linkage_0 (iw0
, iw1
, outf
);
5698 goto illegal_instruction
;
5700 else if ((iw0
& 0xf600) == 0xc000 && (iw1
& 0x0000) == 0x0000)
5702 int rv
= decode_dsp32mac_0 (iw0
, iw1
, outf
);
5705 goto illegal_instruction
;
5707 else if ((iw0
& 0xf600) == 0xc200 && (iw1
& 0x0000) == 0x0000)
5709 int rv
= decode_dsp32mult_0 (iw0
, iw1
, outf
);
5712 goto illegal_instruction
;
5714 else if ((iw0
& 0xf7c0) == 0xc400 && (iw1
& 0x0000) == 0x0000)
5716 int rv
= decode_dsp32alu_0 (iw0
, iw1
, outf
);
5719 goto illegal_instruction
;
5721 else if ((iw0
& 0xf780) == 0xc600 && (iw1
& 0x01c0) == 0x0000)
5723 int rv
= decode_dsp32shift_0 (iw0
, iw1
, outf
);
5726 goto illegal_instruction
;
5728 else if ((iw0
& 0xf780) == 0xc680 && (iw1
& 0x0000) == 0x0000)
5730 int rv
= decode_dsp32shiftimm_0 (iw0
, iw1
, outf
);
5733 goto illegal_instruction
;
5735 else if ((iw0
& 0xff00) == 0xf800)
5737 int rv
= decode_pseudoDEBUG_0 (iw0
, outf
);
5740 goto illegal_instruction
;
5743 else if ((iw0
& 0xFF00) == 0xF900)
5746 int rv
= decode_pseudoOChar_0 (iw0
, iw1
, pc
, outf
);
5749 goto illegal_instruction
;
5752 else if ((iw0
& 0xFFC0) == 0xf000 && (iw1
& 0x0000) == 0x0000)
5754 int rv
= decode_pseudodbg_assert_0 (iw0
, iw1
, outf
);
5757 goto illegal_instruction
;
5760 illegal_instruction
:
5766 print_insn_bfin (bfd_vma pc
, disassemble_info
*outf
)
5771 status
= (*outf
->read_memory_func
) (pc
& ~0x01, (bfd_byte
*) & iw0
, 2, outf
);
5773 count
+= _print_insn_bfin (pc
, outf
);
5774 /* Proper display of multiple issue instructions. */
5775 if ((iw0
& 0xc000) == 0xc000 && (iw0
& BIT_MULTI_INS
)
5776 && ((iw0
& 0xe800) != 0xe800 /* not Linkage */ ))
5778 outf
->fprintf_func (outf
->stream
, " || ");
5779 count
+= _print_insn_bfin (pc
+ 4, outf
);
5780 outf
->fprintf_func (outf
->stream
, " || ");
5781 count
+= _print_insn_bfin (pc
+ 6, outf
);
5785 outf
->fprintf_func (outf
->stream
, "ILLEGAL");
5788 outf
->fprintf_func (outf
->stream
, ";");