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