]> Git Repo - qemu.git/blame - disas/mips.c
target-mips: add compact and CP1 branches
[qemu.git] / disas / mips.c
CommitLineData
6643d27e
FB
1/* Print mips instructions for GDB, the GNU debugger, or for objdump.
2 Copyright 1989, 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
3 2000, 2001, 2002, 2003
4 Free Software Foundation, Inc.
5 Contributed by Nobuyuki Hikichi([email protected]).
6
7This file is part of GDB, GAS, and the GNU binutils.
8
9This program is free software; you can redistribute it and/or modify
10it under the terms of the GNU General Public License as published by
11the Free Software Foundation; either version 2 of the License, or
12(at your option) any later version.
13
14This program is distributed in the hope that it will be useful,
15but WITHOUT ANY WARRANTY; without even the implied warranty of
16MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17GNU General Public License for more details.
18
19You should have received a copy of the GNU General Public License
8167ee88 20along with this program; if not, see <http://www.gnu.org/licenses/>. */
6643d27e 21
76cad711 22#include "disas/bfd.h"
6643d27e
FB
23
24/* mips.h. Mips opcode list for GDB, the GNU debugger.
25 Copyright 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2002, 2003
26 Free Software Foundation, Inc.
27 Contributed by Ralph Campbell and OSF
28 Commented and modified by Ian Lance Taylor, Cygnus Support
29
30This file is part of GDB, GAS, and the GNU binutils.
31
32GDB, GAS, and the GNU binutils are free software; you can redistribute
33them and/or modify them under the terms of the GNU General Public
34License as published by the Free Software Foundation; either version
351, or (at your option) any later version.
36
37GDB, GAS, and the GNU binutils are distributed in the hope that they
38will be useful, but WITHOUT ANY WARRANTY; without even the implied
39warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
40the GNU General Public License for more details.
41
42You should have received a copy of the GNU General Public License
8167ee88
BS
43along with this file; see the file COPYING. If not,
44see <http://www.gnu.org/licenses/>. */
6643d27e
FB
45
46/* These are bit masks and shift counts to use to access the various
47 fields of an instruction. To retrieve the X field of an
48 instruction, use the expression
49 (i >> OP_SH_X) & OP_MASK_X
50 To set the same field (to j), use
51 i = (i &~ (OP_MASK_X << OP_SH_X)) | (j << OP_SH_X)
52
53 Make sure you use fields that are appropriate for the instruction,
54 of course.
55
56 The 'i' format uses OP, RS, RT and IMMEDIATE.
57
58 The 'j' format uses OP and TARGET.
59
60 The 'r' format uses OP, RS, RT, RD, SHAMT and FUNCT.
61
62 The 'b' format uses OP, RS, RT and DELTA.
63
64 The floating point 'i' format uses OP, RS, RT and IMMEDIATE.
65
66 The floating point 'r' format uses OP, FMT, FT, FS, FD and FUNCT.
67
68 A breakpoint instruction uses OP, CODE and SPEC (10 bits of the
69 breakpoint instruction are not defined; Kane says the breakpoint
70 code field in BREAK is 20 bits; yet MIPS assemblers and debuggers
71 only use ten bits). An optional two-operand form of break/sdbbp
72 allows the lower ten bits to be set too, and MIPS32 and later
73 architectures allow 20 bits to be set with a signal operand
74 (using CODE20).
75
76 The syscall instruction uses CODE20.
77
78 The general coprocessor instructions use COPZ. */
79
80#define OP_MASK_OP 0x3f
81#define OP_SH_OP 26
82#define OP_MASK_RS 0x1f
83#define OP_SH_RS 21
84#define OP_MASK_FR 0x1f
85#define OP_SH_FR 21
86#define OP_MASK_FMT 0x1f
87#define OP_SH_FMT 21
88#define OP_MASK_BCC 0x7
89#define OP_SH_BCC 18
90#define OP_MASK_CODE 0x3ff
91#define OP_SH_CODE 16
92#define OP_MASK_CODE2 0x3ff
93#define OP_SH_CODE2 6
94#define OP_MASK_RT 0x1f
95#define OP_SH_RT 16
96#define OP_MASK_FT 0x1f
97#define OP_SH_FT 16
98#define OP_MASK_CACHE 0x1f
99#define OP_SH_CACHE 16
100#define OP_MASK_RD 0x1f
101#define OP_SH_RD 11
102#define OP_MASK_FS 0x1f
103#define OP_SH_FS 11
104#define OP_MASK_PREFX 0x1f
105#define OP_SH_PREFX 11
106#define OP_MASK_CCC 0x7
107#define OP_SH_CCC 8
108#define OP_MASK_CODE20 0xfffff /* 20 bit syscall/breakpoint code. */
109#define OP_SH_CODE20 6
110#define OP_MASK_SHAMT 0x1f
111#define OP_SH_SHAMT 6
112#define OP_MASK_FD 0x1f
113#define OP_SH_FD 6
114#define OP_MASK_TARGET 0x3ffffff
115#define OP_SH_TARGET 0
116#define OP_MASK_COPZ 0x1ffffff
117#define OP_SH_COPZ 0
118#define OP_MASK_IMMEDIATE 0xffff
119#define OP_SH_IMMEDIATE 0
120#define OP_MASK_DELTA 0xffff
121#define OP_SH_DELTA 0
4368b29a
LA
122#define OP_MASK_DELTA_R6 0x1ff
123#define OP_SH_DELTA_R6 7
6643d27e
FB
124#define OP_MASK_FUNCT 0x3f
125#define OP_SH_FUNCT 0
126#define OP_MASK_SPEC 0x3f
127#define OP_SH_SPEC 0
128#define OP_SH_LOCC 8 /* FP condition code. */
129#define OP_SH_HICC 18 /* FP condition code. */
130#define OP_MASK_CC 0x7
131#define OP_SH_COP1NORM 25 /* Normal COP1 encoding. */
132#define OP_MASK_COP1NORM 0x1 /* a single bit. */
133#define OP_SH_COP1SPEC 21 /* COP1 encodings. */
134#define OP_MASK_COP1SPEC 0xf
135#define OP_MASK_COP1SCLR 0x4
136#define OP_MASK_COP1CMP 0x3
137#define OP_SH_COP1CMP 4
138#define OP_SH_FORMAT 21 /* FP short format field. */
139#define OP_MASK_FORMAT 0x7
140#define OP_SH_TRUE 16
141#define OP_MASK_TRUE 0x1
142#define OP_SH_GE 17
143#define OP_MASK_GE 0x01
144#define OP_SH_UNSIGNED 16
145#define OP_MASK_UNSIGNED 0x1
146#define OP_SH_HINT 16
147#define OP_MASK_HINT 0x1f
148#define OP_SH_MMI 0 /* Multimedia (parallel) op. */
149#define OP_MASK_MMI 0x3f
150#define OP_SH_MMISUB 6
151#define OP_MASK_MMISUB 0x1f
152#define OP_MASK_PERFREG 0x1f /* Performance monitoring. */
153#define OP_SH_PERFREG 1
154#define OP_SH_SEL 0 /* Coprocessor select field. */
155#define OP_MASK_SEL 0x7 /* The sel field of mfcZ and mtcZ. */
156#define OP_SH_CODE19 6 /* 19 bit wait code. */
157#define OP_MASK_CODE19 0x7ffff
158#define OP_SH_ALN 21
159#define OP_MASK_ALN 0x7
160#define OP_SH_VSEL 21
161#define OP_MASK_VSEL 0x1f
162#define OP_MASK_VECBYTE 0x7 /* Selector field is really 4 bits,
163 but 0x8-0xf don't select bytes. */
164#define OP_SH_VECBYTE 22
165#define OP_MASK_VECALIGN 0x7 /* Vector byte-align (alni.ob) op. */
166#define OP_SH_VECALIGN 21
167#define OP_MASK_INSMSB 0x1f /* "ins" MSB. */
168#define OP_SH_INSMSB 11
169#define OP_MASK_EXTMSBD 0x1f /* "ext" MSBD. */
170#define OP_SH_EXTMSBD 11
171
172#define OP_OP_COP0 0x10
173#define OP_OP_COP1 0x11
174#define OP_OP_COP2 0x12
175#define OP_OP_COP3 0x13
176#define OP_OP_LWC1 0x31
177#define OP_OP_LWC2 0x32
178#define OP_OP_LWC3 0x33 /* a.k.a. pref */
179#define OP_OP_LDC1 0x35
180#define OP_OP_LDC2 0x36
181#define OP_OP_LDC3 0x37 /* a.k.a. ld */
182#define OP_OP_SWC1 0x39
183#define OP_OP_SWC2 0x3a
184#define OP_OP_SWC3 0x3b
185#define OP_OP_SDC1 0x3d
186#define OP_OP_SDC2 0x3e
187#define OP_OP_SDC3 0x3f /* a.k.a. sd */
188
29490584
TS
189/* MIPS DSP ASE */
190#define OP_SH_DSPACC 11
191#define OP_MASK_DSPACC 0x3
192#define OP_SH_DSPACC_S 21
193#define OP_MASK_DSPACC_S 0x3
194#define OP_SH_DSPSFT 20
195#define OP_MASK_DSPSFT 0x3f
196#define OP_SH_DSPSFT_7 19
197#define OP_MASK_DSPSFT_7 0x7f
198#define OP_SH_SA3 21
199#define OP_MASK_SA3 0x7
200#define OP_SH_SA4 21
201#define OP_MASK_SA4 0xf
202#define OP_SH_IMM8 16
203#define OP_MASK_IMM8 0xff
204#define OP_SH_IMM10 16
205#define OP_MASK_IMM10 0x3ff
206#define OP_SH_WRDSP 11
207#define OP_MASK_WRDSP 0x3f
208#define OP_SH_RDDSP 16
209#define OP_MASK_RDDSP 0x3f
210#define OP_SH_BP 11
211#define OP_MASK_BP 0x3
212
213/* MIPS MT ASE */
214#define OP_SH_MT_U 5
215#define OP_MASK_MT_U 0x1
216#define OP_SH_MT_H 4
217#define OP_MASK_MT_H 0x1
218#define OP_SH_MTACC_T 18
219#define OP_MASK_MTACC_T 0x3
220#define OP_SH_MTACC_D 13
221#define OP_MASK_MTACC_D 0x3
222
223#define OP_OP_COP0 0x10
224#define OP_OP_COP1 0x11
225#define OP_OP_COP2 0x12
226#define OP_OP_COP3 0x13
227#define OP_OP_LWC1 0x31
228#define OP_OP_LWC2 0x32
229#define OP_OP_LWC3 0x33 /* a.k.a. pref */
230#define OP_OP_LDC1 0x35
231#define OP_OP_LDC2 0x36
232#define OP_OP_LDC3 0x37 /* a.k.a. ld */
233#define OP_OP_SWC1 0x39
234#define OP_OP_SWC2 0x3a
235#define OP_OP_SWC3 0x3b
236#define OP_OP_SDC1 0x3d
237#define OP_OP_SDC2 0x3e
238#define OP_OP_SDC3 0x3f /* a.k.a. sd */
239
6643d27e
FB
240/* Values in the 'VSEL' field. */
241#define MDMX_FMTSEL_IMM_QH 0x1d
242#define MDMX_FMTSEL_IMM_OB 0x1e
243#define MDMX_FMTSEL_VEC_QH 0x15
244#define MDMX_FMTSEL_VEC_OB 0x16
245
29490584
TS
246/* UDI */
247#define OP_SH_UDI1 6
248#define OP_MASK_UDI1 0x1f
249#define OP_SH_UDI2 6
250#define OP_MASK_UDI2 0x3ff
251#define OP_SH_UDI3 6
252#define OP_MASK_UDI3 0x7fff
253#define OP_SH_UDI4 6
254#define OP_MASK_UDI4 0xfffff
6643d27e
FB
255/* This structure holds information for a particular instruction. */
256
257struct mips_opcode
258{
259 /* The name of the instruction. */
260 const char *name;
261 /* A string describing the arguments for this instruction. */
262 const char *args;
263 /* The basic opcode for the instruction. When assembling, this
264 opcode is modified by the arguments to produce the actual opcode
265 that is used. If pinfo is INSN_MACRO, then this is 0. */
266 unsigned long match;
267 /* If pinfo is not INSN_MACRO, then this is a bit mask for the
268 relevant portions of the opcode when disassembling. If the
269 actual opcode anded with the match field equals the opcode field,
270 then we have found the correct instruction. If pinfo is
271 INSN_MACRO, then this field is the macro identifier. */
272 unsigned long mask;
273 /* For a macro, this is INSN_MACRO. Otherwise, it is a collection
274 of bits describing the instruction, notably any relevant hazard
275 information. */
276 unsigned long pinfo;
29490584
TS
277 /* A collection of additional bits describing the instruction. */
278 unsigned long pinfo2;
6643d27e
FB
279 /* A collection of bits describing the instruction sets of which this
280 instruction or macro is a member. */
281 unsigned long membership;
282};
283
284/* These are the characters which may appear in the args field of an
285 instruction. They appear in the order in which the fields appear
286 when the instruction is used. Commas and parentheses in the args
287 string are ignored when assembling, and written into the output
288 when disassembling.
289
290 Each of these characters corresponds to a mask field defined above.
291
292 "<" 5 bit shift amount (OP_*_SHAMT)
293 ">" shift amount between 32 and 63, stored after subtracting 32 (OP_*_SHAMT)
294 "a" 26 bit target address (OP_*_TARGET)
295 "b" 5 bit base register (OP_*_RS)
296 "c" 10 bit breakpoint code (OP_*_CODE)
297 "d" 5 bit destination register specifier (OP_*_RD)
298 "h" 5 bit prefx hint (OP_*_PREFX)
299 "i" 16 bit unsigned immediate (OP_*_IMMEDIATE)
300 "j" 16 bit signed immediate (OP_*_DELTA)
301 "k" 5 bit cache opcode in target register position (OP_*_CACHE)
302 Also used for immediate operands in vr5400 vector insns.
303 "o" 16 bit signed offset (OP_*_DELTA)
304 "p" 16 bit PC relative branch target address (OP_*_DELTA)
305 "q" 10 bit extra breakpoint code (OP_*_CODE2)
306 "r" 5 bit same register used as both source and target (OP_*_RS)
307 "s" 5 bit source register specifier (OP_*_RS)
308 "t" 5 bit target register (OP_*_RT)
309 "u" 16 bit upper 16 bits of address (OP_*_IMMEDIATE)
310 "v" 5 bit same register used as both source and destination (OP_*_RS)
311 "w" 5 bit same register used as both target and destination (OP_*_RT)
312 "U" 5 bit same destination register in both OP_*_RD and OP_*_RT
313 (used by clo and clz)
314 "C" 25 bit coprocessor function code (OP_*_COPZ)
315 "B" 20 bit syscall/breakpoint function code (OP_*_CODE20)
316 "J" 19 bit wait function code (OP_*_CODE19)
317 "x" accept and ignore register name
318 "z" must be zero register
319 "K" 5 bit Hardware Register (rdhwr instruction) (OP_*_RD)
29490584
TS
320 "+A" 5 bit ins/ext/dins/dext/dinsm/dextm position, which becomes
321 LSB (OP_*_SHAMT).
6643d27e 322 Enforces: 0 <= pos < 32.
29490584 323 "+B" 5 bit ins/dins size, which becomes MSB (OP_*_INSMSB).
6643d27e
FB
324 Requires that "+A" or "+E" occur first to set position.
325 Enforces: 0 < (pos+size) <= 32.
29490584 326 "+C" 5 bit ext/dext size, which becomes MSBD (OP_*_EXTMSBD).
6643d27e
FB
327 Requires that "+A" or "+E" occur first to set position.
328 Enforces: 0 < (pos+size) <= 32.
329 (Also used by "dext" w/ different limits, but limits for
330 that are checked by the M_DEXT macro.)
29490584 331 "+E" 5 bit dinsu/dextu position, which becomes LSB-32 (OP_*_SHAMT).
6643d27e 332 Enforces: 32 <= pos < 64.
29490584 333 "+F" 5 bit "dinsm/dinsu" size, which becomes MSB-32 (OP_*_INSMSB).
6643d27e
FB
334 Requires that "+A" or "+E" occur first to set position.
335 Enforces: 32 < (pos+size) <= 64.
336 "+G" 5 bit "dextm" size, which becomes MSBD-32 (OP_*_EXTMSBD).
337 Requires that "+A" or "+E" occur first to set position.
338 Enforces: 32 < (pos+size) <= 64.
339 "+H" 5 bit "dextu" size, which becomes MSBD (OP_*_EXTMSBD).
340 Requires that "+A" or "+E" occur first to set position.
341 Enforces: 32 < (pos+size) <= 64.
342
343 Floating point instructions:
344 "D" 5 bit destination register (OP_*_FD)
345 "M" 3 bit compare condition code (OP_*_CCC) (only used for mips4 and up)
346 "N" 3 bit branch condition code (OP_*_BCC) (only used for mips4 and up)
347 "S" 5 bit fs source 1 register (OP_*_FS)
348 "T" 5 bit ft source 2 register (OP_*_FT)
349 "R" 5 bit fr source 3 register (OP_*_FR)
350 "V" 5 bit same register used as floating source and destination (OP_*_FS)
351 "W" 5 bit same register used as floating target and destination (OP_*_FT)
352
353 Coprocessor instructions:
354 "E" 5 bit target register (OP_*_RT)
355 "G" 5 bit destination register (OP_*_RD)
356 "H" 3 bit sel field for (d)mtc* and (d)mfc* (OP_*_SEL)
357 "P" 5 bit performance-monitor register (OP_*_PERFREG)
358 "e" 5 bit vector register byte specifier (OP_*_VECBYTE)
359 "%" 3 bit immediate vr5400 vector alignment operand (OP_*_VECALIGN)
360 see also "k" above
361 "+D" Combined destination register ("G") and sel ("H") for CP0 ops,
362 for pretty-printing in disassembly only.
363
364 Macro instructions:
365 "A" General 32 bit expression
366 "I" 32 bit immediate (value placed in imm_expr).
367 "+I" 32 bit immediate (value placed in imm2_expr).
368 "F" 64 bit floating point constant in .rdata
369 "L" 64 bit floating point constant in .lit8
370 "f" 32 bit floating point constant
371 "l" 32 bit floating point constant in .lit4
372
373 MDMX instruction operands (note that while these use the FP register
3b46e624 374 fields, they accept both $fN and $vN names for the registers):
6643d27e
FB
375 "O" MDMX alignment offset (OP_*_ALN)
376 "Q" MDMX vector/scalar/immediate source (OP_*_VSEL and OP_*_FT)
5fafdf24 377 "X" MDMX destination register (OP_*_FD)
6643d27e
FB
378 "Y" MDMX source register (OP_*_FS)
379 "Z" MDMX source register (OP_*_FT)
380
29490584
TS
381 DSP ASE usage:
382 "2" 2 bit unsigned immediate for byte align (OP_*_BP)
383 "3" 3 bit unsigned immediate (OP_*_SA3)
384 "4" 4 bit unsigned immediate (OP_*_SA4)
385 "5" 8 bit unsigned immediate (OP_*_IMM8)
386 "6" 5 bit unsigned immediate (OP_*_RS)
387 "7" 2 bit dsp accumulator register (OP_*_DSPACC)
388 "8" 6 bit unsigned immediate (OP_*_WRDSP)
389 "9" 2 bit dsp accumulator register (OP_*_DSPACC_S)
390 "0" 6 bit signed immediate (OP_*_DSPSFT)
391 ":" 7 bit signed immediate (OP_*_DSPSFT_7)
392 "'" 6 bit unsigned immediate (OP_*_RDDSP)
393 "@" 10 bit signed immediate (OP_*_IMM10)
394
395 MT ASE usage:
396 "!" 1 bit usermode flag (OP_*_MT_U)
397 "$" 1 bit load high flag (OP_*_MT_H)
398 "*" 2 bit dsp/smartmips accumulator register (OP_*_MTACC_T)
399 "&" 2 bit dsp/smartmips accumulator register (OP_*_MTACC_D)
400 "g" 5 bit coprocessor 1 and 2 destination register (OP_*_RD)
401 "+t" 5 bit coprocessor 0 destination register (OP_*_RT)
402 "+T" 5 bit coprocessor 0 destination register (OP_*_RT) - disassembly only
403
404 UDI immediates:
405 "+1" UDI immediate bits 6-10
406 "+2" UDI immediate bits 6-15
407 "+3" UDI immediate bits 6-20
408 "+4" UDI immediate bits 6-25
409
6643d27e
FB
410 Other:
411 "()" parens surrounding optional value
412 "," separates operands
413 "[]" brackets around index for vector-op scalar operand specifier (vr5400)
414 "+" Start of extension sequence.
415
416 Characters used so far, for quick reference when adding more:
29490584
TS
417 "234567890"
418 "%[]<>(),+:'@!$*&"
6643d27e 419 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
29490584 420 "abcdefghijklopqrstuvwxz"
6643d27e
FB
421
422 Extension character sequences used so far ("+" followed by the
423 following), for quick reference when adding more:
29490584
TS
424 "1234"
425 "ABCDEFGHIT"
426 "t"
6643d27e
FB
427*/
428
429/* These are the bits which may be set in the pinfo field of an
430 instructions, if it is not equal to INSN_MACRO. */
431
432/* Modifies the general purpose register in OP_*_RD. */
433#define INSN_WRITE_GPR_D 0x00000001
434/* Modifies the general purpose register in OP_*_RT. */
435#define INSN_WRITE_GPR_T 0x00000002
436/* Modifies general purpose register 31. */
437#define INSN_WRITE_GPR_31 0x00000004
438/* Modifies the floating point register in OP_*_FD. */
439#define INSN_WRITE_FPR_D 0x00000008
440/* Modifies the floating point register in OP_*_FS. */
441#define INSN_WRITE_FPR_S 0x00000010
442/* Modifies the floating point register in OP_*_FT. */
443#define INSN_WRITE_FPR_T 0x00000020
444/* Reads the general purpose register in OP_*_RS. */
445#define INSN_READ_GPR_S 0x00000040
446/* Reads the general purpose register in OP_*_RT. */
447#define INSN_READ_GPR_T 0x00000080
448/* Reads the floating point register in OP_*_FS. */
449#define INSN_READ_FPR_S 0x00000100
450/* Reads the floating point register in OP_*_FT. */
451#define INSN_READ_FPR_T 0x00000200
452/* Reads the floating point register in OP_*_FR. */
453#define INSN_READ_FPR_R 0x00000400
454/* Modifies coprocessor condition code. */
455#define INSN_WRITE_COND_CODE 0x00000800
456/* Reads coprocessor condition code. */
457#define INSN_READ_COND_CODE 0x00001000
458/* TLB operation. */
459#define INSN_TLB 0x00002000
460/* Reads coprocessor register other than floating point register. */
461#define INSN_COP 0x00004000
462/* Instruction loads value from memory, requiring delay. */
463#define INSN_LOAD_MEMORY_DELAY 0x00008000
464/* Instruction loads value from coprocessor, requiring delay. */
465#define INSN_LOAD_COPROC_DELAY 0x00010000
466/* Instruction has unconditional branch delay slot. */
467#define INSN_UNCOND_BRANCH_DELAY 0x00020000
468/* Instruction has conditional branch delay slot. */
469#define INSN_COND_BRANCH_DELAY 0x00040000
470/* Conditional branch likely: if branch not taken, insn nullified. */
471#define INSN_COND_BRANCH_LIKELY 0x00080000
472/* Moves to coprocessor register, requiring delay. */
473#define INSN_COPROC_MOVE_DELAY 0x00100000
474/* Loads coprocessor register from memory, requiring delay. */
475#define INSN_COPROC_MEMORY_DELAY 0x00200000
476/* Reads the HI register. */
477#define INSN_READ_HI 0x00400000
478/* Reads the LO register. */
479#define INSN_READ_LO 0x00800000
480/* Modifies the HI register. */
481#define INSN_WRITE_HI 0x01000000
482/* Modifies the LO register. */
483#define INSN_WRITE_LO 0x02000000
484/* Takes a trap (easier to keep out of delay slot). */
485#define INSN_TRAP 0x04000000
486/* Instruction stores value into memory. */
487#define INSN_STORE_MEMORY 0x08000000
488/* Instruction uses single precision floating point. */
489#define FP_S 0x10000000
490/* Instruction uses double precision floating point. */
491#define FP_D 0x20000000
492/* Instruction is part of the tx39's integer multiply family. */
493#define INSN_MULT 0x40000000
494/* Instruction synchronize shared memory. */
495#define INSN_SYNC 0x80000000
29490584
TS
496
497/* These are the bits which may be set in the pinfo2 field of an
498 instruction. */
499
500/* Instruction is a simple alias (I.E. "move" for daddu/addu/or) */
501#define INSN2_ALIAS 0x00000001
502/* Instruction reads MDMX accumulator. */
503#define INSN2_READ_MDMX_ACC 0x00000002
504/* Instruction writes MDMX accumulator. */
505#define INSN2_WRITE_MDMX_ACC 0x00000004
6643d27e
FB
506
507/* Instruction is actually a macro. It should be ignored by the
508 disassembler, and requires special treatment by the assembler. */
509#define INSN_MACRO 0xffffffff
510
511/* Masks used to mark instructions to indicate which MIPS ISA level
512 they were introduced in. ISAs, as defined below, are logical
513 ORs of these bits, indicating that they support the instructions
514 defined at the given level. */
515
516#define INSN_ISA_MASK 0x00000fff
517#define INSN_ISA1 0x00000001
518#define INSN_ISA2 0x00000002
519#define INSN_ISA3 0x00000004
520#define INSN_ISA4 0x00000008
521#define INSN_ISA5 0x00000010
522#define INSN_ISA32 0x00000020
523#define INSN_ISA64 0x00000040
524#define INSN_ISA32R2 0x00000080
525#define INSN_ISA64R2 0x00000100
b691d9d2
LA
526#define INSN_ISA32R6 0x00000200
527#define INSN_ISA64R6 0x00000400
6643d27e
FB
528
529/* Masks used for MIPS-defined ASEs. */
530#define INSN_ASE_MASK 0x0000f000
531
29490584
TS
532/* DSP ASE */
533#define INSN_DSP 0x00001000
534#define INSN_DSP64 0x00002000
6643d27e 535/* MIPS 16 ASE */
29490584 536#define INSN_MIPS16 0x00004000
6643d27e 537/* MIPS-3D ASE */
29490584 538#define INSN_MIPS3D 0x00008000
6643d27e
FB
539
540/* Chip specific instructions. These are bitmasks. */
541
542/* MIPS R4650 instruction. */
543#define INSN_4650 0x00010000
544/* LSI R4010 instruction. */
545#define INSN_4010 0x00020000
546/* NEC VR4100 instruction. */
547#define INSN_4100 0x00040000
548/* Toshiba R3900 instruction. */
549#define INSN_3900 0x00080000
550/* MIPS R10000 instruction. */
551#define INSN_10000 0x00100000
552/* Broadcom SB-1 instruction. */
553#define INSN_SB1 0x00200000
554/* NEC VR4111/VR4181 instruction. */
555#define INSN_4111 0x00400000
556/* NEC VR4120 instruction. */
557#define INSN_4120 0x00800000
558/* NEC VR5400 instruction. */
559#define INSN_5400 0x01000000
560/* NEC VR5500 instruction. */
561#define INSN_5500 0x02000000
562
29490584
TS
563/* MDMX ASE */
564#define INSN_MDMX 0x04000000
565/* MT ASE */
566#define INSN_MT 0x08000000
567/* SmartMIPS ASE */
568#define INSN_SMARTMIPS 0x10000000
569/* DSP R2 ASE */
570#define INSN_DSPR2 0x20000000
571
15656e09
AJ
572/* ST Microelectronics Loongson 2E. */
573#define INSN_LOONGSON_2E 0x40000000
574/* ST Microelectronics Loongson 2F. */
575#define INSN_LOONGSON_2F 0x80000000
576
6643d27e
FB
577/* MIPS ISA defines, use instead of hardcoding ISA level. */
578
579#define ISA_UNKNOWN 0 /* Gas internal use. */
580#define ISA_MIPS1 (INSN_ISA1)
581#define ISA_MIPS2 (ISA_MIPS1 | INSN_ISA2)
582#define ISA_MIPS3 (ISA_MIPS2 | INSN_ISA3)
583#define ISA_MIPS4 (ISA_MIPS3 | INSN_ISA4)
584#define ISA_MIPS5 (ISA_MIPS4 | INSN_ISA5)
585
586#define ISA_MIPS32 (ISA_MIPS2 | INSN_ISA32)
587#define ISA_MIPS64 (ISA_MIPS5 | INSN_ISA32 | INSN_ISA64)
588
589#define ISA_MIPS32R2 (ISA_MIPS32 | INSN_ISA32R2)
590#define ISA_MIPS64R2 (ISA_MIPS64 | INSN_ISA32R2 | INSN_ISA64R2)
591
b691d9d2
LA
592#define ISA_MIPS32R6 (ISA_MIPS32R2 | INSN_ISA32R6)
593#define ISA_MIPS64R6 (ISA_MIPS64R2 | INSN_ISA32R6 | INSN_ISA64R6)
6643d27e
FB
594
595/* CPU defines, use instead of hardcoding processor number. Keep this
596 in sync with bfd/archures.c in order for machine selection to work. */
597#define CPU_UNKNOWN 0 /* Gas internal use. */
598#define CPU_R3000 3000
599#define CPU_R3900 3900
600#define CPU_R4000 4000
601#define CPU_R4010 4010
602#define CPU_VR4100 4100
603#define CPU_R4111 4111
604#define CPU_VR4120 4120
605#define CPU_R4300 4300
606#define CPU_R4400 4400
607#define CPU_R4600 4600
608#define CPU_R4650 4650
609#define CPU_R5000 5000
610#define CPU_VR5400 5400
611#define CPU_VR5500 5500
612#define CPU_R6000 6000
613#define CPU_RM7000 7000
614#define CPU_R8000 8000
615#define CPU_R10000 10000
616#define CPU_R12000 12000
617#define CPU_MIPS16 16
618#define CPU_MIPS32 32
619#define CPU_MIPS32R2 33
620#define CPU_MIPS5 5
621#define CPU_MIPS64 64
622#define CPU_MIPS64R2 65
623#define CPU_SB1 12310201 /* octal 'SB', 01. */
624
625/* Test for membership in an ISA including chip specific ISAs. INSN
626 is pointer to an element of the opcode table; ISA is the specified
627 ISA/ASE bitmask to test against; and CPU is the CPU specific ISA to
628 test, or zero if no CPU specific ISA test is desired. */
629
42fe4044 630#if 0
6643d27e
FB
631#define OPCODE_IS_MEMBER(insn, isa, cpu) \
632 (((insn)->membership & isa) != 0 \
633 || (cpu == CPU_R4650 && ((insn)->membership & INSN_4650) != 0) \
634 || (cpu == CPU_RM7000 && ((insn)->membership & INSN_4650) != 0) \
29490584 635 || (cpu == CPU_RM9000 && ((insn)->membership & INSN_4650) != 0) \
6643d27e
FB
636 || (cpu == CPU_R4010 && ((insn)->membership & INSN_4010) != 0) \
637 || (cpu == CPU_VR4100 && ((insn)->membership & INSN_4100) != 0) \
638 || (cpu == CPU_R3900 && ((insn)->membership & INSN_3900) != 0) \
639 || ((cpu == CPU_R10000 || cpu == CPU_R12000) \
640 && ((insn)->membership & INSN_10000) != 0) \
641 || (cpu == CPU_SB1 && ((insn)->membership & INSN_SB1) != 0) \
642 || (cpu == CPU_R4111 && ((insn)->membership & INSN_4111) != 0) \
643 || (cpu == CPU_VR4120 && ((insn)->membership & INSN_4120) != 0) \
644 || (cpu == CPU_VR5400 && ((insn)->membership & INSN_5400) != 0) \
645 || (cpu == CPU_VR5500 && ((insn)->membership & INSN_5500) != 0) \
646 || 0) /* Please keep this term for easier source merging. */
42fe4044
FB
647#else
648#define OPCODE_IS_MEMBER(insn, isa, cpu) \
649 (1 != 0)
650#endif
6643d27e
FB
651
652/* This is a list of macro expanded instructions.
653
654 _I appended means immediate
655 _A appended means address
656 _AB appended means address with base register
657 _D appended means 64 bit floating point constant
658 _S appended means 32 bit floating point constant. */
659
660enum
661{
662 M_ABS,
663 M_ADD_I,
664 M_ADDU_I,
665 M_AND_I,
29490584 666 M_BALIGN,
6643d27e
FB
667 M_BEQ,
668 M_BEQ_I,
669 M_BEQL_I,
670 M_BGE,
671 M_BGEL,
672 M_BGE_I,
673 M_BGEL_I,
674 M_BGEU,
675 M_BGEUL,
676 M_BGEU_I,
677 M_BGEUL_I,
678 M_BGT,
679 M_BGTL,
680 M_BGT_I,
681 M_BGTL_I,
682 M_BGTU,
683 M_BGTUL,
684 M_BGTU_I,
685 M_BGTUL_I,
686 M_BLE,
687 M_BLEL,
688 M_BLE_I,
689 M_BLEL_I,
690 M_BLEU,
691 M_BLEUL,
692 M_BLEU_I,
693 M_BLEUL_I,
694 M_BLT,
695 M_BLTL,
696 M_BLT_I,
697 M_BLTL_I,
698 M_BLTU,
699 M_BLTUL,
700 M_BLTU_I,
701 M_BLTUL_I,
702 M_BNE,
703 M_BNE_I,
704 M_BNEL_I,
29490584 705 M_CACHE_AB,
6643d27e
FB
706 M_DABS,
707 M_DADD_I,
708 M_DADDU_I,
709 M_DDIV_3,
710 M_DDIV_3I,
711 M_DDIVU_3,
712 M_DDIVU_3I,
713 M_DEXT,
714 M_DINS,
715 M_DIV_3,
716 M_DIV_3I,
717 M_DIVU_3,
718 M_DIVU_3I,
719 M_DLA_AB,
720 M_DLCA_AB,
721 M_DLI,
722 M_DMUL,
723 M_DMUL_I,
724 M_DMULO,
725 M_DMULO_I,
726 M_DMULOU,
727 M_DMULOU_I,
728 M_DREM_3,
729 M_DREM_3I,
730 M_DREMU_3,
731 M_DREMU_3I,
732 M_DSUB_I,
733 M_DSUBU_I,
734 M_DSUBU_I_2,
735 M_J_A,
736 M_JAL_1,
737 M_JAL_2,
738 M_JAL_A,
739 M_L_DOB,
740 M_L_DAB,
741 M_LA_AB,
742 M_LB_A,
743 M_LB_AB,
744 M_LBU_A,
745 M_LBU_AB,
746 M_LCA_AB,
747 M_LD_A,
748 M_LD_OB,
749 M_LD_AB,
750 M_LDC1_AB,
751 M_LDC2_AB,
752 M_LDC3_AB,
753 M_LDL_AB,
754 M_LDR_AB,
755 M_LH_A,
756 M_LH_AB,
757 M_LHU_A,
758 M_LHU_AB,
759 M_LI,
760 M_LI_D,
761 M_LI_DD,
762 M_LI_S,
763 M_LI_SS,
764 M_LL_AB,
765 M_LLD_AB,
766 M_LS_A,
767 M_LW_A,
768 M_LW_AB,
769 M_LWC0_A,
770 M_LWC0_AB,
771 M_LWC1_A,
772 M_LWC1_AB,
773 M_LWC2_A,
774 M_LWC2_AB,
775 M_LWC3_A,
776 M_LWC3_AB,
777 M_LWL_A,
778 M_LWL_AB,
779 M_LWR_A,
780 M_LWR_AB,
781 M_LWU_AB,
782 M_MOVE,
783 M_MUL,
784 M_MUL_I,
785 M_MULO,
786 M_MULO_I,
787 M_MULOU,
788 M_MULOU_I,
789 M_NOR_I,
790 M_OR_I,
791 M_REM_3,
792 M_REM_3I,
793 M_REMU_3,
794 M_REMU_3I,
795 M_DROL,
796 M_ROL,
797 M_DROL_I,
798 M_ROL_I,
799 M_DROR,
800 M_ROR,
801 M_DROR_I,
802 M_ROR_I,
803 M_S_DA,
804 M_S_DOB,
805 M_S_DAB,
806 M_S_S,
807 M_SC_AB,
808 M_SCD_AB,
809 M_SD_A,
810 M_SD_OB,
811 M_SD_AB,
812 M_SDC1_AB,
813 M_SDC2_AB,
814 M_SDC3_AB,
815 M_SDL_AB,
816 M_SDR_AB,
817 M_SEQ,
818 M_SEQ_I,
819 M_SGE,
820 M_SGE_I,
821 M_SGEU,
822 M_SGEU_I,
823 M_SGT,
824 M_SGT_I,
825 M_SGTU,
826 M_SGTU_I,
827 M_SLE,
828 M_SLE_I,
829 M_SLEU,
830 M_SLEU_I,
831 M_SLT_I,
832 M_SLTU_I,
833 M_SNE,
834 M_SNE_I,
835 M_SB_A,
836 M_SB_AB,
837 M_SH_A,
838 M_SH_AB,
839 M_SW_A,
840 M_SW_AB,
841 M_SWC0_A,
842 M_SWC0_AB,
843 M_SWC1_A,
844 M_SWC1_AB,
845 M_SWC2_A,
846 M_SWC2_AB,
847 M_SWC3_A,
848 M_SWC3_AB,
849 M_SWL_A,
850 M_SWL_AB,
851 M_SWR_A,
852 M_SWR_AB,
853 M_SUB_I,
854 M_SUBU_I,
855 M_SUBU_I_2,
856 M_TEQ_I,
857 M_TGE_I,
858 M_TGEU_I,
859 M_TLT_I,
860 M_TLTU_I,
861 M_TNE_I,
862 M_TRUNCWD,
863 M_TRUNCWS,
864 M_ULD,
865 M_ULD_A,
866 M_ULH,
867 M_ULH_A,
868 M_ULHU,
869 M_ULHU_A,
870 M_ULW,
871 M_ULW_A,
872 M_USH,
873 M_USH_A,
874 M_USW,
875 M_USW_A,
876 M_USD,
877 M_USD_A,
878 M_XOR_I,
879 M_COP0,
880 M_COP1,
881 M_COP2,
882 M_COP3,
883 M_NUM_MACROS
884};
885
886
887/* The order of overloaded instructions matters. Label arguments and
888 register arguments look the same. Instructions that can have either
889 for arguments must apear in the correct order in this table for the
890 assembler to pick the right one. In other words, entries with
891 immediate operands must apear after the same instruction with
892 registers.
893
894 Many instructions are short hand for other instructions (i.e., The
895 jal <register> instruction is short for jalr <register>). */
896
897extern const struct mips_opcode mips_builtin_opcodes[];
898extern const int bfd_mips_num_builtin_opcodes;
899extern struct mips_opcode *mips_opcodes;
900extern int bfd_mips_num_opcodes;
901#define NUMOPCODES bfd_mips_num_opcodes
902
903\f
904/* The rest of this file adds definitions for the mips16 TinyRISC
905 processor. */
906
907/* These are the bitmasks and shift counts used for the different
908 fields in the instruction formats. Other than OP, no masks are
909 provided for the fixed portions of an instruction, since they are
910 not needed.
911
912 The I format uses IMM11.
913
914 The RI format uses RX and IMM8.
915
916 The RR format uses RX, and RY.
917
918 The RRI format uses RX, RY, and IMM5.
919
920 The RRR format uses RX, RY, and RZ.
921
922 The RRI_A format uses RX, RY, and IMM4.
923
924 The SHIFT format uses RX, RY, and SHAMT.
925
926 The I8 format uses IMM8.
927
928 The I8_MOVR32 format uses RY and REGR32.
929
930 The IR_MOV32R format uses REG32R and MOV32Z.
931
932 The I64 format uses IMM8.
933
934 The RI64 format uses RY and IMM5.
935 */
936
937#define MIPS16OP_MASK_OP 0x1f
938#define MIPS16OP_SH_OP 11
939#define MIPS16OP_MASK_IMM11 0x7ff
940#define MIPS16OP_SH_IMM11 0
941#define MIPS16OP_MASK_RX 0x7
942#define MIPS16OP_SH_RX 8
943#define MIPS16OP_MASK_IMM8 0xff
944#define MIPS16OP_SH_IMM8 0
945#define MIPS16OP_MASK_RY 0x7
946#define MIPS16OP_SH_RY 5
947#define MIPS16OP_MASK_IMM5 0x1f
948#define MIPS16OP_SH_IMM5 0
949#define MIPS16OP_MASK_RZ 0x7
950#define MIPS16OP_SH_RZ 2
951#define MIPS16OP_MASK_IMM4 0xf
952#define MIPS16OP_SH_IMM4 0
953#define MIPS16OP_MASK_REGR32 0x1f
954#define MIPS16OP_SH_REGR32 0
955#define MIPS16OP_MASK_REG32R 0x1f
956#define MIPS16OP_SH_REG32R 3
957#define MIPS16OP_EXTRACT_REG32R(i) ((((i) >> 5) & 7) | ((i) & 0x18))
958#define MIPS16OP_MASK_MOVE32Z 0x7
959#define MIPS16OP_SH_MOVE32Z 0
960#define MIPS16OP_MASK_IMM6 0x3f
961#define MIPS16OP_SH_IMM6 5
962
963/* These are the characters which may appears in the args field of an
964 instruction. They appear in the order in which the fields appear
965 when the instruction is used. Commas and parentheses in the args
966 string are ignored when assembling, and written into the output
967 when disassembling.
968
969 "y" 3 bit register (MIPS16OP_*_RY)
970 "x" 3 bit register (MIPS16OP_*_RX)
971 "z" 3 bit register (MIPS16OP_*_RZ)
972 "Z" 3 bit register (MIPS16OP_*_MOVE32Z)
973 "v" 3 bit same register as source and destination (MIPS16OP_*_RX)
974 "w" 3 bit same register as source and destination (MIPS16OP_*_RY)
975 "0" zero register ($0)
976 "S" stack pointer ($sp or $29)
977 "P" program counter
978 "R" return address register ($ra or $31)
979 "X" 5 bit MIPS register (MIPS16OP_*_REGR32)
980 "Y" 5 bit MIPS register (MIPS16OP_*_REG32R)
981 "6" 6 bit unsigned break code (MIPS16OP_*_IMM6)
982 "a" 26 bit jump address
983 "e" 11 bit extension value
984 "l" register list for entry instruction
985 "L" register list for exit instruction
986
987 The remaining codes may be extended. Except as otherwise noted,
988 the full extended operand is a 16 bit signed value.
989 "<" 3 bit unsigned shift count * 0 (MIPS16OP_*_RZ) (full 5 bit unsigned)
990 ">" 3 bit unsigned shift count * 0 (MIPS16OP_*_RX) (full 5 bit unsigned)
991 "[" 3 bit unsigned shift count * 0 (MIPS16OP_*_RZ) (full 6 bit unsigned)
992 "]" 3 bit unsigned shift count * 0 (MIPS16OP_*_RX) (full 6 bit unsigned)
993 "4" 4 bit signed immediate * 0 (MIPS16OP_*_IMM4) (full 15 bit signed)
994 "5" 5 bit unsigned immediate * 0 (MIPS16OP_*_IMM5)
995 "H" 5 bit unsigned immediate * 2 (MIPS16OP_*_IMM5)
996 "W" 5 bit unsigned immediate * 4 (MIPS16OP_*_IMM5)
997 "D" 5 bit unsigned immediate * 8 (MIPS16OP_*_IMM5)
998 "j" 5 bit signed immediate * 0 (MIPS16OP_*_IMM5)
999 "8" 8 bit unsigned immediate * 0 (MIPS16OP_*_IMM8)
1000 "V" 8 bit unsigned immediate * 4 (MIPS16OP_*_IMM8)
1001 "C" 8 bit unsigned immediate * 8 (MIPS16OP_*_IMM8)
1002 "U" 8 bit unsigned immediate * 0 (MIPS16OP_*_IMM8) (full 16 bit unsigned)
1003 "k" 8 bit signed immediate * 0 (MIPS16OP_*_IMM8)
1004 "K" 8 bit signed immediate * 8 (MIPS16OP_*_IMM8)
1005 "p" 8 bit conditional branch address (MIPS16OP_*_IMM8)
1006 "q" 11 bit branch address (MIPS16OP_*_IMM11)
1007 "A" 8 bit PC relative address * 4 (MIPS16OP_*_IMM8)
1008 "B" 5 bit PC relative address * 8 (MIPS16OP_*_IMM5)
1009 "E" 5 bit PC relative address * 4 (MIPS16OP_*_IMM5)
1010 */
1011
29490584
TS
1012/* Save/restore encoding for the args field when all 4 registers are
1013 either saved as arguments or saved/restored as statics. */
1014#define MIPS16_ALL_ARGS 0xe
1015#define MIPS16_ALL_STATICS 0xb
1016
6643d27e
FB
1017/* For the mips16, we use the same opcode table format and a few of
1018 the same flags. However, most of the flags are different. */
1019
1020/* Modifies the register in MIPS16OP_*_RX. */
1021#define MIPS16_INSN_WRITE_X 0x00000001
1022/* Modifies the register in MIPS16OP_*_RY. */
1023#define MIPS16_INSN_WRITE_Y 0x00000002
1024/* Modifies the register in MIPS16OP_*_RZ. */
1025#define MIPS16_INSN_WRITE_Z 0x00000004
1026/* Modifies the T ($24) register. */
1027#define MIPS16_INSN_WRITE_T 0x00000008
1028/* Modifies the SP ($29) register. */
1029#define MIPS16_INSN_WRITE_SP 0x00000010
1030/* Modifies the RA ($31) register. */
1031#define MIPS16_INSN_WRITE_31 0x00000020
1032/* Modifies the general purpose register in MIPS16OP_*_REG32R. */
1033#define MIPS16_INSN_WRITE_GPR_Y 0x00000040
1034/* Reads the register in MIPS16OP_*_RX. */
1035#define MIPS16_INSN_READ_X 0x00000080
1036/* Reads the register in MIPS16OP_*_RY. */
1037#define MIPS16_INSN_READ_Y 0x00000100
1038/* Reads the register in MIPS16OP_*_MOVE32Z. */
1039#define MIPS16_INSN_READ_Z 0x00000200
1040/* Reads the T ($24) register. */
1041#define MIPS16_INSN_READ_T 0x00000400
1042/* Reads the SP ($29) register. */
1043#define MIPS16_INSN_READ_SP 0x00000800
1044/* Reads the RA ($31) register. */
1045#define MIPS16_INSN_READ_31 0x00001000
1046/* Reads the program counter. */
1047#define MIPS16_INSN_READ_PC 0x00002000
1048/* Reads the general purpose register in MIPS16OP_*_REGR32. */
1049#define MIPS16_INSN_READ_GPR_X 0x00004000
1050/* Is a branch insn. */
1051#define MIPS16_INSN_BRANCH 0x00010000
1052
1053/* The following flags have the same value for the mips16 opcode
1054 table:
1055 INSN_UNCOND_BRANCH_DELAY
1056 INSN_COND_BRANCH_DELAY
1057 INSN_COND_BRANCH_LIKELY (never used)
1058 INSN_READ_HI
1059 INSN_READ_LO
1060 INSN_WRITE_HI
1061 INSN_WRITE_LO
1062 INSN_TRAP
1063 INSN_ISA3
1064 */
1065
1066extern const struct mips_opcode mips16_opcodes[];
1067extern const int bfd_mips16_num_opcodes;
1068
1069/* Short hand so the lines aren't too long. */
1070
1071#define LDD INSN_LOAD_MEMORY_DELAY
1072#define LCD INSN_LOAD_COPROC_DELAY
1073#define UBD INSN_UNCOND_BRANCH_DELAY
1074#define CBD INSN_COND_BRANCH_DELAY
1075#define COD INSN_COPROC_MOVE_DELAY
1076#define CLD INSN_COPROC_MEMORY_DELAY
1077#define CBL INSN_COND_BRANCH_LIKELY
1078#define TRAP INSN_TRAP
1079#define SM INSN_STORE_MEMORY
1080
1081#define WR_d INSN_WRITE_GPR_D
1082#define WR_t INSN_WRITE_GPR_T
1083#define WR_31 INSN_WRITE_GPR_31
1084#define WR_D INSN_WRITE_FPR_D
1085#define WR_T INSN_WRITE_FPR_T
1086#define WR_S INSN_WRITE_FPR_S
1087#define RD_s INSN_READ_GPR_S
1088#define RD_b INSN_READ_GPR_S
1089#define RD_t INSN_READ_GPR_T
1090#define RD_S INSN_READ_FPR_S
1091#define RD_T INSN_READ_FPR_T
1092#define RD_R INSN_READ_FPR_R
1093#define WR_CC INSN_WRITE_COND_CODE
1094#define RD_CC INSN_READ_COND_CODE
1095#define RD_C0 INSN_COP
1096#define RD_C1 INSN_COP
1097#define RD_C2 INSN_COP
1098#define RD_C3 INSN_COP
1099#define WR_C0 INSN_COP
1100#define WR_C1 INSN_COP
1101#define WR_C2 INSN_COP
1102#define WR_C3 INSN_COP
1103
1104#define WR_HI INSN_WRITE_HI
1105#define RD_HI INSN_READ_HI
1106#define MOD_HI WR_HI|RD_HI
1107
1108#define WR_LO INSN_WRITE_LO
1109#define RD_LO INSN_READ_LO
1110#define MOD_LO WR_LO|RD_LO
1111
1112#define WR_HILO WR_HI|WR_LO
1113#define RD_HILO RD_HI|RD_LO
1114#define MOD_HILO WR_HILO|RD_HILO
1115
1116#define IS_M INSN_MULT
1117
29490584
TS
1118#define WR_MACC INSN2_WRITE_MDMX_ACC
1119#define RD_MACC INSN2_READ_MDMX_ACC
6643d27e
FB
1120
1121#define I1 INSN_ISA1
1122#define I2 INSN_ISA2
1123#define I3 INSN_ISA3
1124#define I4 INSN_ISA4
1125#define I5 INSN_ISA5
1126#define I32 INSN_ISA32
1127#define I64 INSN_ISA64
1128#define I33 INSN_ISA32R2
1129#define I65 INSN_ISA64R2
b691d9d2
LA
1130#define I32R6 INSN_ISA32R6
1131#define I64R6 INSN_ISA64R6
6643d27e
FB
1132
1133/* MIPS64 MIPS-3D ASE support. */
1134#define I16 INSN_MIPS16
1135
29490584
TS
1136/* MIPS32 SmartMIPS ASE support. */
1137#define SMT INSN_SMARTMIPS
1138
6643d27e
FB
1139/* MIPS64 MIPS-3D ASE support. */
1140#define M3D INSN_MIPS3D
1141
1142/* MIPS64 MDMX ASE support. */
1143#define MX INSN_MDMX
1144
15656e09
AJ
1145#define IL2E (INSN_LOONGSON_2E)
1146#define IL2F (INSN_LOONGSON_2F)
1147
6643d27e
FB
1148#define P3 INSN_4650
1149#define L1 INSN_4010
1150#define V1 (INSN_4100 | INSN_4111 | INSN_4120)
1151#define T3 INSN_3900
1152#define M1 INSN_10000
1153#define SB1 INSN_SB1
1154#define N411 INSN_4111
1155#define N412 INSN_4120
1156#define N5 (INSN_5400 | INSN_5500)
1157#define N54 INSN_5400
1158#define N55 INSN_5500
1159
1160#define G1 (T3 \
1161 )
1162
1163#define G2 (T3 \
1164 )
1165
1166#define G3 (I4 \
1167 )
1168
29490584
TS
1169/* MIPS DSP ASE support.
1170 NOTE:
1171 1. MIPS DSP ASE includes 4 accumulators ($ac0 - $ac3). $ac0 is the pair
1172 of original HI and LO. $ac1, $ac2 and $ac3 are new registers, and have
1173 the same structure as $ac0 (HI + LO). For DSP instructions that write or
1174 read accumulators (that may be $ac0), we add WR_a (WR_HILO) or RD_a
1175 (RD_HILO) attributes, such that HILO dependencies are maintained
1176 conservatively.
1177
1178 2. For some mul. instructions that use integer registers as destinations
1179 but destroy HI+LO as side-effect, we add WR_HILO to their attributes.
1180
1181 3. MIPS DSP ASE includes a new DSP control register, which has 6 fields
1182 (ccond, outflag, EFI, c, scount, pos). Many DSP instructions read or write
1183 certain fields of the DSP control register. For simplicity, we decide not
1184 to track dependencies of these fields.
1185 However, "bposge32" is a branch instruction that depends on the "pos"
1186 field. In order to make sure that GAS does not reorder DSP instructions
1187 that writes the "pos" field and "bposge32", we add DSP_VOLA (INSN_TRAP)
1188 attribute to those instructions that write the "pos" field. */
1189
1190#define WR_a WR_HILO /* Write dsp accumulators (reuse WR_HILO) */
1191#define RD_a RD_HILO /* Read dsp accumulators (reuse RD_HILO) */
1192#define MOD_a WR_a|RD_a
1193#define DSP_VOLA INSN_TRAP
1194#define D32 INSN_DSP
1195#define D33 INSN_DSPR2
1196#define D64 INSN_DSP64
1197
1198/* MIPS MT ASE support. */
1199#define MT32 INSN_MT
1200
6643d27e
FB
1201/* The order of overloaded instructions matters. Label arguments and
1202 register arguments look the same. Instructions that can have either
1203 for arguments must apear in the correct order in this table for the
1204 assembler to pick the right one. In other words, entries with
1205 immediate operands must apear after the same instruction with
1206 registers.
1207
1208 Because of the lookup algorithm used, entries with the same opcode
1209 name must be contiguous.
5fafdf24 1210
6643d27e
FB
1211 Many instructions are short hand for other instructions (i.e., The
1212 jal <register> instruction is short for jalr <register>). */
1213
1214const struct mips_opcode mips_builtin_opcodes[] =
1215{
1216/* These instructions appear first so that the disassembler will find
1217 them first. The assemblers uses a hash table based on the
1218 instruction name anyhow. */
1219/* name, args, match, mask, pinfo, membership */
4267d3e6
LA
1220{"clz", "U,s", 0x00000050, 0xfc1f07ff, WR_d|RD_s, 0, I32R6},
1221{"clo", "U,s", 0x00000051, 0xfc1f07ff, WR_d|RD_s, 0, I32R6},
1222{"dclz", "U,s", 0x00000052, 0xfc1f07ff, WR_d|RD_s, 0, I64R6},
1223{"dclo", "U,s", 0x00000053, 0xfc1f07ff, WR_d|RD_s, 0, I64R6},
1224{"sdbbp", "B", 0x0000000e, 0xfc00003f, TRAP, 0, I32R6},
b42ee5e1
LA
1225{"mul", "d,s,t", 0x00000098, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I32R6},
1226{"muh", "d,s,t", 0x000000d8, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I32R6},
1227{"mulu", "d,s,t", 0x00000099, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I32R6},
1228{"muhu", "d,s,t", 0x000000d9, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I32R6},
1229{"div", "d,s,t", 0x0000009a, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I32R6},
1230{"mod", "d,s,t", 0x000000da, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I32R6},
1231{"divu", "d,s,t", 0x0000009b, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I32R6},
1232{"modu", "d,s,t", 0x000000db, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I32R6},
1233{"dmul", "d,s,t", 0x0000009c, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I64R6},
1234{"dmuh", "d,s,t", 0x000000dc, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I64R6},
1235{"dmulu", "d,s,t", 0x0000009d, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I64R6},
1236{"dmuhu", "d,s,t", 0x000000dd, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I64R6},
1237{"ddiv", "d,s,t", 0x0000009e, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I64R6},
1238{"dmod", "d,s,t", 0x000000de, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I64R6},
1239{"ddivu", "d,s,t", 0x0000009f, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I64R6},
1240{"dmodu", "d,s,t", 0x000000df, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I64R6},
4368b29a
LA
1241{"ll", "t,o(b)", 0x7c000036, 0xfc00007f, LDD|RD_b|WR_t, 0, I32R6},
1242{"sc", "t,o(b)", 0x7c000026, 0xfc00007f, LDD|RD_b|WR_t, 0, I32R6},
bf7910c6
LA
1243{"lld", "t,o(b)", 0x7c000037, 0xfc00007f, LDD|RD_b|WR_t, 0, I64R6},
1244{"scd", "t,o(b)", 0x7c000027, 0xfc00007f, LDD|RD_b|WR_t, 0, I64R6},
1245{"pref", "h,o(b)", 0x7c000035, 0xfc00007f, RD_b, 0, I32R6},
1246{"cache", "k,o(b)", 0x7c000025, 0xfc00007f, RD_b, 0, I32R6},
b691d9d2
LA
1247{"seleqz", "d,v,t", 0x00000035, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I32R6},
1248{"selnez", "d,v,t", 0x00000037, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I32R6},
15eacb9b
YK
1249{"align", "d,v,t", 0x7c000220, 0xfc00073f, WR_d|RD_s|RD_t, 0, I32R6},
1250{"dalign", "d,v,t", 0x7c000224, 0xfc00063f, WR_d|RD_s|RD_t, 0, I64R6},
1251{"bitswap", "d,w", 0x7c000020, 0xffe007ff, WR_d|RD_t, 0, I32R6},
1252{"dbitswap","d,w", 0x7c000024, 0xffe007ff, WR_d|RD_t, 0, I64R6},
31837be3
YK
1253{"balc", "+p", 0xe8000000, 0xfc000000, UBD|WR_31, 0, I32R6},
1254{"bc", "+p", 0xc8000000, 0xfc000000, UBD|WR_31, 0, I32R6},
1255{"jic", "t,o", 0xd8000000, 0xffe00000, UBD|RD_t, 0, I32R6},
1256{"beqzc", "s,+p", 0xd8000000, 0xfc000000, CBD|RD_s, 0, I32R6},
1257{"jialc", "t,o", 0xf8000000, 0xffe00000, UBD|RD_t, 0, I32R6},
1258{"bnezc", "s,+p", 0xf8000000, 0xfc000000, CBD|RD_s, 0, I32R6},
1259{"beqzalc", "s,t,p", 0x20000000, 0xffe00000, CBD|RD_s|RD_t, 0, I32R6},
1260{"bovc", "s,t,p", 0x20000000, 0xfc000000, CBD|RD_s|RD_t, 0, I32R6},
1261{"beqc", "s,t,p", 0x20000000, 0xfc000000, CBD|RD_s|RD_t, 0, I32R6},
1262{"bnezalc", "s,t,p", 0x60000000, 0xffe00000, CBD|RD_s|RD_t, 0, I32R6},
1263{"bnvc", "s,t,p", 0x60000000, 0xfc000000, CBD|RD_s|RD_t, 0, I32R6},
1264{"bnec", "s,t,p", 0x60000000, 0xfc000000, CBD|RD_s|RD_t, 0, I32R6},
1265{"blezc", "s,t,p", 0x58000000, 0xffe00000, CBD|RD_s|RD_t, 0, I32R6},
1266{"bgezc", "s,t,p", 0x58000000, 0xfc000000, CBD|RD_s|RD_t, 0, I32R6},
1267{"bgec", "s,t,p", 0x58000000, 0xfc000000, CBD|RD_s|RD_t, 0, I32R6},
1268{"bgtzc", "s,t,p", 0x5c000000, 0xffe00000, CBD|RD_s|RD_t, 0, I32R6},
1269{"bltzc", "s,t,p", 0x5c000000, 0xfc000000, CBD|RD_s|RD_t, 0, I32R6},
1270{"bltc", "s,t,p", 0x5c000000, 0xfc000000, CBD|RD_s|RD_t, 0, I32R6},
1271{"blezalc", "s,t,p", 0x18000000, 0xffe00000, CBD|RD_s|RD_t, 0, I32R6},
1272{"bgezalc", "s,t,p", 0x18000000, 0xfc000000, CBD|RD_s|RD_t, 0, I32R6},
1273{"bgeuc", "s,t,p", 0x18000000, 0xfc000000, CBD|RD_s|RD_t, 0, I32R6},
1274{"bgtzalc", "s,t,p", 0x1c000000, 0xffe00000, CBD|RD_s|RD_t, 0, I32R6},
1275{"bltzalc", "s,t,p", 0x1c000000, 0xfc000000, CBD|RD_s|RD_t, 0, I32R6},
1276{"bltuc", "s,t,p", 0x1c000000, 0xfc000000, CBD|RD_s|RD_t, 0, I32R6},
1277{"bc1eqz", "T,p", 0x45200000, 0xffe00000, CBD|RD_T|FP_S|FP_D, 0, I32R6},
1278{"bc1nez", "T,p", 0x45a00000, 0xffe00000, CBD|RD_T|FP_S|FP_D, 0, I32R6},
1279{"bc2eqz", "E,p", 0x49200000, 0xffe00000, CBD|RD_C2, 0, I32R6},
1280{"bc2nez", "E,p", 0x49a00000, 0xffe00000, CBD|RD_C2, 0, I32R6},
29490584
TS
1281{"pref", "k,o(b)", 0xcc000000, 0xfc000000, RD_b, 0, I4|I32|G3 },
1282{"prefx", "h,t(b)", 0x4c00000f, 0xfc0007ff, RD_b|RD_t, 0, I4|I33 },
1283{"nop", "", 0x00000000, 0xffffffff, 0, INSN2_ALIAS, I1 }, /* sll */
1284{"ssnop", "", 0x00000040, 0xffffffff, 0, INSN2_ALIAS, I32|N55 }, /* sll */
1285{"ehb", "", 0x000000c0, 0xffffffff, 0, INSN2_ALIAS, I33 }, /* sll */
1286{"li", "t,j", 0x24000000, 0xffe00000, WR_t, INSN2_ALIAS, I1 }, /* addiu */
1287{"li", "t,i", 0x34000000, 0xffe00000, WR_t, INSN2_ALIAS, I1 }, /* ori */
1288{"li", "t,I", 0, (int) M_LI, INSN_MACRO, 0, I1 },
1289{"move", "d,s", 0, (int) M_MOVE, INSN_MACRO, 0, I1 },
1290{"move", "d,s", 0x0000002d, 0xfc1f07ff, WR_d|RD_s, INSN2_ALIAS, I3 },/* daddu */
1291{"move", "d,s", 0x00000021, 0xfc1f07ff, WR_d|RD_s, INSN2_ALIAS, I1 },/* addu */
1292{"move", "d,s", 0x00000025, 0xfc1f07ff, WR_d|RD_s, INSN2_ALIAS, I1 },/* or */
1293{"b", "p", 0x10000000, 0xffff0000, UBD, INSN2_ALIAS, I1 },/* beq 0,0 */
1294{"b", "p", 0x04010000, 0xffff0000, UBD, INSN2_ALIAS, I1 },/* bgez 0 */
1295{"bal", "p", 0x04110000, 0xffff0000, UBD|WR_31, INSN2_ALIAS, I1 },/* bgezal 0*/
1296
1297{"abs", "d,v", 0, (int) M_ABS, INSN_MACRO, 0, I1 },
1298{"abs.s", "D,V", 0x46000005, 0xffff003f, WR_D|RD_S|FP_S, 0, I1 },
1299{"abs.d", "D,V", 0x46200005, 0xffff003f, WR_D|RD_S|FP_D, 0, I1 },
1300{"abs.ps", "D,V", 0x46c00005, 0xffff003f, WR_D|RD_S|FP_D, 0, I5|I33 },
1301{"add", "d,v,t", 0x00000020, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I1 },
1302{"add", "t,r,I", 0, (int) M_ADD_I, INSN_MACRO, 0, I1 },
1303{"add.s", "D,V,T", 0x46000000, 0xffe0003f, WR_D|RD_S|RD_T|FP_S, 0, I1 },
1304{"add.d", "D,V,T", 0x46200000, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, 0, I1 },
1305{"add.ob", "X,Y,Q", 0x7800000b, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX|SB1 },
1306{"add.ob", "D,S,T", 0x4ac0000b, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },
1307{"add.ob", "D,S,T[e]", 0x4800000b, 0xfe20003f, WR_D|RD_S|RD_T, 0, N54 },
1308{"add.ob", "D,S,k", 0x4bc0000b, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },
1309{"add.ps", "D,V,T", 0x46c00000, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, 0, I5|I33 },
1310{"add.qh", "X,Y,Q", 0x7820000b, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX },
1311{"adda.ob", "Y,Q", 0x78000037, 0xfc2007ff, RD_S|RD_T|FP_D, WR_MACC, MX|SB1 },
1312{"adda.qh", "Y,Q", 0x78200037, 0xfc2007ff, RD_S|RD_T|FP_D, WR_MACC, MX },
1313{"addi", "t,r,j", 0x20000000, 0xfc000000, WR_t|RD_s, 0, I1 },
1314{"addiu", "t,r,j", 0x24000000, 0xfc000000, WR_t|RD_s, 0, I1 },
1315{"addl.ob", "Y,Q", 0x78000437, 0xfc2007ff, RD_S|RD_T|FP_D, WR_MACC, MX|SB1 },
1316{"addl.qh", "Y,Q", 0x78200437, 0xfc2007ff, RD_S|RD_T|FP_D, WR_MACC, MX },
1317{"addr.ps", "D,S,T", 0x46c00018, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, 0, M3D },
1318{"addu", "d,v,t", 0x00000021, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I1 },
1319{"addu", "t,r,I", 0, (int) M_ADDU_I, INSN_MACRO, 0, I1 },
1320{"alni.ob", "X,Y,Z,O", 0x78000018, 0xff00003f, WR_D|RD_S|RD_T|FP_D, 0, MX|SB1 },
1321{"alni.ob", "D,S,T,%", 0x48000018, 0xff00003f, WR_D|RD_S|RD_T, 0, N54 },
1322{"alni.qh", "X,Y,Z,O", 0x7800001a, 0xff00003f, WR_D|RD_S|RD_T|FP_D, 0, MX },
1323{"alnv.ps", "D,V,T,s", 0x4c00001e, 0xfc00003f, WR_D|RD_S|RD_T|FP_D, 0, I5|I33 },
1324{"alnv.ob", "X,Y,Z,s", 0x78000019, 0xfc00003f, WR_D|RD_S|RD_T|RD_s|FP_D, 0, MX|SB1 },
1325{"alnv.qh", "X,Y,Z,s", 0x7800001b, 0xfc00003f, WR_D|RD_S|RD_T|RD_s|FP_D, 0, MX },
1326{"and", "d,v,t", 0x00000024, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I1 },
1327{"and", "t,r,I", 0, (int) M_AND_I, INSN_MACRO, 0, I1 },
1328{"and.ob", "X,Y,Q", 0x7800000c, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX|SB1 },
1329{"and.ob", "D,S,T", 0x4ac0000c, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },
1330{"and.ob", "D,S,T[e]", 0x4800000c, 0xfe20003f, WR_D|RD_S|RD_T, 0, N54 },
1331{"and.ob", "D,S,k", 0x4bc0000c, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },
1332{"and.qh", "X,Y,Q", 0x7820000c, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX },
1333{"andi", "t,r,i", 0x30000000, 0xfc000000, WR_t|RD_s, 0, I1 },
6643d27e
FB
1334/* b is at the top of the table. */
1335/* bal is at the top of the table. */
29490584
TS
1336/* bc0[tf]l? are at the bottom of the table. */
1337{"bc1any2f", "N,p", 0x45200000, 0xffe30000, CBD|RD_CC|FP_S, 0, M3D },
1338{"bc1any2t", "N,p", 0x45210000, 0xffe30000, CBD|RD_CC|FP_S, 0, M3D },
1339{"bc1any4f", "N,p", 0x45400000, 0xffe30000, CBD|RD_CC|FP_S, 0, M3D },
1340{"bc1any4t", "N,p", 0x45410000, 0xffe30000, CBD|RD_CC|FP_S, 0, M3D },
1341{"bc1f", "p", 0x45000000, 0xffff0000, CBD|RD_CC|FP_S, 0, I1 },
1342{"bc1f", "N,p", 0x45000000, 0xffe30000, CBD|RD_CC|FP_S, 0, I4|I32 },
1343{"bc1fl", "p", 0x45020000, 0xffff0000, CBL|RD_CC|FP_S, 0, I2|T3 },
1344{"bc1fl", "N,p", 0x45020000, 0xffe30000, CBL|RD_CC|FP_S, 0, I4|I32 },
1345{"bc1t", "p", 0x45010000, 0xffff0000, CBD|RD_CC|FP_S, 0, I1 },
1346{"bc1t", "N,p", 0x45010000, 0xffe30000, CBD|RD_CC|FP_S, 0, I4|I32 },
1347{"bc1tl", "p", 0x45030000, 0xffff0000, CBL|RD_CC|FP_S, 0, I2|T3 },
1348{"bc1tl", "N,p", 0x45030000, 0xffe30000, CBL|RD_CC|FP_S, 0, I4|I32 },
6643d27e 1349/* bc2* are at the bottom of the table. */
29490584
TS
1350/* bc3* are at the bottom of the table. */
1351{"beqz", "s,p", 0x10000000, 0xfc1f0000, CBD|RD_s, 0, I1 },
1352{"beqzl", "s,p", 0x50000000, 0xfc1f0000, CBL|RD_s, 0, I2|T3 },
1353{"beq", "s,t,p", 0x10000000, 0xfc000000, CBD|RD_s|RD_t, 0, I1 },
1354{"beq", "s,I,p", 0, (int) M_BEQ_I, INSN_MACRO, 0, I1 },
1355{"beql", "s,t,p", 0x50000000, 0xfc000000, CBL|RD_s|RD_t, 0, I2|T3 },
1356{"beql", "s,I,p", 0, (int) M_BEQL_I, INSN_MACRO, 0, I2|T3 },
1357{"bge", "s,t,p", 0, (int) M_BGE, INSN_MACRO, 0, I1 },
1358{"bge", "s,I,p", 0, (int) M_BGE_I, INSN_MACRO, 0, I1 },
1359{"bgel", "s,t,p", 0, (int) M_BGEL, INSN_MACRO, 0, I2|T3 },
1360{"bgel", "s,I,p", 0, (int) M_BGEL_I, INSN_MACRO, 0, I2|T3 },
1361{"bgeu", "s,t,p", 0, (int) M_BGEU, INSN_MACRO, 0, I1 },
1362{"bgeu", "s,I,p", 0, (int) M_BGEU_I, INSN_MACRO, 0, I1 },
1363{"bgeul", "s,t,p", 0, (int) M_BGEUL, INSN_MACRO, 0, I2|T3 },
1364{"bgeul", "s,I,p", 0, (int) M_BGEUL_I, INSN_MACRO, 0, I2|T3 },
1365{"bgez", "s,p", 0x04010000, 0xfc1f0000, CBD|RD_s, 0, I1 },
1366{"bgezl", "s,p", 0x04030000, 0xfc1f0000, CBL|RD_s, 0, I2|T3 },
1367{"bgezal", "s,p", 0x04110000, 0xfc1f0000, CBD|RD_s|WR_31, 0, I1 },
1368{"bgezall", "s,p", 0x04130000, 0xfc1f0000, CBL|RD_s|WR_31, 0, I2|T3 },
1369{"bgt", "s,t,p", 0, (int) M_BGT, INSN_MACRO, 0, I1 },
1370{"bgt", "s,I,p", 0, (int) M_BGT_I, INSN_MACRO, 0, I1 },
1371{"bgtl", "s,t,p", 0, (int) M_BGTL, INSN_MACRO, 0, I2|T3 },
1372{"bgtl", "s,I,p", 0, (int) M_BGTL_I, INSN_MACRO, 0, I2|T3 },
1373{"bgtu", "s,t,p", 0, (int) M_BGTU, INSN_MACRO, 0, I1 },
1374{"bgtu", "s,I,p", 0, (int) M_BGTU_I, INSN_MACRO, 0, I1 },
1375{"bgtul", "s,t,p", 0, (int) M_BGTUL, INSN_MACRO, 0, I2|T3 },
1376{"bgtul", "s,I,p", 0, (int) M_BGTUL_I, INSN_MACRO, 0, I2|T3 },
1377{"bgtz", "s,p", 0x1c000000, 0xfc1f0000, CBD|RD_s, 0, I1 },
1378{"bgtzl", "s,p", 0x5c000000, 0xfc1f0000, CBL|RD_s, 0, I2|T3 },
1379{"ble", "s,t,p", 0, (int) M_BLE, INSN_MACRO, 0, I1 },
1380{"ble", "s,I,p", 0, (int) M_BLE_I, INSN_MACRO, 0, I1 },
1381{"blel", "s,t,p", 0, (int) M_BLEL, INSN_MACRO, 0, I2|T3 },
1382{"blel", "s,I,p", 0, (int) M_BLEL_I, INSN_MACRO, 0, I2|T3 },
1383{"bleu", "s,t,p", 0, (int) M_BLEU, INSN_MACRO, 0, I1 },
1384{"bleu", "s,I,p", 0, (int) M_BLEU_I, INSN_MACRO, 0, I1 },
1385{"bleul", "s,t,p", 0, (int) M_BLEUL, INSN_MACRO, 0, I2|T3 },
1386{"bleul", "s,I,p", 0, (int) M_BLEUL_I, INSN_MACRO, 0, I2|T3 },
1387{"blez", "s,p", 0x18000000, 0xfc1f0000, CBD|RD_s, 0, I1 },
1388{"blezl", "s,p", 0x58000000, 0xfc1f0000, CBL|RD_s, 0, I2|T3 },
1389{"blt", "s,t,p", 0, (int) M_BLT, INSN_MACRO, 0, I1 },
1390{"blt", "s,I,p", 0, (int) M_BLT_I, INSN_MACRO, 0, I1 },
1391{"bltl", "s,t,p", 0, (int) M_BLTL, INSN_MACRO, 0, I2|T3 },
1392{"bltl", "s,I,p", 0, (int) M_BLTL_I, INSN_MACRO, 0, I2|T3 },
1393{"bltu", "s,t,p", 0, (int) M_BLTU, INSN_MACRO, 0, I1 },
1394{"bltu", "s,I,p", 0, (int) M_BLTU_I, INSN_MACRO, 0, I1 },
1395{"bltul", "s,t,p", 0, (int) M_BLTUL, INSN_MACRO, 0, I2|T3 },
1396{"bltul", "s,I,p", 0, (int) M_BLTUL_I, INSN_MACRO, 0, I2|T3 },
1397{"bltz", "s,p", 0x04000000, 0xfc1f0000, CBD|RD_s, 0, I1 },
1398{"bltzl", "s,p", 0x04020000, 0xfc1f0000, CBL|RD_s, 0, I2|T3 },
1399{"bltzal", "s,p", 0x04100000, 0xfc1f0000, CBD|RD_s|WR_31, 0, I1 },
1400{"bltzall", "s,p", 0x04120000, 0xfc1f0000, CBL|RD_s|WR_31, 0, I2|T3 },
1401{"bnez", "s,p", 0x14000000, 0xfc1f0000, CBD|RD_s, 0, I1 },
1402{"bnezl", "s,p", 0x54000000, 0xfc1f0000, CBL|RD_s, 0, I2|T3 },
1403{"bne", "s,t,p", 0x14000000, 0xfc000000, CBD|RD_s|RD_t, 0, I1 },
1404{"bne", "s,I,p", 0, (int) M_BNE_I, INSN_MACRO, 0, I1 },
1405{"bnel", "s,t,p", 0x54000000, 0xfc000000, CBL|RD_s|RD_t, 0, I2|T3 },
1406{"bnel", "s,I,p", 0, (int) M_BNEL_I, INSN_MACRO, 0, I2|T3 },
1407{"break", "", 0x0000000d, 0xffffffff, TRAP, 0, I1 },
1408{"break", "c", 0x0000000d, 0xfc00ffff, TRAP, 0, I1 },
1409{"break", "c,q", 0x0000000d, 0xfc00003f, TRAP, 0, I1 },
1410{"c.f.d", "S,T", 0x46200030, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I1 },
1411{"c.f.d", "M,S,T", 0x46200030, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I4|I32 },
1412{"c.f.s", "S,T", 0x46000030, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, 0, I1 },
1413{"c.f.s", "M,S,T", 0x46000030, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, I4|I32 },
1414{"c.f.ps", "S,T", 0x46c00030, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1415{"c.f.ps", "M,S,T", 0x46c00030, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1416{"c.un.d", "S,T", 0x46200031, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I1 },
1417{"c.un.d", "M,S,T", 0x46200031, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I4|I32 },
1418{"c.un.s", "S,T", 0x46000031, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, 0, I1 },
1419{"c.un.s", "M,S,T", 0x46000031, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, I4|I32 },
1420{"c.un.ps", "S,T", 0x46c00031, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1421{"c.un.ps", "M,S,T", 0x46c00031, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1422{"c.eq.d", "S,T", 0x46200032, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I1 },
1423{"c.eq.d", "M,S,T", 0x46200032, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I4|I32 },
1424{"c.eq.s", "S,T", 0x46000032, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, 0, I1 },
1425{"c.eq.s", "M,S,T", 0x46000032, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, I4|I32 },
1426{"c.eq.ob", "Y,Q", 0x78000001, 0xfc2007ff, WR_CC|RD_S|RD_T|FP_D, 0, MX|SB1 },
1427{"c.eq.ob", "S,T", 0x4ac00001, 0xffe007ff, WR_CC|RD_S|RD_T, 0, N54 },
1428{"c.eq.ob", "S,T[e]", 0x48000001, 0xfe2007ff, WR_CC|RD_S|RD_T, 0, N54 },
1429{"c.eq.ob", "S,k", 0x4bc00001, 0xffe007ff, WR_CC|RD_S|RD_T, 0, N54 },
1430{"c.eq.ps", "S,T", 0x46c00032, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1431{"c.eq.ps", "M,S,T", 0x46c00032, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1432{"c.eq.qh", "Y,Q", 0x78200001, 0xfc2007ff, WR_CC|RD_S|RD_T|FP_D, 0, MX },
1433{"c.ueq.d", "S,T", 0x46200033, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I1 },
1434{"c.ueq.d", "M,S,T", 0x46200033, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I4|I32 },
1435{"c.ueq.s", "S,T", 0x46000033, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, 0, I1 },
1436{"c.ueq.s", "M,S,T", 0x46000033, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, I4|I32 },
1437{"c.ueq.ps","S,T", 0x46c00033, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1438{"c.ueq.ps","M,S,T", 0x46c00033, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1439{"c.olt.d", "S,T", 0x46200034, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I1 },
1440{"c.olt.d", "M,S,T", 0x46200034, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I4|I32 },
1441{"c.olt.s", "S,T", 0x46000034, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, 0, I1 },
1442{"c.olt.s", "M,S,T", 0x46000034, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, I4|I32 },
1443{"c.olt.ps","S,T", 0x46c00034, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1444{"c.olt.ps","M,S,T", 0x46c00034, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1445{"c.ult.d", "S,T", 0x46200035, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I1 },
1446{"c.ult.d", "M,S,T", 0x46200035, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I4|I32 },
1447{"c.ult.s", "S,T", 0x46000035, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, 0, I1 },
1448{"c.ult.s", "M,S,T", 0x46000035, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, I4|I32 },
1449{"c.ult.ps","S,T", 0x46c00035, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1450{"c.ult.ps","M,S,T", 0x46c00035, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1451{"c.ole.d", "S,T", 0x46200036, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I1 },
1452{"c.ole.d", "M,S,T", 0x46200036, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I4|I32 },
1453{"c.ole.s", "S,T", 0x46000036, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, 0, I1 },
1454{"c.ole.s", "M,S,T", 0x46000036, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, I4|I32 },
1455{"c.ole.ps","S,T", 0x46c00036, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1456{"c.ole.ps","M,S,T", 0x46c00036, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1457{"c.ule.d", "S,T", 0x46200037, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I1 },
1458{"c.ule.d", "M,S,T", 0x46200037, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I4|I32 },
1459{"c.ule.s", "S,T", 0x46000037, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, 0, I1 },
1460{"c.ule.s", "M,S,T", 0x46000037, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, I4|I32 },
1461{"c.ule.ps","S,T", 0x46c00037, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1462{"c.ule.ps","M,S,T", 0x46c00037, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1463{"c.sf.d", "S,T", 0x46200038, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I1 },
1464{"c.sf.d", "M,S,T", 0x46200038, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I4|I32 },
1465{"c.sf.s", "S,T", 0x46000038, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, 0, I1 },
1466{"c.sf.s", "M,S,T", 0x46000038, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, I4|I32 },
1467{"c.sf.ps", "S,T", 0x46c00038, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1468{"c.sf.ps", "M,S,T", 0x46c00038, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1469{"c.ngle.d","S,T", 0x46200039, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I1 },
1470{"c.ngle.d","M,S,T", 0x46200039, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I4|I32 },
1471{"c.ngle.s","S,T", 0x46000039, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, 0, I1 },
1472{"c.ngle.s","M,S,T", 0x46000039, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, I4|I32 },
1473{"c.ngle.ps","S,T", 0x46c00039, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1474{"c.ngle.ps","M,S,T", 0x46c00039, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1475{"c.seq.d", "S,T", 0x4620003a, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I1 },
1476{"c.seq.d", "M,S,T", 0x4620003a, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I4|I32 },
1477{"c.seq.s", "S,T", 0x4600003a, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, 0, I1 },
1478{"c.seq.s", "M,S,T", 0x4600003a, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, I4|I32 },
1479{"c.seq.ps","S,T", 0x46c0003a, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1480{"c.seq.ps","M,S,T", 0x46c0003a, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1481{"c.ngl.d", "S,T", 0x4620003b, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I1 },
1482{"c.ngl.d", "M,S,T", 0x4620003b, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I4|I32 },
1483{"c.ngl.s", "S,T", 0x4600003b, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, 0, I1 },
1484{"c.ngl.s", "M,S,T", 0x4600003b, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, I4|I32 },
1485{"c.ngl.ps","S,T", 0x46c0003b, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1486{"c.ngl.ps","M,S,T", 0x46c0003b, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1487{"c.lt.d", "S,T", 0x4620003c, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I1 },
1488{"c.lt.d", "M,S,T", 0x4620003c, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I4|I32 },
1489{"c.lt.s", "S,T", 0x4600003c, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, 0, I1 },
1490{"c.lt.s", "M,S,T", 0x4600003c, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, I4|I32 },
1491{"c.lt.ob", "Y,Q", 0x78000004, 0xfc2007ff, WR_CC|RD_S|RD_T|FP_D, 0, MX|SB1 },
1492{"c.lt.ob", "S,T", 0x4ac00004, 0xffe007ff, WR_CC|RD_S|RD_T, 0, N54 },
1493{"c.lt.ob", "S,T[e]", 0x48000004, 0xfe2007ff, WR_CC|RD_S|RD_T, 0, N54 },
1494{"c.lt.ob", "S,k", 0x4bc00004, 0xffe007ff, WR_CC|RD_S|RD_T, 0, N54 },
1495{"c.lt.ps", "S,T", 0x46c0003c, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1496{"c.lt.ps", "M,S,T", 0x46c0003c, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1497{"c.lt.qh", "Y,Q", 0x78200004, 0xfc2007ff, WR_CC|RD_S|RD_T|FP_D, 0, MX },
1498{"c.nge.d", "S,T", 0x4620003d, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I1 },
1499{"c.nge.d", "M,S,T", 0x4620003d, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I4|I32 },
1500{"c.nge.s", "S,T", 0x4600003d, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, 0, I1 },
1501{"c.nge.s", "M,S,T", 0x4600003d, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, I4|I32 },
1502{"c.nge.ps","S,T", 0x46c0003d, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1503{"c.nge.ps","M,S,T", 0x46c0003d, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1504{"c.le.d", "S,T", 0x4620003e, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I1 },
1505{"c.le.d", "M,S,T", 0x4620003e, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I4|I32 },
1506{"c.le.s", "S,T", 0x4600003e, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, 0, I1 },
1507{"c.le.s", "M,S,T", 0x4600003e, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, I4|I32 },
1508{"c.le.ob", "Y,Q", 0x78000005, 0xfc2007ff, WR_CC|RD_S|RD_T|FP_D, 0, MX|SB1 },
1509{"c.le.ob", "S,T", 0x4ac00005, 0xffe007ff, WR_CC|RD_S|RD_T, 0, N54 },
1510{"c.le.ob", "S,T[e]", 0x48000005, 0xfe2007ff, WR_CC|RD_S|RD_T, 0, N54 },
1511{"c.le.ob", "S,k", 0x4bc00005, 0xffe007ff, WR_CC|RD_S|RD_T, 0, N54 },
1512{"c.le.ps", "S,T", 0x46c0003e, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1513{"c.le.ps", "M,S,T", 0x46c0003e, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1514{"c.le.qh", "Y,Q", 0x78200005, 0xfc2007ff, WR_CC|RD_S|RD_T|FP_D, 0, MX },
1515{"c.ngt.d", "S,T", 0x4620003f, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I1 },
1516{"c.ngt.d", "M,S,T", 0x4620003f, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I4|I32 },
1517{"c.ngt.s", "S,T", 0x4600003f, 0xffe007ff, RD_S|RD_T|WR_CC|FP_S, 0, I1 },
1518{"c.ngt.s", "M,S,T", 0x4600003f, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, I4|I32 },
1519{"c.ngt.ps","S,T", 0x46c0003f, 0xffe007ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1520{"c.ngt.ps","M,S,T", 0x46c0003f, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, I5|I33 },
1521{"cabs.eq.d", "M,S,T", 0x46200072, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1522{"cabs.eq.ps", "M,S,T", 0x46c00072, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1523{"cabs.eq.s", "M,S,T", 0x46000072, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, M3D },
1524{"cabs.f.d", "M,S,T", 0x46200070, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1525{"cabs.f.ps", "M,S,T", 0x46c00070, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1526{"cabs.f.s", "M,S,T", 0x46000070, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, M3D },
1527{"cabs.le.d", "M,S,T", 0x4620007e, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1528{"cabs.le.ps", "M,S,T", 0x46c0007e, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1529{"cabs.le.s", "M,S,T", 0x4600007e, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, M3D },
1530{"cabs.lt.d", "M,S,T", 0x4620007c, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1531{"cabs.lt.ps", "M,S,T", 0x46c0007c, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1532{"cabs.lt.s", "M,S,T", 0x4600007c, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, M3D },
1533{"cabs.nge.d", "M,S,T", 0x4620007d, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1534{"cabs.nge.ps","M,S,T", 0x46c0007d, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1535{"cabs.nge.s", "M,S,T", 0x4600007d, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, M3D },
1536{"cabs.ngl.d", "M,S,T", 0x4620007b, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1537{"cabs.ngl.ps","M,S,T", 0x46c0007b, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1538{"cabs.ngl.s", "M,S,T", 0x4600007b, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, M3D },
1539{"cabs.ngle.d","M,S,T", 0x46200079, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1540{"cabs.ngle.ps","M,S,T",0x46c00079, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1541{"cabs.ngle.s","M,S,T", 0x46000079, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, M3D },
1542{"cabs.ngt.d", "M,S,T", 0x4620007f, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1543{"cabs.ngt.ps","M,S,T", 0x46c0007f, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1544{"cabs.ngt.s", "M,S,T", 0x4600007f, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, M3D },
1545{"cabs.ole.d", "M,S,T", 0x46200076, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1546{"cabs.ole.ps","M,S,T", 0x46c00076, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1547{"cabs.ole.s", "M,S,T", 0x46000076, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, M3D },
1548{"cabs.olt.d", "M,S,T", 0x46200074, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1549{"cabs.olt.ps","M,S,T", 0x46c00074, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1550{"cabs.olt.s", "M,S,T", 0x46000074, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, M3D },
1551{"cabs.seq.d", "M,S,T", 0x4620007a, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1552{"cabs.seq.ps","M,S,T", 0x46c0007a, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1553{"cabs.seq.s", "M,S,T", 0x4600007a, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, M3D },
1554{"cabs.sf.d", "M,S,T", 0x46200078, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1555{"cabs.sf.ps", "M,S,T", 0x46c00078, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1556{"cabs.sf.s", "M,S,T", 0x46000078, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, M3D },
1557{"cabs.ueq.d", "M,S,T", 0x46200073, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1558{"cabs.ueq.ps","M,S,T", 0x46c00073, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1559{"cabs.ueq.s", "M,S,T", 0x46000073, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, M3D },
1560{"cabs.ule.d", "M,S,T", 0x46200077, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1561{"cabs.ule.ps","M,S,T", 0x46c00077, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1562{"cabs.ule.s", "M,S,T", 0x46000077, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, M3D },
1563{"cabs.ult.d", "M,S,T", 0x46200075, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1564{"cabs.ult.ps","M,S,T", 0x46c00075, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1565{"cabs.ult.s", "M,S,T", 0x46000075, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, M3D },
1566{"cabs.un.d", "M,S,T", 0x46200071, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1567{"cabs.un.ps", "M,S,T", 0x46c00071, 0xffe000ff, RD_S|RD_T|WR_CC|FP_D, 0, M3D },
1568{"cabs.un.s", "M,S,T", 0x46000071, 0xffe000ff, RD_S|RD_T|WR_CC|FP_S, 0, M3D },
1569/* CW4010 instructions which are aliases for the cache instruction. */
1570{"flushi", "", 0xbc010000, 0xffffffff, 0, 0, L1 },
1571{"flushd", "", 0xbc020000, 0xffffffff, 0, 0, L1 },
1572{"flushid", "", 0xbc030000, 0xffffffff, 0, 0, L1 },
1573{"wb", "o(b)", 0xbc040000, 0xfc1f0000, SM|RD_b, 0, L1 },
1574{"cache", "k,o(b)", 0xbc000000, 0xfc000000, RD_b, 0, I3|I32|T3},
1575{"cache", "k,A(b)", 0, (int) M_CACHE_AB, INSN_MACRO, 0, I3|I32|T3},
1576{"ceil.l.d", "D,S", 0x4620000a, 0xffff003f, WR_D|RD_S|FP_D, 0, I3|I33 },
1577{"ceil.l.s", "D,S", 0x4600000a, 0xffff003f, WR_D|RD_S|FP_S|FP_D, 0, I3|I33 },
1578{"ceil.w.d", "D,S", 0x4620000e, 0xffff003f, WR_D|RD_S|FP_S|FP_D, 0, I2 },
1579{"ceil.w.s", "D,S", 0x4600000e, 0xffff003f, WR_D|RD_S|FP_S, 0, I2 },
1580{"cfc0", "t,G", 0x40400000, 0xffe007ff, LCD|WR_t|RD_C0, 0, I1 },
1581{"cfc1", "t,G", 0x44400000, 0xffe007ff, LCD|WR_t|RD_C1|FP_S, 0, I1 },
1582{"cfc1", "t,S", 0x44400000, 0xffe007ff, LCD|WR_t|RD_C1|FP_S, 0, I1 },
6643d27e 1583/* cfc2 is at the bottom of the table. */
29490584
TS
1584/* cfc3 is at the bottom of the table. */
1585{"cftc1", "d,E", 0x41000023, 0xffe007ff, TRAP|LCD|WR_d|RD_C1|FP_S, 0, MT32 },
1586{"cftc1", "d,T", 0x41000023, 0xffe007ff, TRAP|LCD|WR_d|RD_C1|FP_S, 0, MT32 },
1587{"cftc2", "d,E", 0x41000025, 0xffe007ff, TRAP|LCD|WR_d|RD_C2, 0, MT32 },
1588{"clo", "U,s", 0x70000021, 0xfc0007ff, WR_d|WR_t|RD_s, 0, I32|N55 },
1589{"clz", "U,s", 0x70000020, 0xfc0007ff, WR_d|WR_t|RD_s, 0, I32|N55 },
1590{"ctc0", "t,G", 0x40c00000, 0xffe007ff, COD|RD_t|WR_CC, 0, I1 },
1591{"ctc1", "t,G", 0x44c00000, 0xffe007ff, COD|RD_t|WR_CC|FP_S, 0, I1 },
1592{"ctc1", "t,S", 0x44c00000, 0xffe007ff, COD|RD_t|WR_CC|FP_S, 0, I1 },
6643d27e 1593/* ctc2 is at the bottom of the table. */
29490584
TS
1594/* ctc3 is at the bottom of the table. */
1595{"cttc1", "t,g", 0x41800023, 0xffe007ff, TRAP|COD|RD_t|WR_CC|FP_S, 0, MT32 },
1596{"cttc1", "t,S", 0x41800023, 0xffe007ff, TRAP|COD|RD_t|WR_CC|FP_S, 0, MT32 },
1597{"cttc2", "t,g", 0x41800025, 0xffe007ff, TRAP|COD|RD_t|WR_CC, 0, MT32 },
1598{"cvt.d.l", "D,S", 0x46a00021, 0xffff003f, WR_D|RD_S|FP_D, 0, I3|I33 },
1599{"cvt.d.s", "D,S", 0x46000021, 0xffff003f, WR_D|RD_S|FP_S|FP_D, 0, I1 },
1600{"cvt.d.w", "D,S", 0x46800021, 0xffff003f, WR_D|RD_S|FP_S|FP_D, 0, I1 },
1601{"cvt.l.d", "D,S", 0x46200025, 0xffff003f, WR_D|RD_S|FP_D, 0, I3|I33 },
1602{"cvt.l.s", "D,S", 0x46000025, 0xffff003f, WR_D|RD_S|FP_S|FP_D, 0, I3|I33 },
1603{"cvt.s.l", "D,S", 0x46a00020, 0xffff003f, WR_D|RD_S|FP_S|FP_D, 0, I3|I33 },
1604{"cvt.s.d", "D,S", 0x46200020, 0xffff003f, WR_D|RD_S|FP_S|FP_D, 0, I1 },
1605{"cvt.s.w", "D,S", 0x46800020, 0xffff003f, WR_D|RD_S|FP_S, 0, I1 },
1606{"cvt.s.pl","D,S", 0x46c00028, 0xffff003f, WR_D|RD_S|FP_S|FP_D, 0, I5|I33 },
1607{"cvt.s.pu","D,S", 0x46c00020, 0xffff003f, WR_D|RD_S|FP_S|FP_D, 0, I5|I33 },
1608{"cvt.w.d", "D,S", 0x46200024, 0xffff003f, WR_D|RD_S|FP_S|FP_D, 0, I1 },
1609{"cvt.w.s", "D,S", 0x46000024, 0xffff003f, WR_D|RD_S|FP_S, 0, I1 },
1610{"cvt.ps.pw", "D,S", 0x46800026, 0xffff003f, WR_D|RD_S|FP_S|FP_D, 0, M3D },
1611{"cvt.ps.s","D,V,T", 0x46000026, 0xffe0003f, WR_D|RD_S|RD_T|FP_S|FP_D, 0, I5|I33 },
1612{"cvt.pw.ps", "D,S", 0x46c00024, 0xffff003f, WR_D|RD_S|FP_S|FP_D, 0, M3D },
1613{"dabs", "d,v", 0, (int) M_DABS, INSN_MACRO, 0, I3 },
1614{"dadd", "d,v,t", 0x0000002c, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I3 },
1615{"dadd", "t,r,I", 0, (int) M_DADD_I, INSN_MACRO, 0, I3 },
1616{"daddi", "t,r,j", 0x60000000, 0xfc000000, WR_t|RD_s, 0, I3 },
1617{"daddiu", "t,r,j", 0x64000000, 0xfc000000, WR_t|RD_s, 0, I3 },
1618{"daddu", "d,v,t", 0x0000002d, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I3 },
1619{"daddu", "t,r,I", 0, (int) M_DADDU_I, INSN_MACRO, 0, I3 },
1620{"dbreak", "", 0x7000003f, 0xffffffff, 0, 0, N5 },
1621{"dclo", "U,s", 0x70000025, 0xfc0007ff, RD_s|WR_d|WR_t, 0, I64|N55 },
1622{"dclz", "U,s", 0x70000024, 0xfc0007ff, RD_s|WR_d|WR_t, 0, I64|N55 },
6643d27e 1623/* dctr and dctw are used on the r5000. */
29490584
TS
1624{"dctr", "o(b)", 0xbc050000, 0xfc1f0000, RD_b, 0, I3 },
1625{"dctw", "o(b)", 0xbc090000, 0xfc1f0000, RD_b, 0, I3 },
1626{"deret", "", 0x4200001f, 0xffffffff, 0, 0, I32|G2 },
1627{"dext", "t,r,I,+I", 0, (int) M_DEXT, INSN_MACRO, 0, I65 },
1628{"dext", "t,r,+A,+C", 0x7c000003, 0xfc00003f, WR_t|RD_s, 0, I65 },
1629{"dextm", "t,r,+A,+G", 0x7c000001, 0xfc00003f, WR_t|RD_s, 0, I65 },
1630{"dextu", "t,r,+E,+H", 0x7c000002, 0xfc00003f, WR_t|RD_s, 0, I65 },
6643d27e 1631/* For ddiv, see the comments about div. */
29490584
TS
1632{"ddiv", "z,s,t", 0x0000001e, 0xfc00ffff, RD_s|RD_t|WR_HILO, 0, I3 },
1633{"ddiv", "d,v,t", 0, (int) M_DDIV_3, INSN_MACRO, 0, I3 },
1634{"ddiv", "d,v,I", 0, (int) M_DDIV_3I, INSN_MACRO, 0, I3 },
6643d27e 1635/* For ddivu, see the comments about div. */
29490584
TS
1636{"ddivu", "z,s,t", 0x0000001f, 0xfc00ffff, RD_s|RD_t|WR_HILO, 0, I3 },
1637{"ddivu", "d,v,t", 0, (int) M_DDIVU_3, INSN_MACRO, 0, I3 },
1638{"ddivu", "d,v,I", 0, (int) M_DDIVU_3I, INSN_MACRO, 0, I3 },
1639{"di", "", 0x41606000, 0xffffffff, WR_t|WR_C0, 0, I33 },
1640{"di", "t", 0x41606000, 0xffe0ffff, WR_t|WR_C0, 0, I33 },
1641{"dins", "t,r,I,+I", 0, (int) M_DINS, INSN_MACRO, 0, I65 },
1642{"dins", "t,r,+A,+B", 0x7c000007, 0xfc00003f, WR_t|RD_s, 0, I65 },
1643{"dinsm", "t,r,+A,+F", 0x7c000005, 0xfc00003f, WR_t|RD_s, 0, I65 },
1644{"dinsu", "t,r,+E,+F", 0x7c000006, 0xfc00003f, WR_t|RD_s, 0, I65 },
6643d27e
FB
1645/* The MIPS assembler treats the div opcode with two operands as
1646 though the first operand appeared twice (the first operand is both
1647 a source and a destination). To get the div machine instruction,
1648 you must use an explicit destination of $0. */
29490584
TS
1649{"div", "z,s,t", 0x0000001a, 0xfc00ffff, RD_s|RD_t|WR_HILO, 0, I1 },
1650{"div", "z,t", 0x0000001a, 0xffe0ffff, RD_s|RD_t|WR_HILO, 0, I1 },
1651{"div", "d,v,t", 0, (int) M_DIV_3, INSN_MACRO, 0, I1 },
1652{"div", "d,v,I", 0, (int) M_DIV_3I, INSN_MACRO, 0, I1 },
1653{"div.d", "D,V,T", 0x46200003, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, 0, I1 },
1654{"div.s", "D,V,T", 0x46000003, 0xffe0003f, WR_D|RD_S|RD_T|FP_S, 0, I1 },
1655{"div.ps", "D,V,T", 0x46c00003, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, 0, SB1 },
6643d27e 1656/* For divu, see the comments about div. */
29490584
TS
1657{"divu", "z,s,t", 0x0000001b, 0xfc00ffff, RD_s|RD_t|WR_HILO, 0, I1 },
1658{"divu", "z,t", 0x0000001b, 0xffe0ffff, RD_s|RD_t|WR_HILO, 0, I1 },
1659{"divu", "d,v,t", 0, (int) M_DIVU_3, INSN_MACRO, 0, I1 },
1660{"divu", "d,v,I", 0, (int) M_DIVU_3I, INSN_MACRO, 0, I1 },
1661{"dla", "t,A(b)", 0, (int) M_DLA_AB, INSN_MACRO, 0, I3 },
1662{"dlca", "t,A(b)", 0, (int) M_DLCA_AB, INSN_MACRO, 0, I3 },
1663{"dli", "t,j", 0x24000000, 0xffe00000, WR_t, 0, I3 }, /* addiu */
1664{"dli", "t,i", 0x34000000, 0xffe00000, WR_t, 0, I3 }, /* ori */
1665{"dli", "t,I", 0, (int) M_DLI, INSN_MACRO, 0, I3 },
1666{"dmacc", "d,s,t", 0x00000029, 0xfc0007ff, RD_s|RD_t|WR_LO|WR_d, 0, N412 },
1667{"dmacchi", "d,s,t", 0x00000229, 0xfc0007ff, RD_s|RD_t|WR_LO|WR_d, 0, N412 },
1668{"dmacchis", "d,s,t", 0x00000629, 0xfc0007ff, RD_s|RD_t|WR_LO|WR_d, 0, N412 },
1669{"dmacchiu", "d,s,t", 0x00000269, 0xfc0007ff, RD_s|RD_t|WR_LO|WR_d, 0, N412 },
1670{"dmacchius", "d,s,t", 0x00000669, 0xfc0007ff, RD_s|RD_t|WR_LO|WR_d, 0, N412 },
1671{"dmaccs", "d,s,t", 0x00000429, 0xfc0007ff, RD_s|RD_t|WR_LO|WR_d, 0, N412 },
1672{"dmaccu", "d,s,t", 0x00000069, 0xfc0007ff, RD_s|RD_t|WR_LO|WR_d, 0, N412 },
1673{"dmaccus", "d,s,t", 0x00000469, 0xfc0007ff, RD_s|RD_t|WR_LO|WR_d, 0, N412 },
1674{"dmadd16", "s,t", 0x00000029, 0xfc00ffff, RD_s|RD_t|MOD_LO, 0, N411 },
1675{"dmfc0", "t,G", 0x40200000, 0xffe007ff, LCD|WR_t|RD_C0, 0, I3 },
1676{"dmfc0", "t,+D", 0x40200000, 0xffe007f8, LCD|WR_t|RD_C0, 0, I64 },
1677{"dmfc0", "t,G,H", 0x40200000, 0xffe007f8, LCD|WR_t|RD_C0, 0, I64 },
1678{"dmt", "", 0x41600bc1, 0xffffffff, TRAP, 0, MT32 },
1679{"dmt", "t", 0x41600bc1, 0xffe0ffff, TRAP|WR_t, 0, MT32 },
1680{"dmtc0", "t,G", 0x40a00000, 0xffe007ff, COD|RD_t|WR_C0|WR_CC, 0, I3 },
1681{"dmtc0", "t,+D", 0x40a00000, 0xffe007f8, COD|RD_t|WR_C0|WR_CC, 0, I64 },
1682{"dmtc0", "t,G,H", 0x40a00000, 0xffe007f8, COD|RD_t|WR_C0|WR_CC, 0, I64 },
1683{"dmfc1", "t,S", 0x44200000, 0xffe007ff, LCD|WR_t|RD_S|FP_D, 0, I3 },
1684{"dmfc1", "t,G", 0x44200000, 0xffe007ff, LCD|WR_t|RD_S|FP_D, 0, I3 },
1685{"dmtc1", "t,S", 0x44a00000, 0xffe007ff, COD|RD_t|WR_S|FP_D, 0, I3 },
1686{"dmtc1", "t,G", 0x44a00000, 0xffe007ff, COD|RD_t|WR_S|FP_D, 0, I3 },
6643d27e
FB
1687/* dmfc2 is at the bottom of the table. */
1688/* dmtc2 is at the bottom of the table. */
29490584
TS
1689/* dmfc3 is at the bottom of the table. */
1690/* dmtc3 is at the bottom of the table. */
1691{"dmul", "d,v,t", 0, (int) M_DMUL, INSN_MACRO, 0, I3 },
1692{"dmul", "d,v,I", 0, (int) M_DMUL_I, INSN_MACRO, 0, I3 },
1693{"dmulo", "d,v,t", 0, (int) M_DMULO, INSN_MACRO, 0, I3 },
1694{"dmulo", "d,v,I", 0, (int) M_DMULO_I, INSN_MACRO, 0, I3 },
1695{"dmulou", "d,v,t", 0, (int) M_DMULOU, INSN_MACRO, 0, I3 },
1696{"dmulou", "d,v,I", 0, (int) M_DMULOU_I, INSN_MACRO, 0, I3 },
1697{"dmult", "s,t", 0x0000001c, 0xfc00ffff, RD_s|RD_t|WR_HILO, 0, I3 },
1698{"dmultu", "s,t", 0x0000001d, 0xfc00ffff, RD_s|RD_t|WR_HILO, 0, I3 },
1699{"dneg", "d,w", 0x0000002e, 0xffe007ff, WR_d|RD_t, 0, I3 }, /* dsub 0 */
1700{"dnegu", "d,w", 0x0000002f, 0xffe007ff, WR_d|RD_t, 0, I3 }, /* dsubu 0*/
1701{"drem", "z,s,t", 0x0000001e, 0xfc00ffff, RD_s|RD_t|WR_HILO, 0, I3 },
1702{"drem", "d,v,t", 3, (int) M_DREM_3, INSN_MACRO, 0, I3 },
1703{"drem", "d,v,I", 3, (int) M_DREM_3I, INSN_MACRO, 0, I3 },
1704{"dremu", "z,s,t", 0x0000001f, 0xfc00ffff, RD_s|RD_t|WR_HILO, 0, I3 },
1705{"dremu", "d,v,t", 3, (int) M_DREMU_3, INSN_MACRO, 0, I3 },
1706{"dremu", "d,v,I", 3, (int) M_DREMU_3I, INSN_MACRO, 0, I3 },
1707{"dret", "", 0x7000003e, 0xffffffff, 0, 0, N5 },
1708{"drol", "d,v,t", 0, (int) M_DROL, INSN_MACRO, 0, I3 },
1709{"drol", "d,v,I", 0, (int) M_DROL_I, INSN_MACRO, 0, I3 },
1710{"dror", "d,v,t", 0, (int) M_DROR, INSN_MACRO, 0, I3 },
1711{"dror", "d,v,I", 0, (int) M_DROR_I, INSN_MACRO, 0, I3 },
1712{"dror", "d,w,<", 0x0020003a, 0xffe0003f, WR_d|RD_t, 0, N5|I65 },
1713{"drorv", "d,t,s", 0x00000056, 0xfc0007ff, RD_t|RD_s|WR_d, 0, N5|I65 },
1714{"dror32", "d,w,<", 0x0020003e, 0xffe0003f, WR_d|RD_t, 0, N5|I65 },
1715{"drotl", "d,v,t", 0, (int) M_DROL, INSN_MACRO, 0, I65 },
1716{"drotl", "d,v,I", 0, (int) M_DROL_I, INSN_MACRO, 0, I65 },
1717{"drotr", "d,v,t", 0, (int) M_DROR, INSN_MACRO, 0, I65 },
1718{"drotr", "d,v,I", 0, (int) M_DROR_I, INSN_MACRO, 0, I65 },
1719{"drotrv", "d,t,s", 0x00000056, 0xfc0007ff, RD_t|RD_s|WR_d, 0, I65 },
1720{"drotr32", "d,w,<", 0x0020003e, 0xffe0003f, WR_d|RD_t, 0, I65 },
1721{"dsbh", "d,w", 0x7c0000a4, 0xffe007ff, WR_d|RD_t, 0, I65 },
1722{"dshd", "d,w", 0x7c000164, 0xffe007ff, WR_d|RD_t, 0, I65 },
1723{"dsllv", "d,t,s", 0x00000014, 0xfc0007ff, WR_d|RD_t|RD_s, 0, I3 },
1724{"dsll32", "d,w,<", 0x0000003c, 0xffe0003f, WR_d|RD_t, 0, I3 },
1725{"dsll", "d,w,s", 0x00000014, 0xfc0007ff, WR_d|RD_t|RD_s, 0, I3 }, /* dsllv */
1726{"dsll", "d,w,>", 0x0000003c, 0xffe0003f, WR_d|RD_t, 0, I3 }, /* dsll32 */
1727{"dsll", "d,w,<", 0x00000038, 0xffe0003f, WR_d|RD_t, 0, I3 },
1728{"dsrav", "d,t,s", 0x00000017, 0xfc0007ff, WR_d|RD_t|RD_s, 0, I3 },
1729{"dsra32", "d,w,<", 0x0000003f, 0xffe0003f, WR_d|RD_t, 0, I3 },
1730{"dsra", "d,w,s", 0x00000017, 0xfc0007ff, WR_d|RD_t|RD_s, 0, I3 }, /* dsrav */
1731{"dsra", "d,w,>", 0x0000003f, 0xffe0003f, WR_d|RD_t, 0, I3 }, /* dsra32 */
1732{"dsra", "d,w,<", 0x0000003b, 0xffe0003f, WR_d|RD_t, 0, I3 },
1733{"dsrlv", "d,t,s", 0x00000016, 0xfc0007ff, WR_d|RD_t|RD_s, 0, I3 },
1734{"dsrl32", "d,w,<", 0x0000003e, 0xffe0003f, WR_d|RD_t, 0, I3 },
1735{"dsrl", "d,w,s", 0x00000016, 0xfc0007ff, WR_d|RD_t|RD_s, 0, I3 }, /* dsrlv */
1736{"dsrl", "d,w,>", 0x0000003e, 0xffe0003f, WR_d|RD_t, 0, I3 }, /* dsrl32 */
1737{"dsrl", "d,w,<", 0x0000003a, 0xffe0003f, WR_d|RD_t, 0, I3 },
1738{"dsub", "d,v,t", 0x0000002e, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I3 },
1739{"dsub", "d,v,I", 0, (int) M_DSUB_I, INSN_MACRO, 0, I3 },
1740{"dsubu", "d,v,t", 0x0000002f, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I3 },
1741{"dsubu", "d,v,I", 0, (int) M_DSUBU_I, INSN_MACRO, 0, I3 },
1742{"dvpe", "", 0x41600001, 0xffffffff, TRAP, 0, MT32 },
1743{"dvpe", "t", 0x41600001, 0xffe0ffff, TRAP|WR_t, 0, MT32 },
1744{"ei", "", 0x41606020, 0xffffffff, WR_t|WR_C0, 0, I33 },
1745{"ei", "t", 0x41606020, 0xffe0ffff, WR_t|WR_C0, 0, I33 },
1746{"emt", "", 0x41600be1, 0xffffffff, TRAP, 0, MT32 },
1747{"emt", "t", 0x41600be1, 0xffe0ffff, TRAP|WR_t, 0, MT32 },
1748{"eret", "", 0x42000018, 0xffffffff, 0, 0, I3|I32 },
1749{"evpe", "", 0x41600021, 0xffffffff, TRAP, 0, MT32 },
1750{"evpe", "t", 0x41600021, 0xffe0ffff, TRAP|WR_t, 0, MT32 },
1751{"ext", "t,r,+A,+C", 0x7c000000, 0xfc00003f, WR_t|RD_s, 0, I33 },
1752{"floor.l.d", "D,S", 0x4620000b, 0xffff003f, WR_D|RD_S|FP_D, 0, I3|I33 },
1753{"floor.l.s", "D,S", 0x4600000b, 0xffff003f, WR_D|RD_S|FP_S|FP_D, 0, I3|I33 },
1754{"floor.w.d", "D,S", 0x4620000f, 0xffff003f, WR_D|RD_S|FP_S|FP_D, 0, I2 },
1755{"floor.w.s", "D,S", 0x4600000f, 0xffff003f, WR_D|RD_S|FP_S, 0, I2 },
1756{"hibernate","", 0x42000023, 0xffffffff, 0, 0, V1 },
1757{"ins", "t,r,+A,+B", 0x7c000004, 0xfc00003f, WR_t|RD_s, 0, I33 },
1758{"jr", "s", 0x00000008, 0xfc1fffff, UBD|RD_s, 0, I1 },
1759/* jr.hb is officially MIPS{32,64}R2, but it works on R1 as jr with
1760 the same hazard barrier effect. */
1761{"jr.hb", "s", 0x00000408, 0xfc1fffff, UBD|RD_s, 0, I32 },
1762{"j", "s", 0x00000008, 0xfc1fffff, UBD|RD_s, 0, I1 }, /* jr */
6643d27e
FB
1763/* SVR4 PIC code requires special handling for j, so it must be a
1764 macro. */
29490584 1765{"j", "a", 0, (int) M_J_A, INSN_MACRO, 0, I1 },
6643d27e
FB
1766/* This form of j is used by the disassembler and internally by the
1767 assembler, but will never match user input (because the line above
1768 will match first). */
29490584
TS
1769{"j", "a", 0x08000000, 0xfc000000, UBD, 0, I1 },
1770{"jalr", "s", 0x0000f809, 0xfc1fffff, UBD|RD_s|WR_d, 0, I1 },
1771{"jalr", "d,s", 0x00000009, 0xfc1f07ff, UBD|RD_s|WR_d, 0, I1 },
1772/* jalr.hb is officially MIPS{32,64}R2, but it works on R1 as jalr
1773 with the same hazard barrier effect. */
1774{"jalr.hb", "s", 0x0000fc09, 0xfc1fffff, UBD|RD_s|WR_d, 0, I32 },
1775{"jalr.hb", "d,s", 0x00000409, 0xfc1f07ff, UBD|RD_s|WR_d, 0, I32 },
6643d27e
FB
1776/* SVR4 PIC code requires special handling for jal, so it must be a
1777 macro. */
29490584
TS
1778{"jal", "d,s", 0, (int) M_JAL_2, INSN_MACRO, 0, I1 },
1779{"jal", "s", 0, (int) M_JAL_1, INSN_MACRO, 0, I1 },
1780{"jal", "a", 0, (int) M_JAL_A, INSN_MACRO, 0, I1 },
6643d27e
FB
1781/* This form of jal is used by the disassembler and internally by the
1782 assembler, but will never match user input (because the line above
1783 will match first). */
29490584
TS
1784{"jal", "a", 0x0c000000, 0xfc000000, UBD|WR_31, 0, I1 },
1785{"jalx", "a", 0x74000000, 0xfc000000, UBD|WR_31, 0, I16 },
1786{"la", "t,A(b)", 0, (int) M_LA_AB, INSN_MACRO, 0, I1 },
1787{"lb", "t,o(b)", 0x80000000, 0xfc000000, LDD|RD_b|WR_t, 0, I1 },
1788{"lb", "t,A(b)", 0, (int) M_LB_AB, INSN_MACRO, 0, I1 },
1789{"lbu", "t,o(b)", 0x90000000, 0xfc000000, LDD|RD_b|WR_t, 0, I1 },
1790{"lbu", "t,A(b)", 0, (int) M_LBU_AB, INSN_MACRO, 0, I1 },
1791{"lca", "t,A(b)", 0, (int) M_LCA_AB, INSN_MACRO, 0, I1 },
1792{"ld", "t,o(b)", 0xdc000000, 0xfc000000, WR_t|RD_b, 0, I3 },
1793{"ld", "t,o(b)", 0, (int) M_LD_OB, INSN_MACRO, 0, I1 },
1794{"ld", "t,A(b)", 0, (int) M_LD_AB, INSN_MACRO, 0, I1 },
1795{"ldc1", "T,o(b)", 0xd4000000, 0xfc000000, CLD|RD_b|WR_T|FP_D, 0, I2 },
1796{"ldc1", "E,o(b)", 0xd4000000, 0xfc000000, CLD|RD_b|WR_T|FP_D, 0, I2 },
1797{"ldc1", "T,A(b)", 0, (int) M_LDC1_AB, INSN_MACRO, 0, I2 },
1798{"ldc1", "E,A(b)", 0, (int) M_LDC1_AB, INSN_MACRO, 0, I2 },
1799{"l.d", "T,o(b)", 0xd4000000, 0xfc000000, CLD|RD_b|WR_T|FP_D, 0, I2 }, /* ldc1 */
1800{"l.d", "T,o(b)", 0, (int) M_L_DOB, INSN_MACRO, 0, I1 },
1801{"l.d", "T,A(b)", 0, (int) M_L_DAB, INSN_MACRO, 0, I1 },
1802{"ldc2", "E,o(b)", 0xd8000000, 0xfc000000, CLD|RD_b|WR_CC, 0, I2 },
1803{"ldc2", "E,A(b)", 0, (int) M_LDC2_AB, INSN_MACRO, 0, I2 },
1804{"ldc3", "E,o(b)", 0xdc000000, 0xfc000000, CLD|RD_b|WR_CC, 0, I2 },
1805{"ldc3", "E,A(b)", 0, (int) M_LDC3_AB, INSN_MACRO, 0, I2 },
1806{"ldl", "t,o(b)", 0x68000000, 0xfc000000, LDD|WR_t|RD_b, 0, I3 },
1807{"ldl", "t,A(b)", 0, (int) M_LDL_AB, INSN_MACRO, 0, I3 },
1808{"ldr", "t,o(b)", 0x6c000000, 0xfc000000, LDD|WR_t|RD_b, 0, I3 },
1809{"ldr", "t,A(b)", 0, (int) M_LDR_AB, INSN_MACRO, 0, I3 },
1810{"ldxc1", "D,t(b)", 0x4c000001, 0xfc00f83f, LDD|WR_D|RD_t|RD_b|FP_D, 0, I4|I33 },
1811{"lh", "t,o(b)", 0x84000000, 0xfc000000, LDD|RD_b|WR_t, 0, I1 },
1812{"lh", "t,A(b)", 0, (int) M_LH_AB, INSN_MACRO, 0, I1 },
1813{"lhu", "t,o(b)", 0x94000000, 0xfc000000, LDD|RD_b|WR_t, 0, I1 },
1814{"lhu", "t,A(b)", 0, (int) M_LHU_AB, INSN_MACRO, 0, I1 },
6643d27e 1815/* li is at the start of the table. */
29490584
TS
1816{"li.d", "t,F", 0, (int) M_LI_D, INSN_MACRO, 0, I1 },
1817{"li.d", "T,L", 0, (int) M_LI_DD, INSN_MACRO, 0, I1 },
1818{"li.s", "t,f", 0, (int) M_LI_S, INSN_MACRO, 0, I1 },
1819{"li.s", "T,l", 0, (int) M_LI_SS, INSN_MACRO, 0, I1 },
1820{"ll", "t,o(b)", 0xc0000000, 0xfc000000, LDD|RD_b|WR_t, 0, I2 },
1821{"ll", "t,A(b)", 0, (int) M_LL_AB, INSN_MACRO, 0, I2 },
1822{"lld", "t,o(b)", 0xd0000000, 0xfc000000, LDD|RD_b|WR_t, 0, I3 },
1823{"lld", "t,A(b)", 0, (int) M_LLD_AB, INSN_MACRO, 0, I3 },
1824{"lui", "t,u", 0x3c000000, 0xffe00000, WR_t, 0, I1 },
1825{"luxc1", "D,t(b)", 0x4c000005, 0xfc00f83f, LDD|WR_D|RD_t|RD_b|FP_D, 0, I5|I33|N55},
1826{"lw", "t,o(b)", 0x8c000000, 0xfc000000, LDD|RD_b|WR_t, 0, I1 },
1827{"lw", "t,A(b)", 0, (int) M_LW_AB, INSN_MACRO, 0, I1 },
1828{"lwc0", "E,o(b)", 0xc0000000, 0xfc000000, CLD|RD_b|WR_CC, 0, I1 },
1829{"lwc0", "E,A(b)", 0, (int) M_LWC0_AB, INSN_MACRO, 0, I1 },
1830{"lwc1", "T,o(b)", 0xc4000000, 0xfc000000, CLD|RD_b|WR_T|FP_S, 0, I1 },
1831{"lwc1", "E,o(b)", 0xc4000000, 0xfc000000, CLD|RD_b|WR_T|FP_S, 0, I1 },
1832{"lwc1", "T,A(b)", 0, (int) M_LWC1_AB, INSN_MACRO, 0, I1 },
1833{"lwc1", "E,A(b)", 0, (int) M_LWC1_AB, INSN_MACRO, 0, I1 },
1834{"l.s", "T,o(b)", 0xc4000000, 0xfc000000, CLD|RD_b|WR_T|FP_S, 0, I1 }, /* lwc1 */
1835{"l.s", "T,A(b)", 0, (int) M_LWC1_AB, INSN_MACRO, 0, I1 },
1836{"lwc2", "E,o(b)", 0xc8000000, 0xfc000000, CLD|RD_b|WR_CC, 0, I1 },
1837{"lwc2", "E,A(b)", 0, (int) M_LWC2_AB, INSN_MACRO, 0, I1 },
1838{"lwc3", "E,o(b)", 0xcc000000, 0xfc000000, CLD|RD_b|WR_CC, 0, I1 },
1839{"lwc3", "E,A(b)", 0, (int) M_LWC3_AB, INSN_MACRO, 0, I1 },
1840{"lwl", "t,o(b)", 0x88000000, 0xfc000000, LDD|RD_b|WR_t, 0, I1 },
1841{"lwl", "t,A(b)", 0, (int) M_LWL_AB, INSN_MACRO, 0, I1 },
1842{"lcache", "t,o(b)", 0x88000000, 0xfc000000, LDD|RD_b|WR_t, 0, I2 }, /* same */
1843{"lcache", "t,A(b)", 0, (int) M_LWL_AB, INSN_MACRO, 0, I2 }, /* as lwl */
1844{"lwr", "t,o(b)", 0x98000000, 0xfc000000, LDD|RD_b|WR_t, 0, I1 },
1845{"lwr", "t,A(b)", 0, (int) M_LWR_AB, INSN_MACRO, 0, I1 },
1846{"flush", "t,o(b)", 0x98000000, 0xfc000000, LDD|RD_b|WR_t, 0, I2 }, /* same */
1847{"flush", "t,A(b)", 0, (int) M_LWR_AB, INSN_MACRO, 0, I2 }, /* as lwr */
1848{"fork", "d,s,t", 0x7c000008, 0xfc0007ff, TRAP|WR_d|RD_s|RD_t, 0, MT32 },
1849{"lwu", "t,o(b)", 0x9c000000, 0xfc000000, LDD|RD_b|WR_t, 0, I3 },
1850{"lwu", "t,A(b)", 0, (int) M_LWU_AB, INSN_MACRO, 0, I3 },
1851{"lwxc1", "D,t(b)", 0x4c000000, 0xfc00f83f, LDD|WR_D|RD_t|RD_b|FP_D, 0, I4|I33 },
1852{"lwxs", "d,t(b)", 0x70000088, 0xfc0007ff, LDD|RD_b|RD_t|WR_d, 0, SMT },
1853{"macc", "d,s,t", 0x00000028, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, 0, N412 },
1854{"macc", "d,s,t", 0x00000158, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, 0, N5 },
1855{"maccs", "d,s,t", 0x00000428, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, 0, N412 },
1856{"macchi", "d,s,t", 0x00000228, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, 0, N412 },
1857{"macchi", "d,s,t", 0x00000358, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, 0, N5 },
1858{"macchis", "d,s,t", 0x00000628, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, 0, N412 },
1859{"macchiu", "d,s,t", 0x00000268, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, 0, N412 },
1860{"macchiu", "d,s,t", 0x00000359, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, 0, N5 },
1861{"macchius","d,s,t", 0x00000668, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, 0, N412 },
1862{"maccu", "d,s,t", 0x00000068, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, 0, N412 },
1863{"maccu", "d,s,t", 0x00000159, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, 0, N5 },
1864{"maccus", "d,s,t", 0x00000468, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, 0, N412 },
1865{"mad", "s,t", 0x70000000, 0xfc00ffff, RD_s|RD_t|MOD_HILO, 0, P3 },
1866{"madu", "s,t", 0x70000001, 0xfc00ffff, RD_s|RD_t|MOD_HILO, 0, P3 },
1867{"madd.d", "D,R,S,T", 0x4c000021, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, 0, I4|I33 },
1868{"madd.s", "D,R,S,T", 0x4c000020, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_S, 0, I4|I33 },
1869{"madd.ps", "D,R,S,T", 0x4c000026, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, 0, I5|I33 },
1870{"madd", "s,t", 0x0000001c, 0xfc00ffff, RD_s|RD_t|WR_HILO, 0, L1 },
1871{"madd", "s,t", 0x70000000, 0xfc00ffff, RD_s|RD_t|MOD_HILO, 0, I32|N55 },
1872{"madd", "s,t", 0x70000000, 0xfc00ffff, RD_s|RD_t|WR_HILO|IS_M, 0, G1 },
1873{"madd", "7,s,t", 0x70000000, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D33 },
1874{"madd", "d,s,t", 0x70000000, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d|IS_M, 0, G1 },
1875{"maddp", "s,t", 0x70000441, 0xfc00ffff, RD_s|RD_t|MOD_HILO, 0, SMT },
1876{"maddu", "s,t", 0x0000001d, 0xfc00ffff, RD_s|RD_t|WR_HILO, 0, L1 },
1877{"maddu", "s,t", 0x70000001, 0xfc00ffff, RD_s|RD_t|MOD_HILO, 0, I32|N55 },
1878{"maddu", "s,t", 0x70000001, 0xfc00ffff, RD_s|RD_t|WR_HILO|IS_M, 0, G1 },
1879{"maddu", "7,s,t", 0x70000001, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D33 },
1880{"maddu", "d,s,t", 0x70000001, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d|IS_M, 0, G1 },
1881{"madd16", "s,t", 0x00000028, 0xfc00ffff, RD_s|RD_t|MOD_HILO, 0, N411 },
1882{"max.ob", "X,Y,Q", 0x78000007, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX|SB1 },
1883{"max.ob", "D,S,T", 0x4ac00007, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },
1884{"max.ob", "D,S,T[e]", 0x48000007, 0xfe20003f, WR_D|RD_S|RD_T, 0, N54 },
1885{"max.ob", "D,S,k", 0x4bc00007, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },
1886{"max.qh", "X,Y,Q", 0x78200007, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX },
1887{"mfpc", "t,P", 0x4000c801, 0xffe0ffc1, LCD|WR_t|RD_C0, 0, M1|N5 },
1888{"mfps", "t,P", 0x4000c800, 0xffe0ffc1, LCD|WR_t|RD_C0, 0, M1|N5 },
1889{"mftacx", "d", 0x41020021, 0xffff07ff, TRAP|WR_d|RD_a, 0, MT32 },
1890{"mftacx", "d,*", 0x41020021, 0xfff307ff, TRAP|WR_d|RD_a, 0, MT32 },
1891{"mftc0", "d,+t", 0x41000000, 0xffe007ff, TRAP|LCD|WR_d|RD_C0, 0, MT32 },
1892{"mftc0", "d,+T", 0x41000000, 0xffe007f8, TRAP|LCD|WR_d|RD_C0, 0, MT32 },
1893{"mftc0", "d,E,H", 0x41000000, 0xffe007f8, TRAP|LCD|WR_d|RD_C0, 0, MT32 },
1894{"mftc1", "d,T", 0x41000022, 0xffe007ff, TRAP|LCD|WR_d|RD_T|FP_S, 0, MT32 },
1895{"mftc1", "d,E", 0x41000022, 0xffe007ff, TRAP|LCD|WR_d|RD_T|FP_S, 0, MT32 },
1896{"mftc2", "d,E", 0x41000024, 0xffe007ff, TRAP|LCD|WR_d|RD_C2, 0, MT32 },
1897{"mftdsp", "d", 0x41100021, 0xffff07ff, TRAP|WR_d, 0, MT32 },
1898{"mftgpr", "d,t", 0x41000020, 0xffe007ff, TRAP|WR_d|RD_t, 0, MT32 },
1899{"mfthc1", "d,T", 0x41000032, 0xffe007ff, TRAP|LCD|WR_d|RD_T|FP_D, 0, MT32 },
1900{"mfthc1", "d,E", 0x41000032, 0xffe007ff, TRAP|LCD|WR_d|RD_T|FP_D, 0, MT32 },
1901{"mfthc2", "d,E", 0x41000034, 0xffe007ff, TRAP|LCD|WR_d|RD_C2, 0, MT32 },
1902{"mfthi", "d", 0x41010021, 0xffff07ff, TRAP|WR_d|RD_a, 0, MT32 },
1903{"mfthi", "d,*", 0x41010021, 0xfff307ff, TRAP|WR_d|RD_a, 0, MT32 },
1904{"mftlo", "d", 0x41000021, 0xffff07ff, TRAP|WR_d|RD_a, 0, MT32 },
1905{"mftlo", "d,*", 0x41000021, 0xfff307ff, TRAP|WR_d|RD_a, 0, MT32 },
1906{"mftr", "d,t,!,H,$", 0x41000000, 0xffe007c8, TRAP|WR_d, 0, MT32 },
1907{"mfc0", "t,G", 0x40000000, 0xffe007ff, LCD|WR_t|RD_C0, 0, I1 },
1908{"mfc0", "t,+D", 0x40000000, 0xffe007f8, LCD|WR_t|RD_C0, 0, I32 },
1909{"mfc0", "t,G,H", 0x40000000, 0xffe007f8, LCD|WR_t|RD_C0, 0, I32 },
1910{"mfc1", "t,S", 0x44000000, 0xffe007ff, LCD|WR_t|RD_S|FP_S, 0, I1 },
1911{"mfc1", "t,G", 0x44000000, 0xffe007ff, LCD|WR_t|RD_S|FP_S, 0, I1 },
1912{"mfhc1", "t,S", 0x44600000, 0xffe007ff, LCD|WR_t|RD_S|FP_D, 0, I33 },
1913{"mfhc1", "t,G", 0x44600000, 0xffe007ff, LCD|WR_t|RD_S|FP_D, 0, I33 },
6643d27e
FB
1914/* mfc2 is at the bottom of the table. */
1915/* mfhc2 is at the bottom of the table. */
29490584
TS
1916/* mfc3 is at the bottom of the table. */
1917{"mfdr", "t,G", 0x7000003d, 0xffe007ff, LCD|WR_t|RD_C0, 0, N5 },
1918{"mfhi", "d", 0x00000010, 0xffff07ff, WR_d|RD_HI, 0, I1 },
1919{"mfhi", "d,9", 0x00000010, 0xff9f07ff, WR_d|RD_HI, 0, D32 },
1920{"mflo", "d", 0x00000012, 0xffff07ff, WR_d|RD_LO, 0, I1 },
1921{"mflo", "d,9", 0x00000012, 0xff9f07ff, WR_d|RD_LO, 0, D32 },
1922{"mflhxu", "d", 0x00000052, 0xffff07ff, WR_d|MOD_HILO, 0, SMT },
1923{"min.ob", "X,Y,Q", 0x78000006, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX|SB1 },
1924{"min.ob", "D,S,T", 0x4ac00006, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },
1925{"min.ob", "D,S,T[e]", 0x48000006, 0xfe20003f, WR_D|RD_S|RD_T, 0, N54 },
1926{"min.ob", "D,S,k", 0x4bc00006, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },
1927{"min.qh", "X,Y,Q", 0x78200006, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX },
1928{"mov.d", "D,S", 0x46200006, 0xffff003f, WR_D|RD_S|FP_D, 0, I1 },
1929{"mov.s", "D,S", 0x46000006, 0xffff003f, WR_D|RD_S|FP_S, 0, I1 },
1930{"mov.ps", "D,S", 0x46c00006, 0xffff003f, WR_D|RD_S|FP_D, 0, I5|I33 },
1931{"movf", "d,s,N", 0x00000001, 0xfc0307ff, WR_d|RD_s|RD_CC|FP_S|FP_D, 0, I4|I32 },
1932{"movf.d", "D,S,N", 0x46200011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D, 0, I4|I32 },
1933{"movf.l", "D,S,N", 0x46a00011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D, 0, MX|SB1 },
1934{"movf.l", "X,Y,N", 0x46a00011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D, 0, MX|SB1 },
1935{"movf.s", "D,S,N", 0x46000011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_S, 0, I4|I32 },
1936{"movf.ps", "D,S,N", 0x46c00011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D, 0, I5|I33 },
1937{"movn", "d,v,t", 0x0000000b, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I4|I32 },
1938{"ffc", "d,v", 0x0000000b, 0xfc1f07ff, WR_d|RD_s, 0, L1 },
1939{"movn.d", "D,S,t", 0x46200013, 0xffe0003f, WR_D|RD_S|RD_t|FP_D, 0, I4|I32 },
1940{"movn.l", "D,S,t", 0x46a00013, 0xffe0003f, WR_D|RD_S|RD_t|FP_D, 0, MX|SB1 },
1941{"movn.l", "X,Y,t", 0x46a00013, 0xffe0003f, WR_D|RD_S|RD_t|FP_D, 0, MX|SB1 },
1942{"movn.s", "D,S,t", 0x46000013, 0xffe0003f, WR_D|RD_S|RD_t|FP_S, 0, I4|I32 },
1943{"movn.ps", "D,S,t", 0x46c00013, 0xffe0003f, WR_D|RD_S|RD_t|FP_D, 0, I5|I33 },
1944{"movt", "d,s,N", 0x00010001, 0xfc0307ff, WR_d|RD_s|RD_CC|FP_S|FP_D, 0, I4|I32 },
1945{"movt.d", "D,S,N", 0x46210011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D, 0, I4|I32 },
1946{"movt.l", "D,S,N", 0x46a10011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D, 0, MX|SB1 },
1947{"movt.l", "X,Y,N", 0x46a10011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D, 0, MX|SB1 },
1948{"movt.s", "D,S,N", 0x46010011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_S, 0, I4|I32 },
1949{"movt.ps", "D,S,N", 0x46c10011, 0xffe3003f, WR_D|RD_S|RD_CC|FP_D, 0, I5|I33 },
1950{"movz", "d,v,t", 0x0000000a, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I4|I32 },
1951{"ffs", "d,v", 0x0000000a, 0xfc1f07ff, WR_d|RD_s, 0, L1 },
1952{"movz.d", "D,S,t", 0x46200012, 0xffe0003f, WR_D|RD_S|RD_t|FP_D, 0, I4|I32 },
1953{"movz.l", "D,S,t", 0x46a00012, 0xffe0003f, WR_D|RD_S|RD_t|FP_D, 0, MX|SB1 },
1954{"movz.l", "X,Y,t", 0x46a00012, 0xffe0003f, WR_D|RD_S|RD_t|FP_D, 0, MX|SB1 },
1955{"movz.s", "D,S,t", 0x46000012, 0xffe0003f, WR_D|RD_S|RD_t|FP_S, 0, I4|I32 },
1956{"movz.ps", "D,S,t", 0x46c00012, 0xffe0003f, WR_D|RD_S|RD_t|FP_D, 0, I5|I33 },
1957{"msac", "d,s,t", 0x000001d8, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, 0, N5 },
1958{"msacu", "d,s,t", 0x000001d9, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, 0, N5 },
1959{"msachi", "d,s,t", 0x000003d8, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, 0, N5 },
1960{"msachiu", "d,s,t", 0x000003d9, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, 0, N5 },
6643d27e 1961/* move is at the top of the table. */
29490584
TS
1962{"msgn.qh", "X,Y,Q", 0x78200000, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX },
1963{"msub.d", "D,R,S,T", 0x4c000029, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, 0, I4|I33 },
1964{"msub.s", "D,R,S,T", 0x4c000028, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_S, 0, I4|I33 },
1965{"msub.ps", "D,R,S,T", 0x4c00002e, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, 0, I5|I33 },
1966{"msub", "s,t", 0x0000001e, 0xfc00ffff, RD_s|RD_t|WR_HILO, 0, L1 },
1967{"msub", "s,t", 0x70000004, 0xfc00ffff, RD_s|RD_t|MOD_HILO, 0, I32|N55 },
1968{"msub", "7,s,t", 0x70000004, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D33 },
1969{"msubu", "s,t", 0x0000001f, 0xfc00ffff, RD_s|RD_t|WR_HILO, 0, L1 },
1970{"msubu", "s,t", 0x70000005, 0xfc00ffff, RD_s|RD_t|MOD_HILO, 0, I32|N55 },
1971{"msubu", "7,s,t", 0x70000005, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D33 },
1972{"mtpc", "t,P", 0x4080c801, 0xffe0ffc1, COD|RD_t|WR_C0, 0, M1|N5 },
1973{"mtps", "t,P", 0x4080c800, 0xffe0ffc1, COD|RD_t|WR_C0, 0, M1|N5 },
1974{"mtc0", "t,G", 0x40800000, 0xffe007ff, COD|RD_t|WR_C0|WR_CC, 0, I1 },
1975{"mtc0", "t,+D", 0x40800000, 0xffe007f8, COD|RD_t|WR_C0|WR_CC, 0, I32 },
1976{"mtc0", "t,G,H", 0x40800000, 0xffe007f8, COD|RD_t|WR_C0|WR_CC, 0, I32 },
1977{"mtc1", "t,S", 0x44800000, 0xffe007ff, COD|RD_t|WR_S|FP_S, 0, I1 },
1978{"mtc1", "t,G", 0x44800000, 0xffe007ff, COD|RD_t|WR_S|FP_S, 0, I1 },
1979{"mthc1", "t,S", 0x44e00000, 0xffe007ff, COD|RD_t|WR_S|FP_D, 0, I33 },
1980{"mthc1", "t,G", 0x44e00000, 0xffe007ff, COD|RD_t|WR_S|FP_D, 0, I33 },
6643d27e
FB
1981/* mtc2 is at the bottom of the table. */
1982/* mthc2 is at the bottom of the table. */
29490584
TS
1983/* mtc3 is at the bottom of the table. */
1984{"mtdr", "t,G", 0x7080003d, 0xffe007ff, COD|RD_t|WR_C0, 0, N5 },
1985{"mthi", "s", 0x00000011, 0xfc1fffff, RD_s|WR_HI, 0, I1 },
1986{"mthi", "s,7", 0x00000011, 0xfc1fe7ff, RD_s|WR_HI, 0, D32 },
1987{"mtlo", "s", 0x00000013, 0xfc1fffff, RD_s|WR_LO, 0, I1 },
1988{"mtlo", "s,7", 0x00000013, 0xfc1fe7ff, RD_s|WR_LO, 0, D32 },
1989{"mtlhx", "s", 0x00000053, 0xfc1fffff, RD_s|MOD_HILO, 0, SMT },
1990{"mttc0", "t,G", 0x41800000, 0xffe007ff, TRAP|COD|RD_t|WR_C0|WR_CC, 0, MT32 },
1991{"mttc0", "t,+D", 0x41800000, 0xffe007f8, TRAP|COD|RD_t|WR_C0|WR_CC, 0, MT32 },
1992{"mttc0", "t,G,H", 0x41800000, 0xffe007f8, TRAP|COD|RD_t|WR_C0|WR_CC, 0, MT32 },
1993{"mttc1", "t,S", 0x41800022, 0xffe007ff, TRAP|COD|RD_t|WR_S|FP_S, 0, MT32 },
1994{"mttc1", "t,G", 0x41800022, 0xffe007ff, TRAP|COD|RD_t|WR_S|FP_S, 0, MT32 },
1995{"mttc2", "t,g", 0x41800024, 0xffe007ff, TRAP|COD|RD_t|WR_C2|WR_CC, 0, MT32 },
1996{"mttacx", "t", 0x41801021, 0xffe0ffff, TRAP|WR_a|RD_t, 0, MT32 },
1997{"mttacx", "t,&", 0x41801021, 0xffe09fff, TRAP|WR_a|RD_t, 0, MT32 },
1998{"mttdsp", "t", 0x41808021, 0xffe0ffff, TRAP|RD_t, 0, MT32 },
1999{"mttgpr", "t,d", 0x41800020, 0xffe007ff, TRAP|WR_d|RD_t, 0, MT32 },
2000{"mtthc1", "t,S", 0x41800032, 0xffe007ff, TRAP|COD|RD_t|WR_S|FP_D, 0, MT32 },
2001{"mtthc1", "t,G", 0x41800032, 0xffe007ff, TRAP|COD|RD_t|WR_S|FP_D, 0, MT32 },
2002{"mtthc2", "t,g", 0x41800034, 0xffe007ff, TRAP|COD|RD_t|WR_C2|WR_CC, 0, MT32 },
2003{"mtthi", "t", 0x41800821, 0xffe0ffff, TRAP|WR_a|RD_t, 0, MT32 },
2004{"mtthi", "t,&", 0x41800821, 0xffe09fff, TRAP|WR_a|RD_t, 0, MT32 },
2005{"mttlo", "t", 0x41800021, 0xffe0ffff, TRAP|WR_a|RD_t, 0, MT32 },
2006{"mttlo", "t,&", 0x41800021, 0xffe09fff, TRAP|WR_a|RD_t, 0, MT32 },
2007{"mttr", "t,d,!,H,$", 0x41800000, 0xffe007c8, TRAP|RD_t, 0, MT32 },
2008{"mul.d", "D,V,T", 0x46200002, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, 0, I1 },
2009{"mul.s", "D,V,T", 0x46000002, 0xffe0003f, WR_D|RD_S|RD_T|FP_S, 0, I1 },
2010{"mul.ob", "X,Y,Q", 0x78000030, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX|SB1 },
2011{"mul.ob", "D,S,T", 0x4ac00030, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },
2012{"mul.ob", "D,S,T[e]", 0x48000030, 0xfe20003f, WR_D|RD_S|RD_T, 0, N54 },
2013{"mul.ob", "D,S,k", 0x4bc00030, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },
2014{"mul.ps", "D,V,T", 0x46c00002, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, 0, I5|I33 },
2015{"mul.qh", "X,Y,Q", 0x78200030, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX },
2016{"mul", "d,v,t", 0x70000002, 0xfc0007ff, WR_d|RD_s|RD_t|WR_HILO, 0, I32|P3|N55},
2017{"mul", "d,s,t", 0x00000058, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, 0, N54 },
2018{"mul", "d,v,t", 0, (int) M_MUL, INSN_MACRO, 0, I1 },
2019{"mul", "d,v,I", 0, (int) M_MUL_I, INSN_MACRO, 0, I1 },
2020{"mula.ob", "Y,Q", 0x78000033, 0xfc2007ff, RD_S|RD_T|FP_D, WR_MACC, MX|SB1 },
2021{"mula.ob", "S,T", 0x4ac00033, 0xffe007ff, WR_CC|RD_S|RD_T, 0, N54 },
2022{"mula.ob", "S,T[e]", 0x48000033, 0xfe2007ff, WR_CC|RD_S|RD_T, 0, N54 },
2023{"mula.ob", "S,k", 0x4bc00033, 0xffe007ff, WR_CC|RD_S|RD_T, 0, N54 },
2024{"mula.qh", "Y,Q", 0x78200033, 0xfc2007ff, RD_S|RD_T|FP_D, WR_MACC, MX },
2025{"mulhi", "d,s,t", 0x00000258, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, 0, N5 },
2026{"mulhiu", "d,s,t", 0x00000259, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, 0, N5 },
2027{"mull.ob", "Y,Q", 0x78000433, 0xfc2007ff, RD_S|RD_T|FP_D, WR_MACC, MX|SB1 },
2028{"mull.ob", "S,T", 0x4ac00433, 0xffe007ff, WR_CC|RD_S|RD_T, 0, N54 },
2029{"mull.ob", "S,T[e]", 0x48000433, 0xfe2007ff, WR_CC|RD_S|RD_T, 0, N54 },
2030{"mull.ob", "S,k", 0x4bc00433, 0xffe007ff, WR_CC|RD_S|RD_T, 0, N54 },
2031{"mull.qh", "Y,Q", 0x78200433, 0xfc2007ff, RD_S|RD_T|FP_D, WR_MACC, MX },
2032{"mulo", "d,v,t", 0, (int) M_MULO, INSN_MACRO, 0, I1 },
2033{"mulo", "d,v,I", 0, (int) M_MULO_I, INSN_MACRO, 0, I1 },
2034{"mulou", "d,v,t", 0, (int) M_MULOU, INSN_MACRO, 0, I1 },
2035{"mulou", "d,v,I", 0, (int) M_MULOU_I, INSN_MACRO, 0, I1 },
2036{"mulr.ps", "D,S,T", 0x46c0001a, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, 0, M3D },
2037{"muls", "d,s,t", 0x000000d8, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, 0, N5 },
2038{"mulsu", "d,s,t", 0x000000d9, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, 0, N5 },
2039{"mulshi", "d,s,t", 0x000002d8, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, 0, N5 },
2040{"mulshiu", "d,s,t", 0x000002d9, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, 0, N5 },
2041{"muls.ob", "Y,Q", 0x78000032, 0xfc2007ff, RD_S|RD_T|FP_D, WR_MACC, MX|SB1 },
2042{"muls.ob", "S,T", 0x4ac00032, 0xffe007ff, WR_CC|RD_S|RD_T, 0, N54 },
2043{"muls.ob", "S,T[e]", 0x48000032, 0xfe2007ff, WR_CC|RD_S|RD_T, 0, N54 },
2044{"muls.ob", "S,k", 0x4bc00032, 0xffe007ff, WR_CC|RD_S|RD_T, 0, N54 },
2045{"muls.qh", "Y,Q", 0x78200032, 0xfc2007ff, RD_S|RD_T|FP_D, WR_MACC, MX },
2046{"mulsl.ob", "Y,Q", 0x78000432, 0xfc2007ff, RD_S|RD_T|FP_D, WR_MACC, MX|SB1 },
2047{"mulsl.ob", "S,T", 0x4ac00432, 0xffe007ff, WR_CC|RD_S|RD_T, 0, N54 },
2048{"mulsl.ob", "S,T[e]", 0x48000432, 0xfe2007ff, WR_CC|RD_S|RD_T, 0, N54 },
2049{"mulsl.ob", "S,k", 0x4bc00432, 0xffe007ff, WR_CC|RD_S|RD_T, 0, N54 },
2050{"mulsl.qh", "Y,Q", 0x78200432, 0xfc2007ff, RD_S|RD_T|FP_D, WR_MACC, MX },
2051{"mult", "s,t", 0x00000018, 0xfc00ffff, RD_s|RD_t|WR_HILO|IS_M, 0, I1 },
2052{"mult", "7,s,t", 0x00000018, 0xfc00e7ff, WR_a|RD_s|RD_t, 0, D33 },
2053{"mult", "d,s,t", 0x00000018, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d|IS_M, 0, G1 },
2054{"multp", "s,t", 0x00000459, 0xfc00ffff, RD_s|RD_t|MOD_HILO, 0, SMT },
2055{"multu", "s,t", 0x00000019, 0xfc00ffff, RD_s|RD_t|WR_HILO|IS_M, 0, I1 },
2056{"multu", "7,s,t", 0x00000019, 0xfc00e7ff, WR_a|RD_s|RD_t, 0, D33 },
2057{"multu", "d,s,t", 0x00000019, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d|IS_M, 0, G1 },
2058{"mulu", "d,s,t", 0x00000059, 0xfc0007ff, RD_s|RD_t|WR_HILO|WR_d, 0, N5 },
2059{"neg", "d,w", 0x00000022, 0xffe007ff, WR_d|RD_t, 0, I1 }, /* sub 0 */
2060{"negu", "d,w", 0x00000023, 0xffe007ff, WR_d|RD_t, 0, I1 }, /* subu 0 */
2061{"neg.d", "D,V", 0x46200007, 0xffff003f, WR_D|RD_S|FP_D, 0, I1 },
2062{"neg.s", "D,V", 0x46000007, 0xffff003f, WR_D|RD_S|FP_S, 0, I1 },
2063{"neg.ps", "D,V", 0x46c00007, 0xffff003f, WR_D|RD_S|FP_D, 0, I5|I33 },
2064{"nmadd.d", "D,R,S,T", 0x4c000031, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, 0, I4|I33 },
2065{"nmadd.s", "D,R,S,T", 0x4c000030, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_S, 0, I4|I33 },
2066{"nmadd.ps","D,R,S,T", 0x4c000036, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, 0, I5|I33 },
2067{"nmsub.d", "D,R,S,T", 0x4c000039, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, 0, I4|I33 },
2068{"nmsub.s", "D,R,S,T", 0x4c000038, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_S, 0, I4|I33 },
2069{"nmsub.ps","D,R,S,T", 0x4c00003e, 0xfc00003f, RD_R|RD_S|RD_T|WR_D|FP_D, 0, I5|I33 },
6643d27e 2070/* nop is at the start of the table. */
29490584
TS
2071{"nor", "d,v,t", 0x00000027, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I1 },
2072{"nor", "t,r,I", 0, (int) M_NOR_I, INSN_MACRO, 0, I1 },
2073{"nor.ob", "X,Y,Q", 0x7800000f, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX|SB1 },
2074{"nor.ob", "D,S,T", 0x4ac0000f, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },
2075{"nor.ob", "D,S,T[e]", 0x4800000f, 0xfe20003f, WR_D|RD_S|RD_T, 0, N54 },
2076{"nor.ob", "D,S,k", 0x4bc0000f, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },
2077{"nor.qh", "X,Y,Q", 0x7820000f, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX },
2078{"not", "d,v", 0x00000027, 0xfc1f07ff, WR_d|RD_s|RD_t, 0, I1 },/*nor d,s,0*/
2079{"or", "d,v,t", 0x00000025, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I1 },
2080{"or", "t,r,I", 0, (int) M_OR_I, INSN_MACRO, 0, I1 },
2081{"or.ob", "X,Y,Q", 0x7800000e, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX|SB1 },
2082{"or.ob", "D,S,T", 0x4ac0000e, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },
2083{"or.ob", "D,S,T[e]", 0x4800000e, 0xfe20003f, WR_D|RD_S|RD_T, 0, N54 },
2084{"or.ob", "D,S,k", 0x4bc0000e, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },
2085{"or.qh", "X,Y,Q", 0x7820000e, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX },
2086{"ori", "t,r,i", 0x34000000, 0xfc000000, WR_t|RD_s, 0, I1 },
2087{"pabsdiff.ob", "X,Y,Q",0x78000009, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, SB1 },
2088{"pabsdiffc.ob", "Y,Q", 0x78000035, 0xfc2007ff, RD_S|RD_T|FP_D, WR_MACC, SB1 },
2089{"pavg.ob", "X,Y,Q", 0x78000008, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, SB1 },
2090{"pickf.ob", "X,Y,Q", 0x78000002, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX|SB1 },
2091{"pickf.ob", "D,S,T", 0x4ac00002, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },
2092{"pickf.ob", "D,S,T[e]",0x48000002, 0xfe20003f, WR_D|RD_S|RD_T, 0, N54 },
2093{"pickf.ob", "D,S,k", 0x4bc00002, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },
2094{"pickf.qh", "X,Y,Q", 0x78200002, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX },
2095{"pickt.ob", "X,Y,Q", 0x78000003, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX|SB1 },
2096{"pickt.ob", "D,S,T", 0x4ac00003, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },
2097{"pickt.ob", "D,S,T[e]",0x48000003, 0xfe20003f, WR_D|RD_S|RD_T, 0, N54 },
2098{"pickt.ob", "D,S,k", 0x4bc00003, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },
2099{"pickt.qh", "X,Y,Q", 0x78200003, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX },
2100{"pll.ps", "D,V,T", 0x46c0002c, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, 0, I5|I33 },
2101{"plu.ps", "D,V,T", 0x46c0002d, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, 0, I5|I33 },
6643d27e 2102 /* pref and prefx are at the start of the table. */
29490584
TS
2103{"pul.ps", "D,V,T", 0x46c0002e, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, 0, I5|I33 },
2104{"puu.ps", "D,V,T", 0x46c0002f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, 0, I5|I33 },
2105{"pperm", "s,t", 0x70000481, 0xfc00ffff, MOD_HILO|RD_s|RD_t, 0, SMT },
2106{"rach.ob", "X", 0x7a00003f, 0xfffff83f, WR_D|FP_D, RD_MACC, MX|SB1 },
2107{"rach.ob", "D", 0x4a00003f, 0xfffff83f, WR_D, 0, N54 },
2108{"rach.qh", "X", 0x7a20003f, 0xfffff83f, WR_D|FP_D, RD_MACC, MX },
2109{"racl.ob", "X", 0x7800003f, 0xfffff83f, WR_D|FP_D, RD_MACC, MX|SB1 },
2110{"racl.ob", "D", 0x4800003f, 0xfffff83f, WR_D, 0, N54 },
2111{"racl.qh", "X", 0x7820003f, 0xfffff83f, WR_D|FP_D, RD_MACC, MX },
2112{"racm.ob", "X", 0x7900003f, 0xfffff83f, WR_D|FP_D, RD_MACC, MX|SB1 },
2113{"racm.ob", "D", 0x4900003f, 0xfffff83f, WR_D, 0, N54 },
2114{"racm.qh", "X", 0x7920003f, 0xfffff83f, WR_D|FP_D, RD_MACC, MX },
2115{"recip.d", "D,S", 0x46200015, 0xffff003f, WR_D|RD_S|FP_D, 0, I4|I33 },
2116{"recip.ps","D,S", 0x46c00015, 0xffff003f, WR_D|RD_S|FP_D, 0, SB1 },
2117{"recip.s", "D,S", 0x46000015, 0xffff003f, WR_D|RD_S|FP_S, 0, I4|I33 },
2118{"recip1.d", "D,S", 0x4620001d, 0xffff003f, WR_D|RD_S|FP_D, 0, M3D },
2119{"recip1.ps", "D,S", 0x46c0001d, 0xffff003f, WR_D|RD_S|FP_S, 0, M3D },
2120{"recip1.s", "D,S", 0x4600001d, 0xffff003f, WR_D|RD_S|FP_S, 0, M3D },
2121{"recip2.d", "D,S,T", 0x4620001c, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, 0, M3D },
2122{"recip2.ps", "D,S,T", 0x46c0001c, 0xffe0003f, WR_D|RD_S|RD_T|FP_S, 0, M3D },
2123{"recip2.s", "D,S,T", 0x4600001c, 0xffe0003f, WR_D|RD_S|RD_T|FP_S, 0, M3D },
2124{"rem", "z,s,t", 0x0000001a, 0xfc00ffff, RD_s|RD_t|WR_HILO, 0, I1 },
2125{"rem", "d,v,t", 0, (int) M_REM_3, INSN_MACRO, 0, I1 },
2126{"rem", "d,v,I", 0, (int) M_REM_3I, INSN_MACRO, 0, I1 },
2127{"remu", "z,s,t", 0x0000001b, 0xfc00ffff, RD_s|RD_t|WR_HILO, 0, I1 },
2128{"remu", "d,v,t", 0, (int) M_REMU_3, INSN_MACRO, 0, I1 },
2129{"remu", "d,v,I", 0, (int) M_REMU_3I, INSN_MACRO, 0, I1 },
2130{"rdhwr", "t,K", 0x7c00003b, 0xffe007ff, WR_t, 0, I33 },
2131{"rdpgpr", "d,w", 0x41400000, 0xffe007ff, WR_d, 0, I33 },
2132{"rfe", "", 0x42000010, 0xffffffff, 0, 0, I1|T3 },
2133{"rnas.qh", "X,Q", 0x78200025, 0xfc20f83f, WR_D|RD_T|FP_D, RD_MACC, MX },
2134{"rnau.ob", "X,Q", 0x78000021, 0xfc20f83f, WR_D|RD_T|FP_D, RD_MACC, MX|SB1 },
2135{"rnau.qh", "X,Q", 0x78200021, 0xfc20f83f, WR_D|RD_T|FP_D, RD_MACC, MX },
2136{"rnes.qh", "X,Q", 0x78200026, 0xfc20f83f, WR_D|RD_T|FP_D, RD_MACC, MX },
2137{"rneu.ob", "X,Q", 0x78000022, 0xfc20f83f, WR_D|RD_T|FP_D, RD_MACC, MX|SB1 },
2138{"rneu.qh", "X,Q", 0x78200022, 0xfc20f83f, WR_D|RD_T|FP_D, RD_MACC, MX },
2139{"rol", "d,v,t", 0, (int) M_ROL, INSN_MACRO, 0, I1 },
2140{"rol", "d,v,I", 0, (int) M_ROL_I, INSN_MACRO, 0, I1 },
2141{"ror", "d,v,t", 0, (int) M_ROR, INSN_MACRO, 0, I1 },
2142{"ror", "d,v,I", 0, (int) M_ROR_I, INSN_MACRO, 0, I1 },
2143{"ror", "d,w,<", 0x00200002, 0xffe0003f, WR_d|RD_t, 0, N5|I33|SMT },
2144{"rorv", "d,t,s", 0x00000046, 0xfc0007ff, RD_t|RD_s|WR_d, 0, N5|I33|SMT },
2145{"rotl", "d,v,t", 0, (int) M_ROL, INSN_MACRO, 0, I33|SMT },
2146{"rotl", "d,v,I", 0, (int) M_ROL_I, INSN_MACRO, 0, I33|SMT },
2147{"rotr", "d,v,t", 0, (int) M_ROR, INSN_MACRO, 0, I33|SMT },
2148{"rotr", "d,v,I", 0, (int) M_ROR_I, INSN_MACRO, 0, I33|SMT },
2149{"rotrv", "d,t,s", 0x00000046, 0xfc0007ff, RD_t|RD_s|WR_d, 0, I33|SMT },
2150{"round.l.d", "D,S", 0x46200008, 0xffff003f, WR_D|RD_S|FP_D, 0, I3|I33 },
2151{"round.l.s", "D,S", 0x46000008, 0xffff003f, WR_D|RD_S|FP_S|FP_D, 0, I3|I33 },
2152{"round.w.d", "D,S", 0x4620000c, 0xffff003f, WR_D|RD_S|FP_S|FP_D, 0, I2 },
2153{"round.w.s", "D,S", 0x4600000c, 0xffff003f, WR_D|RD_S|FP_S, 0, I2 },
2154{"rsqrt.d", "D,S", 0x46200016, 0xffff003f, WR_D|RD_S|FP_D, 0, I4|I33 },
2155{"rsqrt.ps","D,S", 0x46c00016, 0xffff003f, WR_D|RD_S|FP_D, 0, SB1 },
2156{"rsqrt.s", "D,S", 0x46000016, 0xffff003f, WR_D|RD_S|FP_S, 0, I4|I33 },
2157{"rsqrt1.d", "D,S", 0x4620001e, 0xffff003f, WR_D|RD_S|FP_D, 0, M3D },
2158{"rsqrt1.ps", "D,S", 0x46c0001e, 0xffff003f, WR_D|RD_S|FP_S, 0, M3D },
2159{"rsqrt1.s", "D,S", 0x4600001e, 0xffff003f, WR_D|RD_S|FP_S, 0, M3D },
2160{"rsqrt2.d", "D,S,T", 0x4620001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, 0, M3D },
2161{"rsqrt2.ps", "D,S,T", 0x46c0001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_S, 0, M3D },
2162{"rsqrt2.s", "D,S,T", 0x4600001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_S, 0, M3D },
2163{"rzs.qh", "X,Q", 0x78200024, 0xfc20f83f, WR_D|RD_T|FP_D, RD_MACC, MX },
2164{"rzu.ob", "X,Q", 0x78000020, 0xfc20f83f, WR_D|RD_T|FP_D, RD_MACC, MX|SB1 },
2165{"rzu.ob", "D,k", 0x4bc00020, 0xffe0f83f, WR_D|RD_S|RD_T, 0, N54 },
2166{"rzu.qh", "X,Q", 0x78200020, 0xfc20f83f, WR_D|RD_T|FP_D, RD_MACC, MX },
2167{"sb", "t,o(b)", 0xa0000000, 0xfc000000, SM|RD_t|RD_b, 0, I1 },
2168{"sb", "t,A(b)", 0, (int) M_SB_AB, INSN_MACRO, 0, I1 },
2169{"sc", "t,o(b)", 0xe0000000, 0xfc000000, SM|RD_t|WR_t|RD_b, 0, I2 },
2170{"sc", "t,A(b)", 0, (int) M_SC_AB, INSN_MACRO, 0, I2 },
2171{"scd", "t,o(b)", 0xf0000000, 0xfc000000, SM|RD_t|WR_t|RD_b, 0, I3 },
2172{"scd", "t,A(b)", 0, (int) M_SCD_AB, INSN_MACRO, 0, I3 },
2173{"sd", "t,o(b)", 0xfc000000, 0xfc000000, SM|RD_t|RD_b, 0, I3 },
2174{"sd", "t,o(b)", 0, (int) M_SD_OB, INSN_MACRO, 0, I1 },
2175{"sd", "t,A(b)", 0, (int) M_SD_AB, INSN_MACRO, 0, I1 },
2176{"sdbbp", "", 0x0000000e, 0xffffffff, TRAP, 0, G2 },
2177{"sdbbp", "c", 0x0000000e, 0xfc00ffff, TRAP, 0, G2 },
2178{"sdbbp", "c,q", 0x0000000e, 0xfc00003f, TRAP, 0, G2 },
2179{"sdbbp", "", 0x7000003f, 0xffffffff, TRAP, 0, I32 },
2180{"sdbbp", "B", 0x7000003f, 0xfc00003f, TRAP, 0, I32 },
2181{"sdc1", "T,o(b)", 0xf4000000, 0xfc000000, SM|RD_T|RD_b|FP_D, 0, I2 },
2182{"sdc1", "E,o(b)", 0xf4000000, 0xfc000000, SM|RD_T|RD_b|FP_D, 0, I2 },
2183{"sdc1", "T,A(b)", 0, (int) M_SDC1_AB, INSN_MACRO, 0, I2 },
2184{"sdc1", "E,A(b)", 0, (int) M_SDC1_AB, INSN_MACRO, 0, I2 },
2185{"sdc2", "E,o(b)", 0xf8000000, 0xfc000000, SM|RD_C2|RD_b, 0, I2 },
2186{"sdc2", "E,A(b)", 0, (int) M_SDC2_AB, INSN_MACRO, 0, I2 },
2187{"sdc3", "E,o(b)", 0xfc000000, 0xfc000000, SM|RD_C3|RD_b, 0, I2 },
2188{"sdc3", "E,A(b)", 0, (int) M_SDC3_AB, INSN_MACRO, 0, I2 },
2189{"s.d", "T,o(b)", 0xf4000000, 0xfc000000, SM|RD_T|RD_b|FP_D, 0, I2 },
2190{"s.d", "T,o(b)", 0, (int) M_S_DOB, INSN_MACRO, 0, I1 },
2191{"s.d", "T,A(b)", 0, (int) M_S_DAB, INSN_MACRO, 0, I1 },
2192{"sdl", "t,o(b)", 0xb0000000, 0xfc000000, SM|RD_t|RD_b, 0, I3 },
2193{"sdl", "t,A(b)", 0, (int) M_SDL_AB, INSN_MACRO, 0, I3 },
2194{"sdr", "t,o(b)", 0xb4000000, 0xfc000000, SM|RD_t|RD_b, 0, I3 },
2195{"sdr", "t,A(b)", 0, (int) M_SDR_AB, INSN_MACRO, 0, I3 },
2196{"sdxc1", "S,t(b)", 0x4c000009, 0xfc0007ff, SM|RD_S|RD_t|RD_b|FP_D, 0, I4|I33 },
2197{"seb", "d,w", 0x7c000420, 0xffe007ff, WR_d|RD_t, 0, I33 },
2198{"seh", "d,w", 0x7c000620, 0xffe007ff, WR_d|RD_t, 0, I33 },
2199{"selsl", "d,v,t", 0x00000005, 0xfc0007ff, WR_d|RD_s|RD_t, 0, L1 },
2200{"selsr", "d,v,t", 0x00000001, 0xfc0007ff, WR_d|RD_s|RD_t, 0, L1 },
2201{"seq", "d,v,t", 0, (int) M_SEQ, INSN_MACRO, 0, I1 },
2202{"seq", "d,v,I", 0, (int) M_SEQ_I, INSN_MACRO, 0, I1 },
2203{"sge", "d,v,t", 0, (int) M_SGE, INSN_MACRO, 0, I1 },
2204{"sge", "d,v,I", 0, (int) M_SGE_I, INSN_MACRO, 0, I1 },
2205{"sgeu", "d,v,t", 0, (int) M_SGEU, INSN_MACRO, 0, I1 },
2206{"sgeu", "d,v,I", 0, (int) M_SGEU_I, INSN_MACRO, 0, I1 },
2207{"sgt", "d,v,t", 0, (int) M_SGT, INSN_MACRO, 0, I1 },
2208{"sgt", "d,v,I", 0, (int) M_SGT_I, INSN_MACRO, 0, I1 },
2209{"sgtu", "d,v,t", 0, (int) M_SGTU, INSN_MACRO, 0, I1 },
2210{"sgtu", "d,v,I", 0, (int) M_SGTU_I, INSN_MACRO, 0, I1 },
2211{"sh", "t,o(b)", 0xa4000000, 0xfc000000, SM|RD_t|RD_b, 0, I1 },
2212{"sh", "t,A(b)", 0, (int) M_SH_AB, INSN_MACRO, 0, I1 },
2213{"shfl.bfla.qh", "X,Y,Z", 0x7a20001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, 0, MX },
2214{"shfl.mixh.ob", "X,Y,Z", 0x7980001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, 0, MX|SB1 },
2215{"shfl.mixh.ob", "D,S,T", 0x4980001f, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },
2216{"shfl.mixh.qh", "X,Y,Z", 0x7820001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, 0, MX },
2217{"shfl.mixl.ob", "X,Y,Z", 0x79c0001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, 0, MX|SB1 },
2218{"shfl.mixl.ob", "D,S,T", 0x49c0001f, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },
2219{"shfl.mixl.qh", "X,Y,Z", 0x78a0001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, 0, MX },
2220{"shfl.pach.ob", "X,Y,Z", 0x7900001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, 0, MX|SB1 },
2221{"shfl.pach.ob", "D,S,T", 0x4900001f, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },
2222{"shfl.pach.qh", "X,Y,Z", 0x7920001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, 0, MX },
2223{"shfl.pacl.ob", "D,S,T", 0x4940001f, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },
2224{"shfl.repa.qh", "X,Y,Z", 0x7b20001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, 0, MX },
2225{"shfl.repb.qh", "X,Y,Z", 0x7ba0001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, 0, MX },
2226{"shfl.upsl.ob", "X,Y,Z", 0x78c0001f, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, 0, MX|SB1 },
2227{"sle", "d,v,t", 0, (int) M_SLE, INSN_MACRO, 0, I1 },
2228{"sle", "d,v,I", 0, (int) M_SLE_I, INSN_MACRO, 0, I1 },
2229{"sleu", "d,v,t", 0, (int) M_SLEU, INSN_MACRO, 0, I1 },
2230{"sleu", "d,v,I", 0, (int) M_SLEU_I, INSN_MACRO, 0, I1 },
2231{"sllv", "d,t,s", 0x00000004, 0xfc0007ff, WR_d|RD_t|RD_s, 0, I1 },
2232{"sll", "d,w,s", 0x00000004, 0xfc0007ff, WR_d|RD_t|RD_s, 0, I1 }, /* sllv */
2233{"sll", "d,w,<", 0x00000000, 0xffe0003f, WR_d|RD_t, 0, I1 },
2234{"sll.ob", "X,Y,Q", 0x78000010, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX|SB1 },
2235{"sll.ob", "D,S,T[e]", 0x48000010, 0xfe20003f, WR_D|RD_S|RD_T, 0, N54 },
2236{"sll.ob", "D,S,k", 0x4bc00010, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },
2237{"sll.qh", "X,Y,Q", 0x78200010, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX },
2238{"slt", "d,v,t", 0x0000002a, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I1 },
2239{"slt", "d,v,I", 0, (int) M_SLT_I, INSN_MACRO, 0, I1 },
2240{"slti", "t,r,j", 0x28000000, 0xfc000000, WR_t|RD_s, 0, I1 },
2241{"sltiu", "t,r,j", 0x2c000000, 0xfc000000, WR_t|RD_s, 0, I1 },
2242{"sltu", "d,v,t", 0x0000002b, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I1 },
2243{"sltu", "d,v,I", 0, (int) M_SLTU_I, INSN_MACRO, 0, I1 },
2244{"sne", "d,v,t", 0, (int) M_SNE, INSN_MACRO, 0, I1 },
2245{"sne", "d,v,I", 0, (int) M_SNE_I, INSN_MACRO, 0, I1 },
2246{"sqrt.d", "D,S", 0x46200004, 0xffff003f, WR_D|RD_S|FP_D, 0, I2 },
2247{"sqrt.s", "D,S", 0x46000004, 0xffff003f, WR_D|RD_S|FP_S, 0, I2 },
2248{"sqrt.ps", "D,S", 0x46c00004, 0xffff003f, WR_D|RD_S|FP_D, 0, SB1 },
2249{"srav", "d,t,s", 0x00000007, 0xfc0007ff, WR_d|RD_t|RD_s, 0, I1 },
2250{"sra", "d,w,s", 0x00000007, 0xfc0007ff, WR_d|RD_t|RD_s, 0, I1 }, /* srav */
2251{"sra", "d,w,<", 0x00000003, 0xffe0003f, WR_d|RD_t, 0, I1 },
2252{"sra.qh", "X,Y,Q", 0x78200013, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX },
2253{"srlv", "d,t,s", 0x00000006, 0xfc0007ff, WR_d|RD_t|RD_s, 0, I1 },
2254{"srl", "d,w,s", 0x00000006, 0xfc0007ff, WR_d|RD_t|RD_s, 0, I1 }, /* srlv */
2255{"srl", "d,w,<", 0x00000002, 0xffe0003f, WR_d|RD_t, 0, I1 },
2256{"srl.ob", "X,Y,Q", 0x78000012, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX|SB1 },
2257{"srl.ob", "D,S,T[e]", 0x48000012, 0xfe20003f, WR_D|RD_S|RD_T, 0, N54 },
2258{"srl.ob", "D,S,k", 0x4bc00012, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },
2259{"srl.qh", "X,Y,Q", 0x78200012, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX },
6643d27e 2260/* ssnop is at the start of the table. */
29490584
TS
2261{"standby", "", 0x42000021, 0xffffffff, 0, 0, V1 },
2262{"sub", "d,v,t", 0x00000022, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I1 },
2263{"sub", "d,v,I", 0, (int) M_SUB_I, INSN_MACRO, 0, I1 },
2264{"sub.d", "D,V,T", 0x46200001, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, 0, I1 },
2265{"sub.s", "D,V,T", 0x46000001, 0xffe0003f, WR_D|RD_S|RD_T|FP_S, 0, I1 },
2266{"sub.ob", "X,Y,Q", 0x7800000a, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX|SB1 },
2267{"sub.ob", "D,S,T", 0x4ac0000a, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },
2268{"sub.ob", "D,S,T[e]", 0x4800000a, 0xfe20003f, WR_D|RD_S|RD_T, 0, N54 },
2269{"sub.ob", "D,S,k", 0x4bc0000a, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },
2270{"sub.ps", "D,V,T", 0x46c00001, 0xffe0003f, WR_D|RD_S|RD_T|FP_D, 0, I5|I33 },
2271{"sub.qh", "X,Y,Q", 0x7820000a, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX },
2272{"suba.ob", "Y,Q", 0x78000036, 0xfc2007ff, RD_S|RD_T|FP_D, WR_MACC, MX|SB1 },
2273{"suba.qh", "Y,Q", 0x78200036, 0xfc2007ff, RD_S|RD_T|FP_D, WR_MACC, MX },
2274{"subl.ob", "Y,Q", 0x78000436, 0xfc2007ff, RD_S|RD_T|FP_D, WR_MACC, MX|SB1 },
2275{"subl.qh", "Y,Q", 0x78200436, 0xfc2007ff, RD_S|RD_T|FP_D, WR_MACC, MX },
2276{"subu", "d,v,t", 0x00000023, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I1 },
2277{"subu", "d,v,I", 0, (int) M_SUBU_I, INSN_MACRO, 0, I1 },
2278{"suspend", "", 0x42000022, 0xffffffff, 0, 0, V1 },
2279{"suxc1", "S,t(b)", 0x4c00000d, 0xfc0007ff, SM|RD_S|RD_t|RD_b, 0, I5|I33|N55},
2280{"sw", "t,o(b)", 0xac000000, 0xfc000000, SM|RD_t|RD_b, 0, I1 },
2281{"sw", "t,A(b)", 0, (int) M_SW_AB, INSN_MACRO, 0, I1 },
2282{"swc0", "E,o(b)", 0xe0000000, 0xfc000000, SM|RD_C0|RD_b, 0, I1 },
2283{"swc0", "E,A(b)", 0, (int) M_SWC0_AB, INSN_MACRO, 0, I1 },
2284{"swc1", "T,o(b)", 0xe4000000, 0xfc000000, SM|RD_T|RD_b|FP_S, 0, I1 },
2285{"swc1", "E,o(b)", 0xe4000000, 0xfc000000, SM|RD_T|RD_b|FP_S, 0, I1 },
2286{"swc1", "T,A(b)", 0, (int) M_SWC1_AB, INSN_MACRO, 0, I1 },
2287{"swc1", "E,A(b)", 0, (int) M_SWC1_AB, INSN_MACRO, 0, I1 },
2288{"s.s", "T,o(b)", 0xe4000000, 0xfc000000, SM|RD_T|RD_b|FP_S, 0, I1 }, /* swc1 */
2289{"s.s", "T,A(b)", 0, (int) M_SWC1_AB, INSN_MACRO, 0, I1 },
2290{"swc2", "E,o(b)", 0xe8000000, 0xfc000000, SM|RD_C2|RD_b, 0, I1 },
2291{"swc2", "E,A(b)", 0, (int) M_SWC2_AB, INSN_MACRO, 0, I1 },
2292{"swc3", "E,o(b)", 0xec000000, 0xfc000000, SM|RD_C3|RD_b, 0, I1 },
2293{"swc3", "E,A(b)", 0, (int) M_SWC3_AB, INSN_MACRO, 0, I1 },
2294{"swl", "t,o(b)", 0xa8000000, 0xfc000000, SM|RD_t|RD_b, 0, I1 },
2295{"swl", "t,A(b)", 0, (int) M_SWL_AB, INSN_MACRO, 0, I1 },
2296{"scache", "t,o(b)", 0xa8000000, 0xfc000000, RD_t|RD_b, 0, I2 }, /* same */
2297{"scache", "t,A(b)", 0, (int) M_SWL_AB, INSN_MACRO, 0, I2 }, /* as swl */
2298{"swr", "t,o(b)", 0xb8000000, 0xfc000000, SM|RD_t|RD_b, 0, I1 },
2299{"swr", "t,A(b)", 0, (int) M_SWR_AB, INSN_MACRO, 0, I1 },
2300{"invalidate", "t,o(b)",0xb8000000, 0xfc000000, RD_t|RD_b, 0, I2 }, /* same */
2301{"invalidate", "t,A(b)",0, (int) M_SWR_AB, INSN_MACRO, 0, I2 }, /* as swr */
2302{"swxc1", "S,t(b)", 0x4c000008, 0xfc0007ff, SM|RD_S|RD_t|RD_b|FP_S, 0, I4|I33 },
2303{"sync", "", 0x0000000f, 0xffffffff, INSN_SYNC, 0, I2|G1 },
2304{"sync.p", "", 0x0000040f, 0xffffffff, INSN_SYNC, 0, I2 },
2305{"sync.l", "", 0x0000000f, 0xffffffff, INSN_SYNC, 0, I2 },
2306{"synci", "o(b)", 0x041f0000, 0xfc1f0000, SM|RD_b, 0, I33 },
2307{"syscall", "", 0x0000000c, 0xffffffff, TRAP, 0, I1 },
2308{"syscall", "B", 0x0000000c, 0xfc00003f, TRAP, 0, I1 },
2309{"teqi", "s,j", 0x040c0000, 0xfc1f0000, RD_s|TRAP, 0, I2 },
2310{"teq", "s,t", 0x00000034, 0xfc00ffff, RD_s|RD_t|TRAP, 0, I2 },
2311{"teq", "s,t,q", 0x00000034, 0xfc00003f, RD_s|RD_t|TRAP, 0, I2 },
2312{"teq", "s,j", 0x040c0000, 0xfc1f0000, RD_s|TRAP, 0, I2 }, /* teqi */
2313{"teq", "s,I", 0, (int) M_TEQ_I, INSN_MACRO, 0, I2 },
2314{"tgei", "s,j", 0x04080000, 0xfc1f0000, RD_s|TRAP, 0, I2 },
2315{"tge", "s,t", 0x00000030, 0xfc00ffff, RD_s|RD_t|TRAP, 0, I2 },
2316{"tge", "s,t,q", 0x00000030, 0xfc00003f, RD_s|RD_t|TRAP, 0, I2 },
2317{"tge", "s,j", 0x04080000, 0xfc1f0000, RD_s|TRAP, 0, I2 }, /* tgei */
2318{"tge", "s,I", 0, (int) M_TGE_I, INSN_MACRO, 0, I2 },
2319{"tgeiu", "s,j", 0x04090000, 0xfc1f0000, RD_s|TRAP, 0, I2 },
2320{"tgeu", "s,t", 0x00000031, 0xfc00ffff, RD_s|RD_t|TRAP, 0, I2 },
2321{"tgeu", "s,t,q", 0x00000031, 0xfc00003f, RD_s|RD_t|TRAP, 0, I2 },
2322{"tgeu", "s,j", 0x04090000, 0xfc1f0000, RD_s|TRAP, 0, I2 }, /* tgeiu */
2323{"tgeu", "s,I", 0, (int) M_TGEU_I, INSN_MACRO, 0, I2 },
2324{"tlbp", "", 0x42000008, 0xffffffff, INSN_TLB, 0, I1 },
2325{"tlbr", "", 0x42000001, 0xffffffff, INSN_TLB, 0, I1 },
2326{"tlbwi", "", 0x42000002, 0xffffffff, INSN_TLB, 0, I1 },
2327{"tlbwr", "", 0x42000006, 0xffffffff, INSN_TLB, 0, I1 },
2328{"tlti", "s,j", 0x040a0000, 0xfc1f0000, RD_s|TRAP, 0, I2 },
2329{"tlt", "s,t", 0x00000032, 0xfc00ffff, RD_s|RD_t|TRAP, 0, I2 },
2330{"tlt", "s,t,q", 0x00000032, 0xfc00003f, RD_s|RD_t|TRAP, 0, I2 },
2331{"tlt", "s,j", 0x040a0000, 0xfc1f0000, RD_s|TRAP, 0, I2 }, /* tlti */
2332{"tlt", "s,I", 0, (int) M_TLT_I, INSN_MACRO, 0, I2 },
2333{"tltiu", "s,j", 0x040b0000, 0xfc1f0000, RD_s|TRAP, 0, I2 },
2334{"tltu", "s,t", 0x00000033, 0xfc00ffff, RD_s|RD_t|TRAP, 0, I2 },
2335{"tltu", "s,t,q", 0x00000033, 0xfc00003f, RD_s|RD_t|TRAP, 0, I2 },
2336{"tltu", "s,j", 0x040b0000, 0xfc1f0000, RD_s|TRAP, 0, I2 }, /* tltiu */
2337{"tltu", "s,I", 0, (int) M_TLTU_I, INSN_MACRO, 0, I2 },
2338{"tnei", "s,j", 0x040e0000, 0xfc1f0000, RD_s|TRAP, 0, I2 },
2339{"tne", "s,t", 0x00000036, 0xfc00ffff, RD_s|RD_t|TRAP, 0, I2 },
2340{"tne", "s,t,q", 0x00000036, 0xfc00003f, RD_s|RD_t|TRAP, 0, I2 },
2341{"tne", "s,j", 0x040e0000, 0xfc1f0000, RD_s|TRAP, 0, I2 }, /* tnei */
2342{"tne", "s,I", 0, (int) M_TNE_I, INSN_MACRO, 0, I2 },
2343{"trunc.l.d", "D,S", 0x46200009, 0xffff003f, WR_D|RD_S|FP_D, 0, I3|I33 },
2344{"trunc.l.s", "D,S", 0x46000009, 0xffff003f, WR_D|RD_S|FP_S|FP_D, 0, I3|I33 },
2345{"trunc.w.d", "D,S", 0x4620000d, 0xffff003f, WR_D|RD_S|FP_S|FP_D, 0, I2 },
2346{"trunc.w.d", "D,S,x", 0x4620000d, 0xffff003f, WR_D|RD_S|FP_S|FP_D, 0, I2 },
2347{"trunc.w.d", "D,S,t", 0, (int) M_TRUNCWD, INSN_MACRO, 0, I1 },
2348{"trunc.w.s", "D,S", 0x4600000d, 0xffff003f, WR_D|RD_S|FP_S, 0, I2 },
2349{"trunc.w.s", "D,S,x", 0x4600000d, 0xffff003f, WR_D|RD_S|FP_S, 0, I2 },
2350{"trunc.w.s", "D,S,t", 0, (int) M_TRUNCWS, INSN_MACRO, 0, I1 },
2351{"uld", "t,o(b)", 0, (int) M_ULD, INSN_MACRO, 0, I3 },
2352{"uld", "t,A(b)", 0, (int) M_ULD_A, INSN_MACRO, 0, I3 },
2353{"ulh", "t,o(b)", 0, (int) M_ULH, INSN_MACRO, 0, I1 },
2354{"ulh", "t,A(b)", 0, (int) M_ULH_A, INSN_MACRO, 0, I1 },
2355{"ulhu", "t,o(b)", 0, (int) M_ULHU, INSN_MACRO, 0, I1 },
2356{"ulhu", "t,A(b)", 0, (int) M_ULHU_A, INSN_MACRO, 0, I1 },
2357{"ulw", "t,o(b)", 0, (int) M_ULW, INSN_MACRO, 0, I1 },
2358{"ulw", "t,A(b)", 0, (int) M_ULW_A, INSN_MACRO, 0, I1 },
2359{"usd", "t,o(b)", 0, (int) M_USD, INSN_MACRO, 0, I3 },
2360{"usd", "t,A(b)", 0, (int) M_USD_A, INSN_MACRO, 0, I3 },
2361{"ush", "t,o(b)", 0, (int) M_USH, INSN_MACRO, 0, I1 },
2362{"ush", "t,A(b)", 0, (int) M_USH_A, INSN_MACRO, 0, I1 },
2363{"usw", "t,o(b)", 0, (int) M_USW, INSN_MACRO, 0, I1 },
2364{"usw", "t,A(b)", 0, (int) M_USW_A, INSN_MACRO, 0, I1 },
2365{"wach.ob", "Y", 0x7a00003e, 0xffff07ff, RD_S|FP_D, WR_MACC, MX|SB1 },
2366{"wach.ob", "S", 0x4a00003e, 0xffff07ff, RD_S, 0, N54 },
2367{"wach.qh", "Y", 0x7a20003e, 0xffff07ff, RD_S|FP_D, WR_MACC, MX },
2368{"wacl.ob", "Y,Z", 0x7800003e, 0xffe007ff, RD_S|RD_T|FP_D, WR_MACC, MX|SB1 },
2369{"wacl.ob", "S,T", 0x4800003e, 0xffe007ff, RD_S|RD_T, 0, N54 },
2370{"wacl.qh", "Y,Z", 0x7820003e, 0xffe007ff, RD_S|RD_T|FP_D, WR_MACC, MX },
2371{"wait", "", 0x42000020, 0xffffffff, TRAP, 0, I3|I32 },
2372{"wait", "J", 0x42000020, 0xfe00003f, TRAP, 0, I32|N55 },
2373{"waiti", "", 0x42000020, 0xffffffff, TRAP, 0, L1 },
2374{"wrpgpr", "d,w", 0x41c00000, 0xffe007ff, RD_t, 0, I33 },
2375{"wsbh", "d,w", 0x7c0000a0, 0xffe007ff, WR_d|RD_t, 0, I33 },
2376{"xor", "d,v,t", 0x00000026, 0xfc0007ff, WR_d|RD_s|RD_t, 0, I1 },
2377{"xor", "t,r,I", 0, (int) M_XOR_I, INSN_MACRO, 0, I1 },
2378{"xor.ob", "X,Y,Q", 0x7800000d, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX|SB1 },
2379{"xor.ob", "D,S,T", 0x4ac0000d, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },
2380{"xor.ob", "D,S,T[e]", 0x4800000d, 0xfe20003f, WR_D|RD_S|RD_T, 0, N54 },
2381{"xor.ob", "D,S,k", 0x4bc0000d, 0xffe0003f, WR_D|RD_S|RD_T, 0, N54 },
2382{"xor.qh", "X,Y,Q", 0x7820000d, 0xfc20003f, WR_D|RD_S|RD_T|FP_D, 0, MX },
2383{"xori", "t,r,i", 0x38000000, 0xfc000000, WR_t|RD_s, 0, I1 },
2384{"yield", "s", 0x7c000009, 0xfc1fffff, TRAP|RD_s, 0, MT32 },
2385{"yield", "d,s", 0x7c000009, 0xfc1f07ff, TRAP|WR_d|RD_s, 0, MT32 },
2386
2387/* User Defined Instruction. */
2388{"udi0", "s,t,d,+1",0x70000010, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2389{"udi0", "s,t,+2", 0x70000010, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2390{"udi0", "s,+3", 0x70000010, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2391{"udi0", "+4", 0x70000010, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2392{"udi1", "s,t,d,+1",0x70000011, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2393{"udi1", "s,t,+2", 0x70000011, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2394{"udi1", "s,+3", 0x70000011, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2395{"udi1", "+4", 0x70000011, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2396{"udi2", "s,t,d,+1",0x70000012, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2397{"udi2", "s,t,+2", 0x70000012, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2398{"udi2", "s,+3", 0x70000012, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2399{"udi2", "+4", 0x70000012, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2400{"udi3", "s,t,d,+1",0x70000013, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2401{"udi3", "s,t,+2", 0x70000013, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2402{"udi3", "s,+3", 0x70000013, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2403{"udi3", "+4", 0x70000013, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2404{"udi4", "s,t,d,+1",0x70000014, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2405{"udi4", "s,t,+2", 0x70000014, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2406{"udi4", "s,+3", 0x70000014, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2407{"udi4", "+4", 0x70000014, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2408{"udi5", "s,t,d,+1",0x70000015, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2409{"udi5", "s,t,+2", 0x70000015, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2410{"udi5", "s,+3", 0x70000015, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2411{"udi5", "+4", 0x70000015, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2412{"udi6", "s,t,d,+1",0x70000016, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2413{"udi6", "s,t,+2", 0x70000016, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2414{"udi6", "s,+3", 0x70000016, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2415{"udi6", "+4", 0x70000016, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2416{"udi7", "s,t,d,+1",0x70000017, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2417{"udi7", "s,t,+2", 0x70000017, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2418{"udi7", "s,+3", 0x70000017, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2419{"udi7", "+4", 0x70000017, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2420{"udi8", "s,t,d,+1",0x70000018, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2421{"udi8", "s,t,+2", 0x70000018, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2422{"udi8", "s,+3", 0x70000018, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2423{"udi8", "+4", 0x70000018, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2424{"udi9", "s,t,d,+1",0x70000019, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2425{"udi9", "s,t,+2", 0x70000019, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2426{"udi9", "s,+3", 0x70000019, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2427{"udi9", "+4", 0x70000019, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2428{"udi10", "s,t,d,+1",0x7000001a, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2429{"udi10", "s,t,+2", 0x7000001a, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2430{"udi10", "s,+3", 0x7000001a, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2431{"udi10", "+4", 0x7000001a, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2432{"udi11", "s,t,d,+1",0x7000001b, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2433{"udi11", "s,t,+2", 0x7000001b, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2434{"udi11", "s,+3", 0x7000001b, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2435{"udi11", "+4", 0x7000001b, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2436{"udi12", "s,t,d,+1",0x7000001c, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2437{"udi12", "s,t,+2", 0x7000001c, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2438{"udi12", "s,+3", 0x7000001c, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2439{"udi12", "+4", 0x7000001c, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2440{"udi13", "s,t,d,+1",0x7000001d, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2441{"udi13", "s,t,+2", 0x7000001d, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2442{"udi13", "s,+3", 0x7000001d, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2443{"udi13", "+4", 0x7000001d, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2444{"udi14", "s,t,d,+1",0x7000001e, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2445{"udi14", "s,t,+2", 0x7000001e, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2446{"udi14", "s,+3", 0x7000001e, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2447{"udi14", "+4", 0x7000001e, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2448{"udi15", "s,t,d,+1",0x7000001f, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2449{"udi15", "s,t,+2", 0x7000001f, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2450{"udi15", "s,+3", 0x7000001f, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
2451{"udi15", "+4", 0x7000001f, 0xfc00003f, WR_d|RD_s|RD_t, 0, I33 },
6643d27e
FB
2452
2453/* Coprocessor 2 move/branch operations overlap with VR5400 .ob format
2454 instructions so they are here for the latters to take precedence. */
29490584
TS
2455{"bc2f", "p", 0x49000000, 0xffff0000, CBD|RD_CC, 0, I1 },
2456{"bc2f", "N,p", 0x49000000, 0xffe30000, CBD|RD_CC, 0, I32 },
2457{"bc2fl", "p", 0x49020000, 0xffff0000, CBL|RD_CC, 0, I2|T3 },
2458{"bc2fl", "N,p", 0x49020000, 0xffe30000, CBL|RD_CC, 0, I32 },
2459{"bc2t", "p", 0x49010000, 0xffff0000, CBD|RD_CC, 0, I1 },
2460{"bc2t", "N,p", 0x49010000, 0xffe30000, CBD|RD_CC, 0, I32 },
2461{"bc2tl", "p", 0x49030000, 0xffff0000, CBL|RD_CC, 0, I2|T3 },
2462{"bc2tl", "N,p", 0x49030000, 0xffe30000, CBL|RD_CC, 0, I32 },
2463{"cfc2", "t,G", 0x48400000, 0xffe007ff, LCD|WR_t|RD_C2, 0, I1 },
2464{"ctc2", "t,G", 0x48c00000, 0xffe007ff, COD|RD_t|WR_CC, 0, I1 },
2465{"dmfc2", "t,G", 0x48200000, 0xffe007ff, LCD|WR_t|RD_C2, 0, I3 },
2466{"dmfc2", "t,G,H", 0x48200000, 0xffe007f8, LCD|WR_t|RD_C2, 0, I64 },
2467{"dmtc2", "t,G", 0x48a00000, 0xffe007ff, COD|RD_t|WR_C2|WR_CC, 0, I3 },
2468{"dmtc2", "t,G,H", 0x48a00000, 0xffe007f8, COD|RD_t|WR_C2|WR_CC, 0, I64 },
2469{"mfc2", "t,G", 0x48000000, 0xffe007ff, LCD|WR_t|RD_C2, 0, I1 },
2470{"mfc2", "t,G,H", 0x48000000, 0xffe007f8, LCD|WR_t|RD_C2, 0, I32 },
2471{"mfhc2", "t,G", 0x48600000, 0xffe007ff, LCD|WR_t|RD_C2, 0, I33 },
2472{"mfhc2", "t,G,H", 0x48600000, 0xffe007f8, LCD|WR_t|RD_C2, 0, I33 },
2473{"mfhc2", "t,i", 0x48600000, 0xffe00000, LCD|WR_t|RD_C2, 0, I33 },
2474{"mtc2", "t,G", 0x48800000, 0xffe007ff, COD|RD_t|WR_C2|WR_CC, 0, I1 },
2475{"mtc2", "t,G,H", 0x48800000, 0xffe007f8, COD|RD_t|WR_C2|WR_CC, 0, I32 },
2476{"mthc2", "t,G", 0x48e00000, 0xffe007ff, COD|RD_t|WR_C2|WR_CC, 0, I33 },
2477{"mthc2", "t,G,H", 0x48e00000, 0xffe007f8, COD|RD_t|WR_C2|WR_CC, 0, I33 },
2478{"mthc2", "t,i", 0x48e00000, 0xffe00000, COD|RD_t|WR_C2|WR_CC, 0, I33 },
2479
2480/* Coprocessor 3 move/branch operations overlap with MIPS IV COP1X
2481 instructions, so they are here for the latters to take precedence. */
2482{"bc3f", "p", 0x4d000000, 0xffff0000, CBD|RD_CC, 0, I1 },
2483{"bc3fl", "p", 0x4d020000, 0xffff0000, CBL|RD_CC, 0, I2|T3 },
2484{"bc3t", "p", 0x4d010000, 0xffff0000, CBD|RD_CC, 0, I1 },
2485{"bc3tl", "p", 0x4d030000, 0xffff0000, CBL|RD_CC, 0, I2|T3 },
2486{"cfc3", "t,G", 0x4c400000, 0xffe007ff, LCD|WR_t|RD_C3, 0, I1 },
2487{"ctc3", "t,G", 0x4cc00000, 0xffe007ff, COD|RD_t|WR_CC, 0, I1 },
2488{"dmfc3", "t,G", 0x4c200000, 0xffe007ff, LCD|WR_t|RD_C3, 0, I3 },
2489{"dmtc3", "t,G", 0x4ca00000, 0xffe007ff, COD|RD_t|WR_C3|WR_CC, 0, I3 },
2490{"mfc3", "t,G", 0x4c000000, 0xffe007ff, LCD|WR_t|RD_C3, 0, I1 },
2491{"mfc3", "t,G,H", 0x4c000000, 0xffe007f8, LCD|WR_t|RD_C3, 0, I32 },
2492{"mtc3", "t,G", 0x4c800000, 0xffe007ff, COD|RD_t|WR_C3|WR_CC, 0, I1 },
2493{"mtc3", "t,G,H", 0x4c800000, 0xffe007f8, COD|RD_t|WR_C3|WR_CC, 0, I32 },
6643d27e
FB
2494
2495/* No hazard protection on coprocessor instructions--they shouldn't
2496 change the state of the processor and if they do it's up to the
2497 user to put in nops as necessary. These are at the end so that the
2498 disassembler recognizes more specific versions first. */
29490584
TS
2499{"c0", "C", 0x42000000, 0xfe000000, 0, 0, I1 },
2500{"c1", "C", 0x46000000, 0xfe000000, 0, 0, I1 },
2501{"c2", "C", 0x4a000000, 0xfe000000, 0, 0, I1 },
2502{"c3", "C", 0x4e000000, 0xfe000000, 0, 0, I1 },
2503{"cop0", "C", 0, (int) M_COP0, INSN_MACRO, 0, I1 },
2504{"cop1", "C", 0, (int) M_COP1, INSN_MACRO, 0, I1 },
2505{"cop2", "C", 0, (int) M_COP2, INSN_MACRO, 0, I1 },
2506{"cop3", "C", 0, (int) M_COP3, INSN_MACRO, 0, I1 },
6643d27e
FB
2507 /* Conflicts with the 4650's "mul" instruction. Nobody's using the
2508 4010 any more, so move this insn out of the way. If the object
2509 format gave us more info, we could do this right. */
29490584
TS
2510{"addciu", "t,r,j", 0x70000000, 0xfc000000, WR_t|RD_s, 0, L1 },
2511/* MIPS DSP ASE */
2512{"absq_s.ph", "d,t", 0x7c000252, 0xffe007ff, WR_d|RD_t, 0, D32 },
2513{"absq_s.pw", "d,t", 0x7c000456, 0xffe007ff, WR_d|RD_t, 0, D64 },
2514{"absq_s.qh", "d,t", 0x7c000256, 0xffe007ff, WR_d|RD_t, 0, D64 },
2515{"absq_s.w", "d,t", 0x7c000452, 0xffe007ff, WR_d|RD_t, 0, D32 },
2516{"addq.ph", "d,s,t", 0x7c000290, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2517{"addq.pw", "d,s,t", 0x7c000494, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2518{"addq.qh", "d,s,t", 0x7c000294, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2519{"addq_s.ph", "d,s,t", 0x7c000390, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2520{"addq_s.pw", "d,s,t", 0x7c000594, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2521{"addq_s.qh", "d,s,t", 0x7c000394, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2522{"addq_s.w", "d,s,t", 0x7c000590, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2523{"addsc", "d,s,t", 0x7c000410, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2524{"addu.ob", "d,s,t", 0x7c000014, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2525{"addu.qb", "d,s,t", 0x7c000010, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2526{"addu_s.ob", "d,s,t", 0x7c000114, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2527{"addu_s.qb", "d,s,t", 0x7c000110, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2528{"addwc", "d,s,t", 0x7c000450, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2529{"bitrev", "d,t", 0x7c0006d2, 0xffe007ff, WR_d|RD_t, 0, D32 },
2530{"bposge32", "p", 0x041c0000, 0xffff0000, CBD, 0, D32 },
2531{"bposge64", "p", 0x041d0000, 0xffff0000, CBD, 0, D64 },
2532{"cmp.eq.ph", "s,t", 0x7c000211, 0xfc00ffff, RD_s|RD_t, 0, D32 },
2533{"cmp.eq.pw", "s,t", 0x7c000415, 0xfc00ffff, RD_s|RD_t, 0, D64 },
2534{"cmp.eq.qh", "s,t", 0x7c000215, 0xfc00ffff, RD_s|RD_t, 0, D64 },
2535{"cmpgu.eq.ob", "d,s,t", 0x7c000115, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2536{"cmpgu.eq.qb", "d,s,t", 0x7c000111, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2537{"cmpgu.le.ob", "d,s,t", 0x7c000195, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2538{"cmpgu.le.qb", "d,s,t", 0x7c000191, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2539{"cmpgu.lt.ob", "d,s,t", 0x7c000155, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2540{"cmpgu.lt.qb", "d,s,t", 0x7c000151, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2541{"cmp.le.ph", "s,t", 0x7c000291, 0xfc00ffff, RD_s|RD_t, 0, D32 },
2542{"cmp.le.pw", "s,t", 0x7c000495, 0xfc00ffff, RD_s|RD_t, 0, D64 },
2543{"cmp.le.qh", "s,t", 0x7c000295, 0xfc00ffff, RD_s|RD_t, 0, D64 },
2544{"cmp.lt.ph", "s,t", 0x7c000251, 0xfc00ffff, RD_s|RD_t, 0, D32 },
2545{"cmp.lt.pw", "s,t", 0x7c000455, 0xfc00ffff, RD_s|RD_t, 0, D64 },
2546{"cmp.lt.qh", "s,t", 0x7c000255, 0xfc00ffff, RD_s|RD_t, 0, D64 },
2547{"cmpu.eq.ob", "s,t", 0x7c000015, 0xfc00ffff, RD_s|RD_t, 0, D64 },
2548{"cmpu.eq.qb", "s,t", 0x7c000011, 0xfc00ffff, RD_s|RD_t, 0, D32 },
2549{"cmpu.le.ob", "s,t", 0x7c000095, 0xfc00ffff, RD_s|RD_t, 0, D64 },
2550{"cmpu.le.qb", "s,t", 0x7c000091, 0xfc00ffff, RD_s|RD_t, 0, D32 },
2551{"cmpu.lt.ob", "s,t", 0x7c000055, 0xfc00ffff, RD_s|RD_t, 0, D64 },
2552{"cmpu.lt.qb", "s,t", 0x7c000051, 0xfc00ffff, RD_s|RD_t, 0, D32 },
2553{"dextpdp", "t,7,6", 0x7c0002bc, 0xfc00e7ff, WR_t|RD_a|DSP_VOLA, 0, D64 },
2554{"dextpdpv", "t,7,s", 0x7c0002fc, 0xfc00e7ff, WR_t|RD_a|RD_s|DSP_VOLA, 0, D64 },
2555{"dextp", "t,7,6", 0x7c0000bc, 0xfc00e7ff, WR_t|RD_a, 0, D64 },
2556{"dextpv", "t,7,s", 0x7c0000fc, 0xfc00e7ff, WR_t|RD_a|RD_s, 0, D64 },
2557{"dextr.l", "t,7,6", 0x7c00043c, 0xfc00e7ff, WR_t|RD_a, 0, D64 },
2558{"dextr_r.l", "t,7,6", 0x7c00053c, 0xfc00e7ff, WR_t|RD_a, 0, D64 },
2559{"dextr_rs.l", "t,7,6", 0x7c0005bc, 0xfc00e7ff, WR_t|RD_a, 0, D64 },
2560{"dextr_rs.w", "t,7,6", 0x7c0001bc, 0xfc00e7ff, WR_t|RD_a, 0, D64 },
2561{"dextr_r.w", "t,7,6", 0x7c00013c, 0xfc00e7ff, WR_t|RD_a, 0, D64 },
2562{"dextr_s.h", "t,7,6", 0x7c0003bc, 0xfc00e7ff, WR_t|RD_a, 0, D64 },
2563{"dextrv.l", "t,7,s", 0x7c00047c, 0xfc00e7ff, WR_t|RD_a|RD_s, 0, D64 },
2564{"dextrv_r.l", "t,7,s", 0x7c00057c, 0xfc00e7ff, WR_t|RD_a|RD_s, 0, D64 },
2565{"dextrv_rs.l", "t,7,s", 0x7c0005fc, 0xfc00e7ff, WR_t|RD_a|RD_s, 0, D64 },
2566{"dextrv_rs.w", "t,7,s", 0x7c0001fc, 0xfc00e7ff, WR_t|RD_a|RD_s, 0, D64 },
2567{"dextrv_r.w", "t,7,s", 0x7c00017c, 0xfc00e7ff, WR_t|RD_a|RD_s, 0, D64 },
2568{"dextrv_s.h", "t,7,s", 0x7c0003fc, 0xfc00e7ff, WR_t|RD_a|RD_s, 0, D64 },
2569{"dextrv.w", "t,7,s", 0x7c00007c, 0xfc00e7ff, WR_t|RD_a|RD_s, 0, D64 },
2570{"dextr.w", "t,7,6", 0x7c00003c, 0xfc00e7ff, WR_t|RD_a, 0, D64 },
2571{"dinsv", "t,s", 0x7c00000d, 0xfc00ffff, WR_t|RD_s, 0, D64 },
2572{"dmadd", "7,s,t", 0x7c000674, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D64 },
2573{"dmaddu", "7,s,t", 0x7c000774, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D64 },
2574{"dmsub", "7,s,t", 0x7c0006f4, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D64 },
2575{"dmsubu", "7,s,t", 0x7c0007f4, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D64 },
2576{"dmthlip", "s,7", 0x7c0007fc, 0xfc1fe7ff, RD_s|MOD_a|DSP_VOLA, 0, D64 },
2577{"dpaq_sa.l.pw", "7,s,t", 0x7c000334, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D64 },
2578{"dpaq_sa.l.w", "7,s,t", 0x7c000330, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D32 },
2579{"dpaq_s.w.ph", "7,s,t", 0x7c000130, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D32 },
2580{"dpaq_s.w.qh", "7,s,t", 0x7c000134, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D64 },
2581{"dpau.h.obl", "7,s,t", 0x7c0000f4, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D64 },
2582{"dpau.h.obr", "7,s,t", 0x7c0001f4, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D64 },
2583{"dpau.h.qbl", "7,s,t", 0x7c0000f0, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D32 },
2584{"dpau.h.qbr", "7,s,t", 0x7c0001f0, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D32 },
2585{"dpsq_sa.l.pw", "7,s,t", 0x7c000374, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D64 },
2586{"dpsq_sa.l.w", "7,s,t", 0x7c000370, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D32 },
2587{"dpsq_s.w.ph", "7,s,t", 0x7c000170, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D32 },
2588{"dpsq_s.w.qh", "7,s,t", 0x7c000174, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D64 },
2589{"dpsu.h.obl", "7,s,t", 0x7c0002f4, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D64 },
2590{"dpsu.h.obr", "7,s,t", 0x7c0003f4, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D64 },
2591{"dpsu.h.qbl", "7,s,t", 0x7c0002f0, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D32 },
2592{"dpsu.h.qbr", "7,s,t", 0x7c0003f0, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D32 },
2593{"dshilo", "7,:", 0x7c0006bc, 0xfc07e7ff, MOD_a, 0, D64 },
2594{"dshilov", "7,s", 0x7c0006fc, 0xfc1fe7ff, MOD_a|RD_s, 0, D64 },
2595{"extpdp", "t,7,6", 0x7c0002b8, 0xfc00e7ff, WR_t|RD_a|DSP_VOLA, 0, D32 },
2596{"extpdpv", "t,7,s", 0x7c0002f8, 0xfc00e7ff, WR_t|RD_a|RD_s|DSP_VOLA, 0, D32 },
2597{"extp", "t,7,6", 0x7c0000b8, 0xfc00e7ff, WR_t|RD_a, 0, D32 },
2598{"extpv", "t,7,s", 0x7c0000f8, 0xfc00e7ff, WR_t|RD_a|RD_s, 0, D32 },
2599{"extr_rs.w", "t,7,6", 0x7c0001b8, 0xfc00e7ff, WR_t|RD_a, 0, D32 },
2600{"extr_r.w", "t,7,6", 0x7c000138, 0xfc00e7ff, WR_t|RD_a, 0, D32 },
2601{"extr_s.h", "t,7,6", 0x7c0003b8, 0xfc00e7ff, WR_t|RD_a, 0, D32 },
2602{"extrv_rs.w", "t,7,s", 0x7c0001f8, 0xfc00e7ff, WR_t|RD_a|RD_s, 0, D32 },
2603{"extrv_r.w", "t,7,s", 0x7c000178, 0xfc00e7ff, WR_t|RD_a|RD_s, 0, D32 },
2604{"extrv_s.h", "t,7,s", 0x7c0003f8, 0xfc00e7ff, WR_t|RD_a|RD_s, 0, D32 },
2605{"extrv.w", "t,7,s", 0x7c000078, 0xfc00e7ff, WR_t|RD_a|RD_s, 0, D32 },
2606{"extr.w", "t,7,6", 0x7c000038, 0xfc00e7ff, WR_t|RD_a, 0, D32 },
2607{"insv", "t,s", 0x7c00000c, 0xfc00ffff, WR_t|RD_s, 0, D32 },
2608{"lbux", "d,t(b)", 0x7c00018a, 0xfc0007ff, LDD|WR_d|RD_t|RD_b, 0, D32 },
2609{"ldx", "d,t(b)", 0x7c00020a, 0xfc0007ff, LDD|WR_d|RD_t|RD_b, 0, D64 },
2610{"lhx", "d,t(b)", 0x7c00010a, 0xfc0007ff, LDD|WR_d|RD_t|RD_b, 0, D32 },
2611{"lwx", "d,t(b)", 0x7c00000a, 0xfc0007ff, LDD|WR_d|RD_t|RD_b, 0, D32 },
2612{"maq_sa.w.phl", "7,s,t", 0x7c000430, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D32 },
2613{"maq_sa.w.phr", "7,s,t", 0x7c0004b0, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D32 },
2614{"maq_sa.w.qhll", "7,s,t", 0x7c000434, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D64 },
2615{"maq_sa.w.qhlr", "7,s,t", 0x7c000474, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D64 },
2616{"maq_sa.w.qhrl", "7,s,t", 0x7c0004b4, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D64 },
2617{"maq_sa.w.qhrr", "7,s,t", 0x7c0004f4, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D64 },
2618{"maq_s.l.pwl", "7,s,t", 0x7c000734, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D64 },
2619{"maq_s.l.pwr", "7,s,t", 0x7c0007b4, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D64 },
2620{"maq_s.w.phl", "7,s,t", 0x7c000530, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D32 },
2621{"maq_s.w.phr", "7,s,t", 0x7c0005b0, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D32 },
2622{"maq_s.w.qhll", "7,s,t", 0x7c000534, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D64 },
2623{"maq_s.w.qhlr", "7,s,t", 0x7c000574, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D64 },
2624{"maq_s.w.qhrl", "7,s,t", 0x7c0005b4, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D64 },
2625{"maq_s.w.qhrr", "7,s,t", 0x7c0005f4, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D64 },
2626{"modsub", "d,s,t", 0x7c000490, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2627{"mthlip", "s,7", 0x7c0007f8, 0xfc1fe7ff, RD_s|MOD_a|DSP_VOLA, 0, D32 },
2628{"muleq_s.pw.qhl", "d,s,t", 0x7c000714, 0xfc0007ff, WR_d|RD_s|RD_t|WR_HILO, 0, D64 },
2629{"muleq_s.pw.qhr", "d,s,t", 0x7c000754, 0xfc0007ff, WR_d|RD_s|RD_t|WR_HILO, 0, D64 },
2630{"muleq_s.w.phl", "d,s,t", 0x7c000710, 0xfc0007ff, WR_d|RD_s|RD_t|WR_HILO, 0, D32 },
2631{"muleq_s.w.phr", "d,s,t", 0x7c000750, 0xfc0007ff, WR_d|RD_s|RD_t|WR_HILO, 0, D32 },
2632{"muleu_s.ph.qbl", "d,s,t", 0x7c000190, 0xfc0007ff, WR_d|RD_s|RD_t|WR_HILO, 0, D32 },
2633{"muleu_s.ph.qbr", "d,s,t", 0x7c0001d0, 0xfc0007ff, WR_d|RD_s|RD_t|WR_HILO, 0, D32 },
2634{"muleu_s.qh.obl", "d,s,t", 0x7c000194, 0xfc0007ff, WR_d|RD_s|RD_t|WR_HILO, 0, D64 },
2635{"muleu_s.qh.obr", "d,s,t", 0x7c0001d4, 0xfc0007ff, WR_d|RD_s|RD_t|WR_HILO, 0, D64 },
2636{"mulq_rs.ph", "d,s,t", 0x7c0007d0, 0xfc0007ff, WR_d|RD_s|RD_t|WR_HILO, 0, D32 },
2637{"mulq_rs.qh", "d,s,t", 0x7c0007d4, 0xfc0007ff, WR_d|RD_s|RD_t|WR_HILO, 0, D64 },
2638{"mulsaq_s.l.pw", "7,s,t", 0x7c0003b4, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D64 },
2639{"mulsaq_s.w.ph", "7,s,t", 0x7c0001b0, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D32 },
2640{"mulsaq_s.w.qh", "7,s,t", 0x7c0001b4, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D64 },
2641{"packrl.ph", "d,s,t", 0x7c000391, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2642{"packrl.pw", "d,s,t", 0x7c000395, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2643{"pick.ob", "d,s,t", 0x7c0000d5, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2644{"pick.ph", "d,s,t", 0x7c0002d1, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2645{"pick.pw", "d,s,t", 0x7c0004d5, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2646{"pick.qb", "d,s,t", 0x7c0000d1, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2647{"pick.qh", "d,s,t", 0x7c0002d5, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2648{"preceq.pw.qhla", "d,t", 0x7c000396, 0xffe007ff, WR_d|RD_t, 0, D64 },
2649{"preceq.pw.qhl", "d,t", 0x7c000316, 0xffe007ff, WR_d|RD_t, 0, D64 },
2650{"preceq.pw.qhra", "d,t", 0x7c0003d6, 0xffe007ff, WR_d|RD_t, 0, D64 },
2651{"preceq.pw.qhr", "d,t", 0x7c000356, 0xffe007ff, WR_d|RD_t, 0, D64 },
2652{"preceq.s.l.pwl", "d,t", 0x7c000516, 0xffe007ff, WR_d|RD_t, 0, D64 },
2653{"preceq.s.l.pwr", "d,t", 0x7c000556, 0xffe007ff, WR_d|RD_t, 0, D64 },
2654{"precequ.ph.qbla", "d,t", 0x7c000192, 0xffe007ff, WR_d|RD_t, 0, D32 },
2655{"precequ.ph.qbl", "d,t", 0x7c000112, 0xffe007ff, WR_d|RD_t, 0, D32 },
2656{"precequ.ph.qbra", "d,t", 0x7c0001d2, 0xffe007ff, WR_d|RD_t, 0, D32 },
2657{"precequ.ph.qbr", "d,t", 0x7c000152, 0xffe007ff, WR_d|RD_t, 0, D32 },
2658{"precequ.pw.qhla", "d,t", 0x7c000196, 0xffe007ff, WR_d|RD_t, 0, D64 },
2659{"precequ.pw.qhl", "d,t", 0x7c000116, 0xffe007ff, WR_d|RD_t, 0, D64 },
2660{"precequ.pw.qhra", "d,t", 0x7c0001d6, 0xffe007ff, WR_d|RD_t, 0, D64 },
2661{"precequ.pw.qhr", "d,t", 0x7c000156, 0xffe007ff, WR_d|RD_t, 0, D64 },
2662{"preceq.w.phl", "d,t", 0x7c000312, 0xffe007ff, WR_d|RD_t, 0, D32 },
2663{"preceq.w.phr", "d,t", 0x7c000352, 0xffe007ff, WR_d|RD_t, 0, D32 },
2664{"preceu.ph.qbla", "d,t", 0x7c000792, 0xffe007ff, WR_d|RD_t, 0, D32 },
2665{"preceu.ph.qbl", "d,t", 0x7c000712, 0xffe007ff, WR_d|RD_t, 0, D32 },
2666{"preceu.ph.qbra", "d,t", 0x7c0007d2, 0xffe007ff, WR_d|RD_t, 0, D32 },
2667{"preceu.ph.qbr", "d,t", 0x7c000752, 0xffe007ff, WR_d|RD_t, 0, D32 },
2668{"preceu.qh.obla", "d,t", 0x7c000796, 0xffe007ff, WR_d|RD_t, 0, D64 },
2669{"preceu.qh.obl", "d,t", 0x7c000716, 0xffe007ff, WR_d|RD_t, 0, D64 },
2670{"preceu.qh.obra", "d,t", 0x7c0007d6, 0xffe007ff, WR_d|RD_t, 0, D64 },
2671{"preceu.qh.obr", "d,t", 0x7c000756, 0xffe007ff, WR_d|RD_t, 0, D64 },
2672{"precrq.ob.qh", "d,s,t", 0x7c000315, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2673{"precrq.ph.w", "d,s,t", 0x7c000511, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2674{"precrq.pw.l", "d,s,t", 0x7c000715, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2675{"precrq.qb.ph", "d,s,t", 0x7c000311, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2676{"precrq.qh.pw", "d,s,t", 0x7c000515, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2677{"precrq_rs.ph.w", "d,s,t", 0x7c000551, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2678{"precrq_rs.qh.pw", "d,s,t", 0x7c000555, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2679{"precrqu_s.ob.qh", "d,s,t", 0x7c0003d5, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2680{"precrqu_s.qb.ph", "d,s,t", 0x7c0003d1, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2681{"raddu.l.ob", "d,s", 0x7c000514, 0xfc1f07ff, WR_d|RD_s, 0, D64 },
2682{"raddu.w.qb", "d,s", 0x7c000510, 0xfc1f07ff, WR_d|RD_s, 0, D32 },
2683{"rddsp", "d", 0x7fff04b8, 0xffff07ff, WR_d, 0, D32 },
2684{"rddsp", "d,'", 0x7c0004b8, 0xffc007ff, WR_d, 0, D32 },
2685{"repl.ob", "d,5", 0x7c000096, 0xff0007ff, WR_d, 0, D64 },
2686{"repl.ph", "d,@", 0x7c000292, 0xfc0007ff, WR_d, 0, D32 },
2687{"repl.pw", "d,@", 0x7c000496, 0xfc0007ff, WR_d, 0, D64 },
2688{"repl.qb", "d,5", 0x7c000092, 0xff0007ff, WR_d, 0, D32 },
2689{"repl.qh", "d,@", 0x7c000296, 0xfc0007ff, WR_d, 0, D64 },
2690{"replv.ob", "d,t", 0x7c0000d6, 0xffe007ff, WR_d|RD_t, 0, D64 },
2691{"replv.ph", "d,t", 0x7c0002d2, 0xffe007ff, WR_d|RD_t, 0, D32 },
2692{"replv.pw", "d,t", 0x7c0004d6, 0xffe007ff, WR_d|RD_t, 0, D64 },
2693{"replv.qb", "d,t", 0x7c0000d2, 0xffe007ff, WR_d|RD_t, 0, D32 },
2694{"replv.qh", "d,t", 0x7c0002d6, 0xffe007ff, WR_d|RD_t, 0, D64 },
2695{"shilo", "7,0", 0x7c0006b8, 0xfc0fe7ff, MOD_a, 0, D32 },
2696{"shilov", "7,s", 0x7c0006f8, 0xfc1fe7ff, MOD_a|RD_s, 0, D32 },
2697{"shll.ob", "d,t,3", 0x7c000017, 0xff0007ff, WR_d|RD_t, 0, D64 },
2698{"shll.ph", "d,t,4", 0x7c000213, 0xfe0007ff, WR_d|RD_t, 0, D32 },
2699{"shll.pw", "d,t,6", 0x7c000417, 0xfc0007ff, WR_d|RD_t, 0, D64 },
2700{"shll.qb", "d,t,3", 0x7c000013, 0xff0007ff, WR_d|RD_t, 0, D32 },
2701{"shll.qh", "d,t,4", 0x7c000217, 0xfe0007ff, WR_d|RD_t, 0, D64 },
2702{"shll_s.ph", "d,t,4", 0x7c000313, 0xfe0007ff, WR_d|RD_t, 0, D32 },
2703{"shll_s.pw", "d,t,6", 0x7c000517, 0xfc0007ff, WR_d|RD_t, 0, D64 },
2704{"shll_s.qh", "d,t,4", 0x7c000317, 0xfe0007ff, WR_d|RD_t, 0, D64 },
2705{"shll_s.w", "d,t,6", 0x7c000513, 0xfc0007ff, WR_d|RD_t, 0, D32 },
2706{"shllv.ob", "d,t,s", 0x7c000097, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2707{"shllv.ph", "d,t,s", 0x7c000293, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2708{"shllv.pw", "d,t,s", 0x7c000497, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2709{"shllv.qb", "d,t,s", 0x7c000093, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2710{"shllv.qh", "d,t,s", 0x7c000297, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2711{"shllv_s.ph", "d,t,s", 0x7c000393, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2712{"shllv_s.pw", "d,t,s", 0x7c000597, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2713{"shllv_s.qh", "d,t,s", 0x7c000397, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2714{"shllv_s.w", "d,t,s", 0x7c000593, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2715{"shra.ph", "d,t,4", 0x7c000253, 0xfe0007ff, WR_d|RD_t, 0, D32 },
2716{"shra.pw", "d,t,6", 0x7c000457, 0xfc0007ff, WR_d|RD_t, 0, D64 },
2717{"shra.qh", "d,t,4", 0x7c000257, 0xfe0007ff, WR_d|RD_t, 0, D64 },
2718{"shra_r.ph", "d,t,4", 0x7c000353, 0xfe0007ff, WR_d|RD_t, 0, D32 },
2719{"shra_r.pw", "d,t,6", 0x7c000557, 0xfc0007ff, WR_d|RD_t, 0, D64 },
2720{"shra_r.qh", "d,t,4", 0x7c000357, 0xfe0007ff, WR_d|RD_t, 0, D64 },
2721{"shra_r.w", "d,t,6", 0x7c000553, 0xfc0007ff, WR_d|RD_t, 0, D32 },
2722{"shrav.ph", "d,t,s", 0x7c0002d3, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2723{"shrav.pw", "d,t,s", 0x7c0004d7, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2724{"shrav.qh", "d,t,s", 0x7c0002d7, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2725{"shrav_r.ph", "d,t,s", 0x7c0003d3, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2726{"shrav_r.pw", "d,t,s", 0x7c0005d7, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2727{"shrav_r.qh", "d,t,s", 0x7c0003d7, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2728{"shrav_r.w", "d,t,s", 0x7c0005d3, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2729{"shrl.ob", "d,t,3", 0x7c000057, 0xff0007ff, WR_d|RD_t, 0, D64 },
2730{"shrl.qb", "d,t,3", 0x7c000053, 0xff0007ff, WR_d|RD_t, 0, D32 },
2731{"shrlv.ob", "d,t,s", 0x7c0000d7, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2732{"shrlv.qb", "d,t,s", 0x7c0000d3, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2733{"subq.ph", "d,s,t", 0x7c0002d0, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2734{"subq.pw", "d,s,t", 0x7c0004d4, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2735{"subq.qh", "d,s,t", 0x7c0002d4, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2736{"subq_s.ph", "d,s,t", 0x7c0003d0, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2737{"subq_s.pw", "d,s,t", 0x7c0005d4, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2738{"subq_s.qh", "d,s,t", 0x7c0003d4, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2739{"subq_s.w", "d,s,t", 0x7c0005d0, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2740{"subu.ob", "d,s,t", 0x7c000054, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2741{"subu.qb", "d,s,t", 0x7c000050, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2742{"subu_s.ob", "d,s,t", 0x7c000154, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D64 },
2743{"subu_s.qb", "d,s,t", 0x7c000150, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D32 },
2744{"wrdsp", "s", 0x7c1ffcf8, 0xfc1fffff, RD_s|DSP_VOLA, 0, D32 },
2745{"wrdsp", "s,8", 0x7c0004f8, 0xfc1e07ff, RD_s|DSP_VOLA, 0, D32 },
2746/* MIPS DSP ASE Rev2 */
2747{"absq_s.qb", "d,t", 0x7c000052, 0xffe007ff, WR_d|RD_t, 0, D33 },
2748{"addu.ph", "d,s,t", 0x7c000210, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D33 },
2749{"addu_s.ph", "d,s,t", 0x7c000310, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D33 },
2750{"adduh.qb", "d,s,t", 0x7c000018, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D33 },
2751{"adduh_r.qb", "d,s,t", 0x7c000098, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D33 },
2752{"append", "t,s,h", 0x7c000031, 0xfc0007ff, WR_t|RD_t|RD_s, 0, D33 },
2753{"balign", "t,s,I", 0, (int) M_BALIGN, INSN_MACRO, 0, D33 },
2754{"balign", "t,s,2", 0x7c000431, 0xfc00e7ff, WR_t|RD_t|RD_s, 0, D33 },
2755{"cmpgdu.eq.qb", "d,s,t", 0x7c000611, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D33 },
2756{"cmpgdu.lt.qb", "d,s,t", 0x7c000651, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D33 },
2757{"cmpgdu.le.qb", "d,s,t", 0x7c000691, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D33 },
2758{"dpa.w.ph", "7,s,t", 0x7c000030, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D33 },
2759{"dps.w.ph", "7,s,t", 0x7c000070, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D33 },
2760{"mul.ph", "d,s,t", 0x7c000318, 0xfc0007ff, WR_d|RD_s|RD_t|WR_HILO, 0, D33 },
2761{"mul_s.ph", "d,s,t", 0x7c000398, 0xfc0007ff, WR_d|RD_s|RD_t|WR_HILO, 0, D33 },
2762{"mulq_rs.w", "d,s,t", 0x7c0005d8, 0xfc0007ff, WR_d|RD_s|RD_t|WR_HILO, 0, D33 },
2763{"mulq_s.ph", "d,s,t", 0x7c000790, 0xfc0007ff, WR_d|RD_s|RD_t|WR_HILO, 0, D33 },
2764{"mulq_s.w", "d,s,t", 0x7c000598, 0xfc0007ff, WR_d|RD_s|RD_t|WR_HILO, 0, D33 },
2765{"mulsa.w.ph", "7,s,t", 0x7c0000b0, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D33 },
2766{"precr.qb.ph", "d,s,t", 0x7c000351, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D33 },
2767{"precr_sra.ph.w", "t,s,h", 0x7c000791, 0xfc0007ff, WR_t|RD_t|RD_s, 0, D33 },
2768{"precr_sra_r.ph.w", "t,s,h", 0x7c0007d1, 0xfc0007ff, WR_t|RD_t|RD_s, 0, D33 },
2769{"prepend", "t,s,h", 0x7c000071, 0xfc0007ff, WR_t|RD_t|RD_s, 0, D33 },
2770{"shra.qb", "d,t,3", 0x7c000113, 0xff0007ff, WR_d|RD_t, 0, D33 },
2771{"shra_r.qb", "d,t,3", 0x7c000153, 0xff0007ff, WR_d|RD_t, 0, D33 },
2772{"shrav.qb", "d,t,s", 0x7c000193, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D33 },
2773{"shrav_r.qb", "d,t,s", 0x7c0001d3, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D33 },
2774{"shrl.ph", "d,t,4", 0x7c000653, 0xfe0007ff, WR_d|RD_t, 0, D33 },
2775{"shrlv.ph", "d,t,s", 0x7c0006d3, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D33 },
2776{"subu.ph", "d,s,t", 0x7c000250, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D33 },
2777{"subu_s.ph", "d,s,t", 0x7c000350, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D33 },
2778{"subuh.qb", "d,s,t", 0x7c000058, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D33 },
2779{"subuh_r.qb", "d,s,t", 0x7c0000d8, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D33 },
2780{"addqh.ph", "d,s,t", 0x7c000218, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D33 },
2781{"addqh_r.ph", "d,s,t", 0x7c000298, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D33 },
2782{"addqh.w", "d,s,t", 0x7c000418, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D33 },
2783{"addqh_r.w", "d,s,t", 0x7c000498, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D33 },
2784{"subqh.ph", "d,s,t", 0x7c000258, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D33 },
2785{"subqh_r.ph", "d,s,t", 0x7c0002d8, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D33 },
2786{"subqh.w", "d,s,t", 0x7c000458, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D33 },
2787{"subqh_r.w", "d,s,t", 0x7c0004d8, 0xfc0007ff, WR_d|RD_s|RD_t, 0, D33 },
2788{"dpax.w.ph", "7,s,t", 0x7c000230, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D33 },
2789{"dpsx.w.ph", "7,s,t", 0x7c000270, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D33 },
2790{"dpaqx_s.w.ph", "7,s,t", 0x7c000630, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D33 },
2791{"dpaqx_sa.w.ph", "7,s,t", 0x7c0006b0, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D33 },
2792{"dpsqx_s.w.ph", "7,s,t", 0x7c000670, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D33 },
2793{"dpsqx_sa.w.ph", "7,s,t", 0x7c0006f0, 0xfc00e7ff, MOD_a|RD_s|RD_t, 0, D33 },
2794/* Move bc0* after mftr and mttr to avoid opcode collision. */
2795{"bc0f", "p", 0x41000000, 0xffff0000, CBD|RD_CC, 0, I1 },
2796{"bc0fl", "p", 0x41020000, 0xffff0000, CBL|RD_CC, 0, I2|T3 },
2797{"bc0t", "p", 0x41010000, 0xffff0000, CBD|RD_CC, 0, I1 },
2798{"bc0tl", "p", 0x41030000, 0xffff0000, CBL|RD_CC, 0, I2|T3 },
15656e09
AJ
2799/* ST Microelectronics Loongson-2E and -2F. */
2800{"mult.g", "d,s,t", 0x7c000018, 0xfc0007ff, RD_s|RD_t|WR_d, 0, IL2E },
2801{"mult.g", "d,s,t", 0x70000010, 0xfc0007ff, RD_s|RD_t|WR_d, 0, IL2F },
2802{"multu.g", "d,s,t", 0x7c000019, 0xfc0007ff, RD_s|RD_t|WR_d, 0, IL2E },
2803{"multu.g", "d,s,t", 0x70000012, 0xfc0007ff, RD_s|RD_t|WR_d, 0, IL2F },
2804{"dmult.g", "d,s,t", 0x7c00001c, 0xfc0007ff, RD_s|RD_t|WR_d, 0, IL2E },
2805{"dmult.g", "d,s,t", 0x70000011, 0xfc0007ff, RD_s|RD_t|WR_d, 0, IL2F },
2806{"dmultu.g", "d,s,t", 0x7c00001d, 0xfc0007ff, RD_s|RD_t|WR_d, 0, IL2E },
2807{"dmultu.g", "d,s,t", 0x70000013, 0xfc0007ff, RD_s|RD_t|WR_d, 0, IL2F },
2808{"div.g", "d,s,t", 0x7c00001a, 0xfc0007ff, RD_s|RD_t|WR_d, 0, IL2E },
2809{"div.g", "d,s,t", 0x70000014, 0xfc0007ff, RD_s|RD_t|WR_d, 0, IL2F },
2810{"divu.g", "d,s,t", 0x7c00001b, 0xfc0007ff, RD_s|RD_t|WR_d, 0, IL2E },
2811{"divu.g", "d,s,t", 0x70000016, 0xfc0007ff, RD_s|RD_t|WR_d, 0, IL2F },
2812{"ddiv.g", "d,s,t", 0x7c00001e, 0xfc0007ff, RD_s|RD_t|WR_d, 0, IL2E },
2813{"ddiv.g", "d,s,t", 0x70000015, 0xfc0007ff, RD_s|RD_t|WR_d, 0, IL2F },
2814{"ddivu.g", "d,s,t", 0x7c00001f, 0xfc0007ff, RD_s|RD_t|WR_d, 0, IL2E },
2815{"ddivu.g", "d,s,t", 0x70000017, 0xfc0007ff, RD_s|RD_t|WR_d, 0, IL2F },
2816{"mod.g", "d,s,t", 0x7c000022, 0xfc0007ff, RD_s|RD_t|WR_d, 0, IL2E },
2817{"mod.g", "d,s,t", 0x7000001c, 0xfc0007ff, RD_s|RD_t|WR_d, 0, IL2F },
2818{"modu.g", "d,s,t", 0x7c000023, 0xfc0007ff, RD_s|RD_t|WR_d, 0, IL2E },
2819{"modu.g", "d,s,t", 0x7000001e, 0xfc0007ff, RD_s|RD_t|WR_d, 0, IL2F },
2820{"dmod.g", "d,s,t", 0x7c000026, 0xfc0007ff, RD_s|RD_t|WR_d, 0, IL2E },
2821{"dmod.g", "d,s,t", 0x7000001d, 0xfc0007ff, RD_s|RD_t|WR_d, 0, IL2F },
2822{"dmodu.g", "d,s,t", 0x7c000027, 0xfc0007ff, RD_s|RD_t|WR_d, 0, IL2E },
2823{"dmodu.g", "d,s,t", 0x7000001f, 0xfc0007ff, RD_s|RD_t|WR_d, 0, IL2F },
6643d27e
FB
2824};
2825
2826#define MIPS_NUM_OPCODES \
2827 ((sizeof mips_builtin_opcodes) / (sizeof (mips_builtin_opcodes[0])))
2828const int bfd_mips_num_builtin_opcodes = MIPS_NUM_OPCODES;
2829
2830/* const removed from the following to allow for dynamic extensions to the
2831 * built-in instruction set. */
2832struct mips_opcode *mips_opcodes =
2833 (struct mips_opcode *) mips_builtin_opcodes;
2834int bfd_mips_num_opcodes = MIPS_NUM_OPCODES;
2835#undef MIPS_NUM_OPCODES
2836
6643d27e
FB
2837/* Mips instructions are at maximum this many bytes long. */
2838#define INSNLEN 4
2839
6643d27e
FB
2840\f
2841/* FIXME: These should be shared with gdb somehow. */
2842
52da07d1
TS
2843struct mips_cp0sel_name
2844{
2845 unsigned int cp0reg;
2846 unsigned int sel;
2847 const char * const name;
6643d27e
FB
2848};
2849
52da07d1
TS
2850/* The mips16 registers. */
2851static const unsigned int mips16_to_32_reg_map[] =
2852{
2853 16, 17, 2, 3, 4, 5, 6, 7
6643d27e
FB
2854};
2855
52da07d1
TS
2856#define mips16_reg_names(rn) mips_gpr_names[mips16_to_32_reg_map[rn]]
2857
2858
2859static const char * const mips_gpr_names_numeric[32] =
2860{
6643d27e
FB
2861 "$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7",
2862 "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15",
2863 "$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23",
2864 "$24", "$25", "$26", "$27", "$28", "$29", "$30", "$31"
2865};
2866
52da07d1
TS
2867static const char * const mips_gpr_names_oldabi[32] =
2868{
6643d27e
FB
2869 "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
2870 "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7",
2871 "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
2872 "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra"
2873};
2874
52da07d1
TS
2875static const char * const mips_gpr_names_newabi[32] =
2876{
6643d27e
FB
2877 "zero", "at", "v0", "v1", "a0", "a1", "a2", "a3",
2878 "a4", "a5", "a6", "a7", "t0", "t1", "t2", "t3",
2879 "s0", "s1", "s2", "s3", "s4", "s5", "s6", "s7",
2880 "t8", "t9", "k0", "k1", "gp", "sp", "s8", "ra"
2881};
2882
52da07d1
TS
2883static const char * const mips_fpr_names_numeric[32] =
2884{
6643d27e
FB
2885 "$f0", "$f1", "$f2", "$f3", "$f4", "$f5", "$f6", "$f7",
2886 "$f8", "$f9", "$f10", "$f11", "$f12", "$f13", "$f14", "$f15",
2887 "$f16", "$f17", "$f18", "$f19", "$f20", "$f21", "$f22", "$f23",
2888 "$f24", "$f25", "$f26", "$f27", "$f28", "$f29", "$f30", "$f31"
2889};
2890
52da07d1
TS
2891static const char * const mips_fpr_names_32[32] =
2892{
6643d27e
FB
2893 "fv0", "fv0f", "fv1", "fv1f", "ft0", "ft0f", "ft1", "ft1f",
2894 "ft2", "ft2f", "ft3", "ft3f", "fa0", "fa0f", "fa1", "fa1f",
2895 "ft4", "ft4f", "ft5", "ft5f", "fs0", "fs0f", "fs1", "fs1f",
2896 "fs2", "fs2f", "fs3", "fs3f", "fs4", "fs4f", "fs5", "fs5f"
2897};
2898
52da07d1
TS
2899static const char * const mips_fpr_names_n32[32] =
2900{
6643d27e
FB
2901 "fv0", "ft14", "fv1", "ft15", "ft0", "ft1", "ft2", "ft3",
2902 "ft4", "ft5", "ft6", "ft7", "fa0", "fa1", "fa2", "fa3",
2903 "fa4", "fa5", "fa6", "fa7", "fs0", "ft8", "fs1", "ft9",
2904 "fs2", "ft10", "fs3", "ft11", "fs4", "ft12", "fs5", "ft13"
2905};
2906
52da07d1
TS
2907static const char * const mips_fpr_names_64[32] =
2908{
6643d27e
FB
2909 "fv0", "ft12", "fv1", "ft13", "ft0", "ft1", "ft2", "ft3",
2910 "ft4", "ft5", "ft6", "ft7", "fa0", "fa1", "fa2", "fa3",
2911 "fa4", "fa5", "fa6", "fa7", "ft8", "ft9", "ft10", "ft11",
2912 "fs0", "fs1", "fs2", "fs3", "fs4", "fs5", "fs6", "fs7"
2913};
2914
52da07d1
TS
2915static const char * const mips_cp0_names_numeric[32] =
2916{
6643d27e
FB
2917 "$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7",
2918 "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15",
2919 "$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23",
2920 "$24", "$25", "$26", "$27", "$28", "$29", "$30", "$31"
2921};
2922
52da07d1
TS
2923static const char * const mips_cp0_names_mips3264[32] =
2924{
6643d27e
FB
2925 "c0_index", "c0_random", "c0_entrylo0", "c0_entrylo1",
2926 "c0_context", "c0_pagemask", "c0_wired", "$7",
2927 "c0_badvaddr", "c0_count", "c0_entryhi", "c0_compare",
2928 "c0_status", "c0_cause", "c0_epc", "c0_prid",
2929 "c0_config", "c0_lladdr", "c0_watchlo", "c0_watchhi",
2930 "c0_xcontext", "$21", "$22", "c0_debug",
2931 "c0_depc", "c0_perfcnt", "c0_errctl", "c0_cacheerr",
2932 "c0_taglo", "c0_taghi", "c0_errorepc", "c0_desave",
2933};
2934
52da07d1
TS
2935static const struct mips_cp0sel_name mips_cp0sel_names_mips3264[] =
2936{
2937 { 4, 1, "c0_contextconfig" },
2938 { 0, 1, "c0_mvpcontrol" },
2939 { 0, 2, "c0_mvpconf0" },
2940 { 0, 3, "c0_mvpconf1" },
2941 { 1, 1, "c0_vpecontrol" },
2942 { 1, 2, "c0_vpeconf0" },
2943 { 1, 3, "c0_vpeconf1" },
2944 { 1, 4, "c0_yqmask" },
2945 { 1, 5, "c0_vpeschedule" },
2946 { 1, 6, "c0_vpeschefback" },
2947 { 2, 1, "c0_tcstatus" },
2948 { 2, 2, "c0_tcbind" },
2949 { 2, 3, "c0_tcrestart" },
2950 { 2, 4, "c0_tchalt" },
2951 { 2, 5, "c0_tccontext" },
2952 { 2, 6, "c0_tcschedule" },
2953 { 2, 7, "c0_tcschefback" },
2954 { 5, 1, "c0_pagegrain" },
2955 { 6, 1, "c0_srsconf0" },
2956 { 6, 2, "c0_srsconf1" },
2957 { 6, 3, "c0_srsconf2" },
2958 { 6, 4, "c0_srsconf3" },
2959 { 6, 5, "c0_srsconf4" },
2960 { 12, 1, "c0_intctl" },
2961 { 12, 2, "c0_srsctl" },
2962 { 12, 3, "c0_srsmap" },
2963 { 15, 1, "c0_ebase" },
6643d27e
FB
2964 { 16, 1, "c0_config1" },
2965 { 16, 2, "c0_config2" },
2966 { 16, 3, "c0_config3" },
2967 { 18, 1, "c0_watchlo,1" },
2968 { 18, 2, "c0_watchlo,2" },
2969 { 18, 3, "c0_watchlo,3" },
2970 { 18, 4, "c0_watchlo,4" },
2971 { 18, 5, "c0_watchlo,5" },
2972 { 18, 6, "c0_watchlo,6" },
2973 { 18, 7, "c0_watchlo,7" },
2974 { 19, 1, "c0_watchhi,1" },
2975 { 19, 2, "c0_watchhi,2" },
2976 { 19, 3, "c0_watchhi,3" },
2977 { 19, 4, "c0_watchhi,4" },
2978 { 19, 5, "c0_watchhi,5" },
2979 { 19, 6, "c0_watchhi,6" },
2980 { 19, 7, "c0_watchhi,7" },
52da07d1
TS
2981 { 23, 1, "c0_tracecontrol" },
2982 { 23, 2, "c0_tracecontrol2" },
2983 { 23, 3, "c0_usertracedata" },
2984 { 23, 4, "c0_tracebpc" },
6643d27e
FB
2985 { 25, 1, "c0_perfcnt,1" },
2986 { 25, 2, "c0_perfcnt,2" },
2987 { 25, 3, "c0_perfcnt,3" },
2988 { 25, 4, "c0_perfcnt,4" },
2989 { 25, 5, "c0_perfcnt,5" },
2990 { 25, 6, "c0_perfcnt,6" },
2991 { 25, 7, "c0_perfcnt,7" },
2992 { 27, 1, "c0_cacheerr,1" },
2993 { 27, 2, "c0_cacheerr,2" },
2994 { 27, 3, "c0_cacheerr,3" },
2995 { 28, 1, "c0_datalo" },
52da07d1
TS
2996 { 28, 2, "c0_taglo1" },
2997 { 28, 3, "c0_datalo1" },
2998 { 28, 4, "c0_taglo2" },
2999 { 28, 5, "c0_datalo2" },
3000 { 28, 6, "c0_taglo3" },
3001 { 28, 7, "c0_datalo3" },
3002 { 29, 1, "c0_datahi" },
3003 { 29, 2, "c0_taghi1" },
3004 { 29, 3, "c0_datahi1" },
3005 { 29, 4, "c0_taghi2" },
3006 { 29, 5, "c0_datahi2" },
3007 { 29, 6, "c0_taghi3" },
3008 { 29, 7, "c0_datahi3" },
6643d27e
FB
3009};
3010
52da07d1
TS
3011static const char * const mips_cp0_names_mips3264r2[32] =
3012{
6643d27e
FB
3013 "c0_index", "c0_random", "c0_entrylo0", "c0_entrylo1",
3014 "c0_context", "c0_pagemask", "c0_wired", "c0_hwrena",
3015 "c0_badvaddr", "c0_count", "c0_entryhi", "c0_compare",
3016 "c0_status", "c0_cause", "c0_epc", "c0_prid",
3017 "c0_config", "c0_lladdr", "c0_watchlo", "c0_watchhi",
3018 "c0_xcontext", "$21", "$22", "c0_debug",
3019 "c0_depc", "c0_perfcnt", "c0_errctl", "c0_cacheerr",
3020 "c0_taglo", "c0_taghi", "c0_errorepc", "c0_desave",
3021};
3022
52da07d1
TS
3023static const struct mips_cp0sel_name mips_cp0sel_names_mips3264r2[] =
3024{
6643d27e
FB
3025 { 4, 1, "c0_contextconfig" },
3026 { 5, 1, "c0_pagegrain" },
3027 { 12, 1, "c0_intctl" },
3028 { 12, 2, "c0_srsctl" },
3029 { 12, 3, "c0_srsmap" },
3030 { 15, 1, "c0_ebase" },
3031 { 16, 1, "c0_config1" },
3032 { 16, 2, "c0_config2" },
3033 { 16, 3, "c0_config3" },
3034 { 18, 1, "c0_watchlo,1" },
3035 { 18, 2, "c0_watchlo,2" },
3036 { 18, 3, "c0_watchlo,3" },
3037 { 18, 4, "c0_watchlo,4" },
3038 { 18, 5, "c0_watchlo,5" },
3039 { 18, 6, "c0_watchlo,6" },
3040 { 18, 7, "c0_watchlo,7" },
3041 { 19, 1, "c0_watchhi,1" },
3042 { 19, 2, "c0_watchhi,2" },
3043 { 19, 3, "c0_watchhi,3" },
3044 { 19, 4, "c0_watchhi,4" },
3045 { 19, 5, "c0_watchhi,5" },
3046 { 19, 6, "c0_watchhi,6" },
3047 { 19, 7, "c0_watchhi,7" },
3048 { 23, 1, "c0_tracecontrol" },
3049 { 23, 2, "c0_tracecontrol2" },
3050 { 23, 3, "c0_usertracedata" },
3051 { 23, 4, "c0_tracebpc" },
3052 { 25, 1, "c0_perfcnt,1" },
3053 { 25, 2, "c0_perfcnt,2" },
3054 { 25, 3, "c0_perfcnt,3" },
3055 { 25, 4, "c0_perfcnt,4" },
3056 { 25, 5, "c0_perfcnt,5" },
3057 { 25, 6, "c0_perfcnt,6" },
3058 { 25, 7, "c0_perfcnt,7" },
3059 { 27, 1, "c0_cacheerr,1" },
3060 { 27, 2, "c0_cacheerr,2" },
3061 { 27, 3, "c0_cacheerr,3" },
3062 { 28, 1, "c0_datalo" },
3063 { 28, 2, "c0_taglo1" },
3064 { 28, 3, "c0_datalo1" },
3065 { 28, 4, "c0_taglo2" },
3066 { 28, 5, "c0_datalo2" },
3067 { 28, 6, "c0_taglo3" },
3068 { 28, 7, "c0_datalo3" },
3069 { 29, 1, "c0_datahi" },
3070 { 29, 2, "c0_taghi1" },
3071 { 29, 3, "c0_datahi1" },
3072 { 29, 4, "c0_taghi2" },
3073 { 29, 5, "c0_datahi2" },
3074 { 29, 6, "c0_taghi3" },
3075 { 29, 7, "c0_datahi3" },
3076};
3077
3078/* SB-1: MIPS64 (mips_cp0_names_mips3264) with minor mods. */
52da07d1
TS
3079static const char * const mips_cp0_names_sb1[32] =
3080{
6643d27e
FB
3081 "c0_index", "c0_random", "c0_entrylo0", "c0_entrylo1",
3082 "c0_context", "c0_pagemask", "c0_wired", "$7",
3083 "c0_badvaddr", "c0_count", "c0_entryhi", "c0_compare",
3084 "c0_status", "c0_cause", "c0_epc", "c0_prid",
3085 "c0_config", "c0_lladdr", "c0_watchlo", "c0_watchhi",
3086 "c0_xcontext", "$21", "$22", "c0_debug",
3087 "c0_depc", "c0_perfcnt", "c0_errctl", "c0_cacheerr_i",
3088 "c0_taglo_i", "c0_taghi_i", "c0_errorepc", "c0_desave",
3089};
3090
52da07d1
TS
3091static const struct mips_cp0sel_name mips_cp0sel_names_sb1[] =
3092{
6643d27e
FB
3093 { 16, 1, "c0_config1" },
3094 { 18, 1, "c0_watchlo,1" },
3095 { 19, 1, "c0_watchhi,1" },
3096 { 22, 0, "c0_perftrace" },
3097 { 23, 3, "c0_edebug" },
3098 { 25, 1, "c0_perfcnt,1" },
3099 { 25, 2, "c0_perfcnt,2" },
3100 { 25, 3, "c0_perfcnt,3" },
3101 { 25, 4, "c0_perfcnt,4" },
3102 { 25, 5, "c0_perfcnt,5" },
3103 { 25, 6, "c0_perfcnt,6" },
3104 { 25, 7, "c0_perfcnt,7" },
3105 { 26, 1, "c0_buserr_pa" },
3106 { 27, 1, "c0_cacheerr_d" },
3107 { 27, 3, "c0_cacheerr_d_pa" },
3108 { 28, 1, "c0_datalo_i" },
3109 { 28, 2, "c0_taglo_d" },
3110 { 28, 3, "c0_datalo_d" },
3111 { 29, 1, "c0_datahi_i" },
3112 { 29, 2, "c0_taghi_d" },
3113 { 29, 3, "c0_datahi_d" },
3114};
3115
52da07d1
TS
3116static const char * const mips_hwr_names_numeric[32] =
3117{
6643d27e
FB
3118 "$0", "$1", "$2", "$3", "$4", "$5", "$6", "$7",
3119 "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15",
3120 "$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23",
3121 "$24", "$25", "$26", "$27", "$28", "$29", "$30", "$31"
3122};
3123
52da07d1
TS
3124static const char * const mips_hwr_names_mips3264r2[32] =
3125{
6643d27e
FB
3126 "hwr_cpunum", "hwr_synci_step", "hwr_cc", "hwr_ccres",
3127 "$4", "$5", "$6", "$7",
3128 "$8", "$9", "$10", "$11", "$12", "$13", "$14", "$15",
3129 "$16", "$17", "$18", "$19", "$20", "$21", "$22", "$23",
3130 "$24", "$25", "$26", "$27", "$28", "$29", "$30", "$31"
3131};
3132
52da07d1
TS
3133struct mips_abi_choice
3134{
6643d27e
FB
3135 const char *name;
3136 const char * const *gpr_names;
3137 const char * const *fpr_names;
3138};
3139
72139e83 3140static struct mips_abi_choice mips_abi_choices[] =
52da07d1 3141{
6643d27e
FB
3142 { "numeric", mips_gpr_names_numeric, mips_fpr_names_numeric },
3143 { "32", mips_gpr_names_oldabi, mips_fpr_names_32 },
3144 { "n32", mips_gpr_names_newabi, mips_fpr_names_n32 },
3145 { "64", mips_gpr_names_newabi, mips_fpr_names_64 },
3146};
3147
52da07d1
TS
3148struct mips_arch_choice
3149{
6643d27e
FB
3150 const char *name;
3151 int bfd_mach_valid;
3152 unsigned long bfd_mach;
3153 int processor;
3154 int isa;
3155 const char * const *cp0_names;
3156 const struct mips_cp0sel_name *cp0sel_names;
3157 unsigned int cp0sel_names_len;
3158 const char * const *hwr_names;
3159};
3160
3161#define bfd_mach_mips3000 3000
3162#define bfd_mach_mips3900 3900
3163#define bfd_mach_mips4000 4000
3164#define bfd_mach_mips4010 4010
3165#define bfd_mach_mips4100 4100
3166#define bfd_mach_mips4111 4111
3167#define bfd_mach_mips4120 4120
3168#define bfd_mach_mips4300 4300
3169#define bfd_mach_mips4400 4400
3170#define bfd_mach_mips4600 4600
3171#define bfd_mach_mips4650 4650
3172#define bfd_mach_mips5000 5000
3173#define bfd_mach_mips5400 5400
3174#define bfd_mach_mips5500 5500
3175#define bfd_mach_mips6000 6000
3176#define bfd_mach_mips7000 7000
3177#define bfd_mach_mips8000 8000
52da07d1 3178#define bfd_mach_mips9000 9000
6643d27e
FB
3179#define bfd_mach_mips10000 10000
3180#define bfd_mach_mips12000 12000
3181#define bfd_mach_mips16 16
3182#define bfd_mach_mips5 5
3183#define bfd_mach_mips_sb1 12310201 /* octal 'SB', 01 */
3184#define bfd_mach_mipsisa32 32
3185#define bfd_mach_mipsisa32r2 33
3186#define bfd_mach_mipsisa64 64
3187#define bfd_mach_mipsisa64r2 65
3188
72139e83 3189static const struct mips_arch_choice mips_arch_choices[] =
52da07d1 3190{
6643d27e
FB
3191 { "numeric", 0, 0, 0, 0,
3192 mips_cp0_names_numeric, NULL, 0, mips_hwr_names_numeric },
3193
3194 { "r3000", 1, bfd_mach_mips3000, CPU_R3000, ISA_MIPS1,
3195 mips_cp0_names_numeric, NULL, 0, mips_hwr_names_numeric },
3196 { "r3900", 1, bfd_mach_mips3900, CPU_R3900, ISA_MIPS1,
3197 mips_cp0_names_numeric, NULL, 0, mips_hwr_names_numeric },
3198 { "r4000", 1, bfd_mach_mips4000, CPU_R4000, ISA_MIPS3,
3199 mips_cp0_names_numeric, NULL, 0, mips_hwr_names_numeric },
3200 { "r4010", 1, bfd_mach_mips4010, CPU_R4010, ISA_MIPS2,
3201 mips_cp0_names_numeric, NULL, 0, mips_hwr_names_numeric },
3202 { "vr4100", 1, bfd_mach_mips4100, CPU_VR4100, ISA_MIPS3,
3203 mips_cp0_names_numeric, NULL, 0, mips_hwr_names_numeric },
3204 { "vr4111", 1, bfd_mach_mips4111, CPU_R4111, ISA_MIPS3,
3205 mips_cp0_names_numeric, NULL, 0, mips_hwr_names_numeric },
3206 { "vr4120", 1, bfd_mach_mips4120, CPU_VR4120, ISA_MIPS3,
3207 mips_cp0_names_numeric, NULL, 0, mips_hwr_names_numeric },
3208 { "r4300", 1, bfd_mach_mips4300, CPU_R4300, ISA_MIPS3,
3209 mips_cp0_names_numeric, NULL, 0, mips_hwr_names_numeric },
3210 { "r4400", 1, bfd_mach_mips4400, CPU_R4400, ISA_MIPS3,
3211 mips_cp0_names_numeric, NULL, 0, mips_hwr_names_numeric },
3212 { "r4600", 1, bfd_mach_mips4600, CPU_R4600, ISA_MIPS3,
3213 mips_cp0_names_numeric, NULL, 0, mips_hwr_names_numeric },
3214 { "r4650", 1, bfd_mach_mips4650, CPU_R4650, ISA_MIPS3,
3215 mips_cp0_names_numeric, NULL, 0, mips_hwr_names_numeric },
3216 { "r5000", 1, bfd_mach_mips5000, CPU_R5000, ISA_MIPS4,
3217 mips_cp0_names_numeric, NULL, 0, mips_hwr_names_numeric },
3218 { "vr5400", 1, bfd_mach_mips5400, CPU_VR5400, ISA_MIPS4,
3219 mips_cp0_names_numeric, NULL, 0, mips_hwr_names_numeric },
3220 { "vr5500", 1, bfd_mach_mips5500, CPU_VR5500, ISA_MIPS4,
3221 mips_cp0_names_numeric, NULL, 0, mips_hwr_names_numeric },
3222 { "r6000", 1, bfd_mach_mips6000, CPU_R6000, ISA_MIPS2,
3223 mips_cp0_names_numeric, NULL, 0, mips_hwr_names_numeric },
3224 { "rm7000", 1, bfd_mach_mips7000, CPU_RM7000, ISA_MIPS4,
3225 mips_cp0_names_numeric, NULL, 0, mips_hwr_names_numeric },
3226 { "rm9000", 1, bfd_mach_mips7000, CPU_RM7000, ISA_MIPS4,
3227 mips_cp0_names_numeric, NULL, 0, mips_hwr_names_numeric },
3228 { "r8000", 1, bfd_mach_mips8000, CPU_R8000, ISA_MIPS4,
3229 mips_cp0_names_numeric, NULL, 0, mips_hwr_names_numeric },
3230 { "r10000", 1, bfd_mach_mips10000, CPU_R10000, ISA_MIPS4,
3231 mips_cp0_names_numeric, NULL, 0, mips_hwr_names_numeric },
3232 { "r12000", 1, bfd_mach_mips12000, CPU_R12000, ISA_MIPS4,
3233 mips_cp0_names_numeric, NULL, 0, mips_hwr_names_numeric },
3234 { "mips5", 1, bfd_mach_mips5, CPU_MIPS5, ISA_MIPS5,
3235 mips_cp0_names_numeric, NULL, 0, mips_hwr_names_numeric },
3236
3237 /* For stock MIPS32, disassemble all applicable MIPS-specified ASEs.
3238 Note that MIPS-3D and MDMX are not applicable to MIPS32. (See
3239 _MIPS32 Architecture For Programmers Volume I: Introduction to the
3240 MIPS32 Architecture_ (MIPS Document Number MD00082, Revision 0.95),
3241 page 1. */
3242 { "mips32", 1, bfd_mach_mipsisa32, CPU_MIPS32,
52da07d1 3243 ISA_MIPS32 | INSN_MIPS16 | INSN_SMARTMIPS,
6643d27e
FB
3244 mips_cp0_names_mips3264,
3245 mips_cp0sel_names_mips3264, ARRAY_SIZE (mips_cp0sel_names_mips3264),
3246 mips_hwr_names_numeric },
3247
3248 { "mips32r2", 1, bfd_mach_mipsisa32r2, CPU_MIPS32R2,
52da07d1
TS
3249 (ISA_MIPS32R2 | INSN_MIPS16 | INSN_SMARTMIPS | INSN_DSP | INSN_DSPR2
3250 | INSN_MIPS3D | INSN_MT),
6643d27e
FB
3251 mips_cp0_names_mips3264r2,
3252 mips_cp0sel_names_mips3264r2, ARRAY_SIZE (mips_cp0sel_names_mips3264r2),
3253 mips_hwr_names_mips3264r2 },
3254
3255 /* For stock MIPS64, disassemble all applicable MIPS-specified ASEs. */
3256 { "mips64", 1, bfd_mach_mipsisa64, CPU_MIPS64,
3257 ISA_MIPS64 | INSN_MIPS16 | INSN_MIPS3D | INSN_MDMX,
3258 mips_cp0_names_mips3264,
3259 mips_cp0sel_names_mips3264, ARRAY_SIZE (mips_cp0sel_names_mips3264),
3260 mips_hwr_names_numeric },
3261
3262 { "mips64r2", 1, bfd_mach_mipsisa64r2, CPU_MIPS64R2,
52da07d1
TS
3263 (ISA_MIPS64R2 | INSN_MIPS16 | INSN_MIPS3D | INSN_DSP | INSN_DSPR2
3264 | INSN_DSP64 | INSN_MT | INSN_MDMX),
6643d27e
FB
3265 mips_cp0_names_mips3264r2,
3266 mips_cp0sel_names_mips3264r2, ARRAY_SIZE (mips_cp0sel_names_mips3264r2),
3267 mips_hwr_names_mips3264r2 },
3268
3269 { "sb1", 1, bfd_mach_mips_sb1, CPU_SB1,
3270 ISA_MIPS64 | INSN_MIPS3D | INSN_SB1,
3271 mips_cp0_names_sb1,
3272 mips_cp0sel_names_sb1, ARRAY_SIZE (mips_cp0sel_names_sb1),
3273 mips_hwr_names_numeric },
3274
3275 /* This entry, mips16, is here only for ISA/processor selection; do
3276 not print its name. */
3277 { "", 1, bfd_mach_mips16, CPU_MIPS16, ISA_MIPS3 | INSN_MIPS16,
3278 mips_cp0_names_numeric, NULL, 0, mips_hwr_names_numeric },
3279};
3280
3281/* ISA and processor type to disassemble for, and register names to use.
3282 set_default_mips_dis_options and parse_mips_dis_options fill in these
3283 values. */
3284static int mips_processor;
3285static int mips_isa;
3286static const char * const *mips_gpr_names;
3287static const char * const *mips_fpr_names;
3288static const char * const *mips_cp0_names;
3289static const struct mips_cp0sel_name *mips_cp0sel_names;
3290static int mips_cp0sel_names_len;
3291static const char * const *mips_hwr_names;
3292
52da07d1
TS
3293/* Other options */
3294static int no_aliases; /* If set disassemble as most general inst. */
6643d27e
FB
3295\f
3296static const struct mips_abi_choice *
52da07d1 3297choose_abi_by_name (const char *name, unsigned int namelen)
6643d27e
FB
3298{
3299 const struct mips_abi_choice *c;
3300 unsigned int i;
3301
3302 for (i = 0, c = NULL; i < ARRAY_SIZE (mips_abi_choices) && c == NULL; i++)
52da07d1
TS
3303 if (strncmp (mips_abi_choices[i].name, name, namelen) == 0
3304 && strlen (mips_abi_choices[i].name) == namelen)
3305 c = &mips_abi_choices[i];
3306
6643d27e
FB
3307 return c;
3308}
3309
3310static const struct mips_arch_choice *
52da07d1 3311choose_arch_by_name (const char *name, unsigned int namelen)
6643d27e
FB
3312{
3313 const struct mips_arch_choice *c = NULL;
3314 unsigned int i;
3315
3316 for (i = 0, c = NULL; i < ARRAY_SIZE (mips_arch_choices) && c == NULL; i++)
52da07d1
TS
3317 if (strncmp (mips_arch_choices[i].name, name, namelen) == 0
3318 && strlen (mips_arch_choices[i].name) == namelen)
3319 c = &mips_arch_choices[i];
3320
6643d27e
FB
3321 return c;
3322}
3323
3324static const struct mips_arch_choice *
52da07d1 3325choose_arch_by_number (unsigned long mach)
6643d27e
FB
3326{
3327 static unsigned long hint_bfd_mach;
3328 static const struct mips_arch_choice *hint_arch_choice;
3329 const struct mips_arch_choice *c;
3330 unsigned int i;
3331
3332 /* We optimize this because even if the user specifies no
3333 flags, this will be done for every instruction! */
3334 if (hint_bfd_mach == mach
3335 && hint_arch_choice != NULL
3336 && hint_arch_choice->bfd_mach == hint_bfd_mach)
3337 return hint_arch_choice;
3338
3339 for (i = 0, c = NULL; i < ARRAY_SIZE (mips_arch_choices) && c == NULL; i++)
3340 {
3341 if (mips_arch_choices[i].bfd_mach_valid
3342 && mips_arch_choices[i].bfd_mach == mach)
3343 {
3344 c = &mips_arch_choices[i];
3345 hint_bfd_mach = mach;
3346 hint_arch_choice = c;
3347 }
3348 }
3349 return c;
3350}
3351
f9480ffc 3352static void
52da07d1 3353set_default_mips_dis_options (struct disassemble_info *info)
6643d27e
FB
3354{
3355 const struct mips_arch_choice *chosen_arch;
3356
3357 /* Defaults: mipsIII/r3000 (?!), (o)32-style ("oldabi") GPR names,
3358 and numeric FPR, CP0 register, and HWR names. */
3359 mips_isa = ISA_MIPS3;
3360 mips_processor = CPU_R3000;
3361 mips_gpr_names = mips_gpr_names_oldabi;
3362 mips_fpr_names = mips_fpr_names_numeric;
3363 mips_cp0_names = mips_cp0_names_numeric;
3364 mips_cp0sel_names = NULL;
3365 mips_cp0sel_names_len = 0;
3366 mips_hwr_names = mips_hwr_names_numeric;
52da07d1 3367 no_aliases = 0;
6643d27e
FB
3368
3369 /* If an ELF "newabi" binary, use the n32/(n)64 GPR names. */
3370#if 0
3371 if (info->flavour == bfd_target_elf_flavour && info->section != NULL)
3372 {
3373 Elf_Internal_Ehdr *header;
3374
3375 header = elf_elfheader (info->section->owner);
3376 if (is_newabi (header))
3377 mips_gpr_names = mips_gpr_names_newabi;
3378 }
3379#endif
3380
3381 /* Set ISA, architecture, and cp0 register names as best we can. */
eb38c52c 3382#if !defined(SYMTAB_AVAILABLE) && 0
6643d27e
FB
3383 /* This is running out on a target machine, not in a host tool.
3384 FIXME: Where does mips_target_info come from? */
3385 target_processor = mips_target_info.processor;
3386 mips_isa = mips_target_info.isa;
3387#else
3388 chosen_arch = choose_arch_by_number (info->mach);
3389 if (chosen_arch != NULL)
3390 {
3391 mips_processor = chosen_arch->processor;
3392 mips_isa = chosen_arch->isa;
3393 mips_cp0_names = chosen_arch->cp0_names;
3394 mips_cp0sel_names = chosen_arch->cp0sel_names;
3395 mips_cp0sel_names_len = chosen_arch->cp0sel_names_len;
3396 mips_hwr_names = chosen_arch->hwr_names;
3397 }
3398#endif
3399}
3400
f9480ffc 3401static void
a5f1b965 3402parse_mips_dis_option (const char *option, unsigned int len)
6643d27e
FB
3403{
3404 unsigned int i, optionlen, vallen;
3405 const char *val;
3406 const struct mips_abi_choice *chosen_abi;
3407 const struct mips_arch_choice *chosen_arch;
3408
3409 /* Look for the = that delimits the end of the option name. */
3410 for (i = 0; i < len; i++)
3411 {
3412 if (option[i] == '=')
3413 break;
3414 }
3415 if (i == 0) /* Invalid option: no name before '='. */
3416 return;
3417 if (i == len) /* Invalid option: no '='. */
3418 return;
3419 if (i == (len - 1)) /* Invalid option: no value after '='. */
3420 return;
3421
3422 optionlen = i;
3423 val = option + (optionlen + 1);
3424 vallen = len - (optionlen + 1);
3425
3426 if (strncmp("gpr-names", option, optionlen) == 0
3427 && strlen("gpr-names") == optionlen)
3428 {
3429 chosen_abi = choose_abi_by_name (val, vallen);
3430 if (chosen_abi != NULL)
3431 mips_gpr_names = chosen_abi->gpr_names;
3432 return;
3433 }
3434
3435 if (strncmp("fpr-names", option, optionlen) == 0
3436 && strlen("fpr-names") == optionlen)
3437 {
3438 chosen_abi = choose_abi_by_name (val, vallen);
3439 if (chosen_abi != NULL)
3440 mips_fpr_names = chosen_abi->fpr_names;
3441 return;
3442 }
3443
3444 if (strncmp("cp0-names", option, optionlen) == 0
3445 && strlen("cp0-names") == optionlen)
3446 {
3447 chosen_arch = choose_arch_by_name (val, vallen);
3448 if (chosen_arch != NULL)
3449 {
3450 mips_cp0_names = chosen_arch->cp0_names;
3451 mips_cp0sel_names = chosen_arch->cp0sel_names;
3452 mips_cp0sel_names_len = chosen_arch->cp0sel_names_len;
3453 }
3454 return;
3455 }
3456
3457 if (strncmp("hwr-names", option, optionlen) == 0
3458 && strlen("hwr-names") == optionlen)
3459 {
3460 chosen_arch = choose_arch_by_name (val, vallen);
3461 if (chosen_arch != NULL)
3462 mips_hwr_names = chosen_arch->hwr_names;
3463 return;
3464 }
3465
3466 if (strncmp("reg-names", option, optionlen) == 0
3467 && strlen("reg-names") == optionlen)
3468 {
3469 /* We check both ABI and ARCH here unconditionally, so
3470 that "numeric" will do the desirable thing: select
3471 numeric register names for all registers. Other than
3472 that, a given name probably won't match both. */
3473 chosen_abi = choose_abi_by_name (val, vallen);
3474 if (chosen_abi != NULL)
3475 {
3476 mips_gpr_names = chosen_abi->gpr_names;
3477 mips_fpr_names = chosen_abi->fpr_names;
3478 }
3479 chosen_arch = choose_arch_by_name (val, vallen);
3480 if (chosen_arch != NULL)
3481 {
3482 mips_cp0_names = chosen_arch->cp0_names;
3483 mips_cp0sel_names = chosen_arch->cp0sel_names;
3484 mips_cp0sel_names_len = chosen_arch->cp0sel_names_len;
3485 mips_hwr_names = chosen_arch->hwr_names;
3486 }
3487 return;
3488 }
3489
3490 /* Invalid option. */
3491}
3492
52da07d1
TS
3493static void
3494parse_mips_dis_options (const char *options)
6643d27e
FB
3495{
3496 const char *option_end;
3497
3498 if (options == NULL)
3499 return;
3500
3501 while (*options != '\0')
3502 {
3503 /* Skip empty options. */
3504 if (*options == ',')
3505 {
3506 options++;
3507 continue;
3508 }
3509
3510 /* We know that *options is neither NUL or a comma. */
3511 option_end = options + 1;
3512 while (*option_end != ',' && *option_end != '\0')
3513 option_end++;
3514
3515 parse_mips_dis_option (options, option_end - options);
3516
3517 /* Go on to the next one. If option_end points to a comma, it
3518 will be skipped above. */
3519 options = option_end;
3520 }
3521}
3522
3523static const struct mips_cp0sel_name *
52da07d1
TS
3524lookup_mips_cp0sel_name (const struct mips_cp0sel_name *names,
3525 unsigned int len,
3526 unsigned int cp0reg,
3527 unsigned int sel)
6643d27e
FB
3528{
3529 unsigned int i;
3530
3531 for (i = 0; i < len; i++)
3532 if (names[i].cp0reg == cp0reg && names[i].sel == sel)
3533 return &names[i];
3534 return NULL;
3535}
3536\f
3537/* Print insn arguments for 32/64-bit code. */
3538
3539static void
52da07d1
TS
3540print_insn_args (const char *d,
3541 register unsigned long int l,
3542 bfd_vma pc,
3543 struct disassemble_info *info,
3544 const struct mips_opcode *opp)
6643d27e
FB
3545{
3546 int op, delta;
3547 unsigned int lsb, msb, msbd;
3548
3549 lsb = 0;
3550
3551 for (; *d != '\0'; d++)
3552 {
3553 switch (*d)
3554 {
3555 case ',':
3556 case '(':
3557 case ')':
3558 case '[':
3559 case ']':
3560 (*info->fprintf_func) (info->stream, "%c", *d);
3561 break;
3562
3563 case '+':
3564 /* Extension character; switch for second char. */
3565 d++;
3566 switch (*d)
3567 {
3568 case '\0':
3569 /* xgettext:c-format */
3570 (*info->fprintf_func) (info->stream,
3571 _("# internal error, incomplete extension sequence (+)"));
3572 return;
3573
3574 case 'A':
3575 lsb = (l >> OP_SH_SHAMT) & OP_MASK_SHAMT;
3576 (*info->fprintf_func) (info->stream, "0x%x", lsb);
3577 break;
52da07d1 3578
6643d27e
FB
3579 case 'B':
3580 msb = (l >> OP_SH_INSMSB) & OP_MASK_INSMSB;
3581 (*info->fprintf_func) (info->stream, "0x%x", msb - lsb + 1);
3582 break;
3583
52da07d1
TS
3584 case '1':
3585 (*info->fprintf_func) (info->stream, "0x%lx",
3586 (l >> OP_SH_UDI1) & OP_MASK_UDI1);
3587 break;
3588
3589 case '2':
3590 (*info->fprintf_func) (info->stream, "0x%lx",
3591 (l >> OP_SH_UDI2) & OP_MASK_UDI2);
3592 break;
3593
3594 case '3':
3595 (*info->fprintf_func) (info->stream, "0x%lx",
3596 (l >> OP_SH_UDI3) & OP_MASK_UDI3);
3597 break;
3598
3599 case '4':
3600 (*info->fprintf_func) (info->stream, "0x%lx",
3601 (l >> OP_SH_UDI4) & OP_MASK_UDI4);
3602 break;
3603
6643d27e
FB
3604 case 'C':
3605 case 'H':
3606 msbd = (l >> OP_SH_EXTMSBD) & OP_MASK_EXTMSBD;
3607 (*info->fprintf_func) (info->stream, "0x%x", msbd + 1);
3608 break;
3609
3610 case 'D':
3611 {
3612 const struct mips_cp0sel_name *n;
3613 unsigned int cp0reg, sel;
3614
3615 cp0reg = (l >> OP_SH_RD) & OP_MASK_RD;
3616 sel = (l >> OP_SH_SEL) & OP_MASK_SEL;
3617
3618 /* CP0 register including 'sel' code for mtcN (et al.), to be
3619 printed textually if known. If not known, print both
3620 CP0 register name and sel numerically since CP0 register
3621 with sel 0 may have a name unrelated to register being
3622 printed. */
3623 n = lookup_mips_cp0sel_name(mips_cp0sel_names,
3624 mips_cp0sel_names_len, cp0reg, sel);
3625 if (n != NULL)
3626 (*info->fprintf_func) (info->stream, "%s", n->name);
3627 else
3628 (*info->fprintf_func) (info->stream, "$%d,%d", cp0reg, sel);
3629 break;
3630 }
3631
3632 case 'E':
3633 lsb = ((l >> OP_SH_SHAMT) & OP_MASK_SHAMT) + 32;
3634 (*info->fprintf_func) (info->stream, "0x%x", lsb);
3635 break;
5fafdf24 3636
6643d27e
FB
3637 case 'F':
3638 msb = ((l >> OP_SH_INSMSB) & OP_MASK_INSMSB) + 32;
3639 (*info->fprintf_func) (info->stream, "0x%x", msb - lsb + 1);
3640 break;
3641
3642 case 'G':
3643 msbd = ((l >> OP_SH_EXTMSBD) & OP_MASK_EXTMSBD) + 32;
3644 (*info->fprintf_func) (info->stream, "0x%x", msbd + 1);
3645 break;
3646
31837be3
YK
3647 case 'o':
3648 delta = (l >> OP_SH_DELTA_R6) & OP_MASK_DELTA_R6;
3649 if (delta & 0x8000) {
3650 delta |= ~0xffff;
3651 }
3652 (*info->fprintf_func) (info->stream, "%d", delta);
3653 break;
3654
3655 case 'p':
3656 /* Sign extend the displacement with 26 bits. */
3657 delta = (l >> OP_SH_DELTA) & OP_MASK_TARGET;
3658 if (delta & 0x2000000) {
3659 delta |= ~0x3FFFFFF;
3660 }
3661 info->target = (delta << 2) + pc + INSNLEN;
3662 (*info->print_address_func) (info->target, info);
3663 break;
3664
52da07d1
TS
3665 case 't': /* Coprocessor 0 reg name */
3666 (*info->fprintf_func) (info->stream, "%s",
3667 mips_cp0_names[(l >> OP_SH_RT) &
3668 OP_MASK_RT]);
3669 break;
3670
3671 case 'T': /* Coprocessor 0 reg name */
3672 {
3673 const struct mips_cp0sel_name *n;
3674 unsigned int cp0reg, sel;
3675
3676 cp0reg = (l >> OP_SH_RT) & OP_MASK_RT;
3677 sel = (l >> OP_SH_SEL) & OP_MASK_SEL;
3678
3679 /* CP0 register including 'sel' code for mftc0, to be
3680 printed textually if known. If not known, print both
3681 CP0 register name and sel numerically since CP0 register
3682 with sel 0 may have a name unrelated to register being
3683 printed. */
3684 n = lookup_mips_cp0sel_name(mips_cp0sel_names,
3685 mips_cp0sel_names_len, cp0reg, sel);
3686 if (n != NULL)
3687 (*info->fprintf_func) (info->stream, "%s", n->name);
3688 else
3689 (*info->fprintf_func) (info->stream, "$%d,%d", cp0reg, sel);
3690 break;
3691 }
3692
6643d27e
FB
3693 default:
3694 /* xgettext:c-format */
3695 (*info->fprintf_func) (info->stream,
3696 _("# internal error, undefined extension sequence (+%c)"),
3697 *d);
3698 return;
3699 }
3700 break;
3701
52da07d1
TS
3702 case '2':
3703 (*info->fprintf_func) (info->stream, "0x%lx",
3704 (l >> OP_SH_BP) & OP_MASK_BP);
3705 break;
3706
3707 case '3':
3708 (*info->fprintf_func) (info->stream, "0x%lx",
3709 (l >> OP_SH_SA3) & OP_MASK_SA3);
3710 break;
3711
3712 case '4':
3713 (*info->fprintf_func) (info->stream, "0x%lx",
3714 (l >> OP_SH_SA4) & OP_MASK_SA4);
3715 break;
3716
3717 case '5':
3718 (*info->fprintf_func) (info->stream, "0x%lx",
3719 (l >> OP_SH_IMM8) & OP_MASK_IMM8);
3720 break;
3721
3722 case '6':
3723 (*info->fprintf_func) (info->stream, "0x%lx",
3724 (l >> OP_SH_RS) & OP_MASK_RS);
3725 break;
3726
3727 case '7':
3728 (*info->fprintf_func) (info->stream, "$ac%ld",
3729 (l >> OP_SH_DSPACC) & OP_MASK_DSPACC);
3730 break;
3731
3732 case '8':
3733 (*info->fprintf_func) (info->stream, "0x%lx",
3734 (l >> OP_SH_WRDSP) & OP_MASK_WRDSP);
3735 break;
3736
3737 case '9':
3738 (*info->fprintf_func) (info->stream, "$ac%ld",
3739 (l >> OP_SH_DSPACC_S) & OP_MASK_DSPACC_S);
3740 break;
3741
3742 case '0': /* dsp 6-bit signed immediate in bit 20 */
3743 delta = ((l >> OP_SH_DSPSFT) & OP_MASK_DSPSFT);
3744 if (delta & 0x20) /* test sign bit */
3745 delta |= ~OP_MASK_DSPSFT;
3746 (*info->fprintf_func) (info->stream, "%d", delta);
3747 break;
3748
3749 case ':': /* dsp 7-bit signed immediate in bit 19 */
3750 delta = ((l >> OP_SH_DSPSFT_7) & OP_MASK_DSPSFT_7);
3751 if (delta & 0x40) /* test sign bit */
3752 delta |= ~OP_MASK_DSPSFT_7;
3753 (*info->fprintf_func) (info->stream, "%d", delta);
3754 break;
3755
3756 case '\'':
3757 (*info->fprintf_func) (info->stream, "0x%lx",
3758 (l >> OP_SH_RDDSP) & OP_MASK_RDDSP);
3759 break;
3760
3761 case '@': /* dsp 10-bit signed immediate in bit 16 */
3762 delta = ((l >> OP_SH_IMM10) & OP_MASK_IMM10);
3763 if (delta & 0x200) /* test sign bit */
3764 delta |= ~OP_MASK_IMM10;
3765 (*info->fprintf_func) (info->stream, "%d", delta);
3766 break;
3767
3768 case '!':
3769 (*info->fprintf_func) (info->stream, "%ld",
3770 (l >> OP_SH_MT_U) & OP_MASK_MT_U);
3771 break;
3772
3773 case '$':
3774 (*info->fprintf_func) (info->stream, "%ld",
3775 (l >> OP_SH_MT_H) & OP_MASK_MT_H);
3776 break;
3777
3778 case '*':
3779 (*info->fprintf_func) (info->stream, "$ac%ld",
3780 (l >> OP_SH_MTACC_T) & OP_MASK_MTACC_T);
3781 break;
3782
3783 case '&':
3784 (*info->fprintf_func) (info->stream, "$ac%ld",
3785 (l >> OP_SH_MTACC_D) & OP_MASK_MTACC_D);
3786 break;
3787
3788 case 'g':
3789 /* Coprocessor register for CTTC1, MTTC2, MTHC2, CTTC2. */
3790 (*info->fprintf_func) (info->stream, "$%ld",
3791 (l >> OP_SH_RD) & OP_MASK_RD);
3792 break;
3793
6643d27e
FB
3794 case 's':
3795 case 'b':
3796 case 'r':
3797 case 'v':
3798 (*info->fprintf_func) (info->stream, "%s",
3799 mips_gpr_names[(l >> OP_SH_RS) & OP_MASK_RS]);
3800 break;
3801
3802 case 't':
3803 case 'w':
3804 (*info->fprintf_func) (info->stream, "%s",
3805 mips_gpr_names[(l >> OP_SH_RT) & OP_MASK_RT]);
3806 break;
3807
3808 case 'i':
3809 case 'u':
52da07d1 3810 (*info->fprintf_func) (info->stream, "0x%lx",
6643d27e
FB
3811 (l >> OP_SH_IMMEDIATE) & OP_MASK_IMMEDIATE);
3812 break;
3813
3814 case 'j': /* Same as i, but sign-extended. */
3815 case 'o':
31837be3 3816 delta = (l >> OP_SH_DELTA) & OP_MASK_DELTA;
4368b29a 3817
6643d27e
FB
3818 if (delta & 0x8000)
3819 delta |= ~0xffff;
3820 (*info->fprintf_func) (info->stream, "%d",
3821 delta);
3822 break;
3823
3824 case 'h':
3825 (*info->fprintf_func) (info->stream, "0x%x",
3826 (unsigned int) ((l >> OP_SH_PREFX)
3827 & OP_MASK_PREFX));
3828 break;
3829
3830 case 'k':
3831 (*info->fprintf_func) (info->stream, "0x%x",
3832 (unsigned int) ((l >> OP_SH_CACHE)
3833 & OP_MASK_CACHE));
3834 break;
3835
3836 case 'a':
3837 info->target = (((pc + 4) & ~(bfd_vma) 0x0fffffff)
3838 | (((l >> OP_SH_TARGET) & OP_MASK_TARGET) << 2));
52da07d1
TS
3839 /* For gdb disassembler, force odd address on jalx. */
3840 if (info->flavour == bfd_target_unknown_flavour
3841 && strcmp (opp->name, "jalx") == 0)
3842 info->target |= 1;
6643d27e
FB
3843 (*info->print_address_func) (info->target, info);
3844 break;
3845
3846 case 'p':
3847 /* Sign extend the displacement. */
3848 delta = (l >> OP_SH_DELTA) & OP_MASK_DELTA;
3849 if (delta & 0x8000)
3850 delta |= ~0xffff;
3851 info->target = (delta << 2) + pc + INSNLEN;
3852 (*info->print_address_func) (info->target, info);
3853 break;
3854
3855 case 'd':
3856 (*info->fprintf_func) (info->stream, "%s",
3857 mips_gpr_names[(l >> OP_SH_RD) & OP_MASK_RD]);
3858 break;
3859
3860 case 'U':
3861 {
3862 /* First check for both rd and rt being equal. */
3863 unsigned int reg = (l >> OP_SH_RD) & OP_MASK_RD;
3864 if (reg == ((l >> OP_SH_RT) & OP_MASK_RT))
3865 (*info->fprintf_func) (info->stream, "%s",
3866 mips_gpr_names[reg]);
3867 else
3868 {
3869 /* If one is zero use the other. */
3870 if (reg == 0)
3871 (*info->fprintf_func) (info->stream, "%s",
3872 mips_gpr_names[(l >> OP_SH_RT) & OP_MASK_RT]);
3873 else if (((l >> OP_SH_RT) & OP_MASK_RT) == 0)
3874 (*info->fprintf_func) (info->stream, "%s",
3875 mips_gpr_names[reg]);
3876 else /* Bogus, result depends on processor. */
3877 (*info->fprintf_func) (info->stream, "%s or %s",
3878 mips_gpr_names[reg],
3879 mips_gpr_names[(l >> OP_SH_RT) & OP_MASK_RT]);
3880 }
3881 }
3882 break;
3883
3884 case 'z':
3885 (*info->fprintf_func) (info->stream, "%s", mips_gpr_names[0]);
3886 break;
3887
3888 case '<':
52da07d1 3889 (*info->fprintf_func) (info->stream, "0x%lx",
6643d27e
FB
3890 (l >> OP_SH_SHAMT) & OP_MASK_SHAMT);
3891 break;
3892
3893 case 'c':
52da07d1 3894 (*info->fprintf_func) (info->stream, "0x%lx",
6643d27e
FB
3895 (l >> OP_SH_CODE) & OP_MASK_CODE);
3896 break;
3897
3898 case 'q':
52da07d1 3899 (*info->fprintf_func) (info->stream, "0x%lx",
6643d27e
FB
3900 (l >> OP_SH_CODE2) & OP_MASK_CODE2);
3901 break;
3902
3903 case 'C':
52da07d1 3904 (*info->fprintf_func) (info->stream, "0x%lx",
6643d27e
FB
3905 (l >> OP_SH_COPZ) & OP_MASK_COPZ);
3906 break;
3907
3908 case 'B':
52da07d1
TS
3909 (*info->fprintf_func) (info->stream, "0x%lx",
3910
6643d27e
FB
3911 (l >> OP_SH_CODE20) & OP_MASK_CODE20);
3912 break;
3913
3914 case 'J':
52da07d1 3915 (*info->fprintf_func) (info->stream, "0x%lx",
6643d27e
FB
3916 (l >> OP_SH_CODE19) & OP_MASK_CODE19);
3917 break;
3918
3919 case 'S':
3920 case 'V':
3921 (*info->fprintf_func) (info->stream, "%s",
3922 mips_fpr_names[(l >> OP_SH_FS) & OP_MASK_FS]);
3923 break;
3924
3925 case 'T':
3926 case 'W':
3927 (*info->fprintf_func) (info->stream, "%s",
3928 mips_fpr_names[(l >> OP_SH_FT) & OP_MASK_FT]);
3929 break;
3930
3931 case 'D':
3932 (*info->fprintf_func) (info->stream, "%s",
3933 mips_fpr_names[(l >> OP_SH_FD) & OP_MASK_FD]);
3934 break;
3935
3936 case 'R':
3937 (*info->fprintf_func) (info->stream, "%s",
3938 mips_fpr_names[(l >> OP_SH_FR) & OP_MASK_FR]);
3939 break;
3940
3941 case 'E':
3942 /* Coprocessor register for lwcN instructions, et al.
3943
3944 Note that there is no load/store cp0 instructions, and
3945 that FPU (cp1) instructions disassemble this field using
3946 'T' format. Therefore, until we gain understanding of
3947 cp2 register names, we can simply print the register
3948 numbers. */
52da07d1 3949 (*info->fprintf_func) (info->stream, "$%ld",
6643d27e
FB
3950 (l >> OP_SH_RT) & OP_MASK_RT);
3951 break;
3952
3953 case 'G':
3954 /* Coprocessor register for mtcN instructions, et al. Note
3955 that FPU (cp1) instructions disassemble this field using
3956 'S' format. Therefore, we only need to worry about cp0,
3957 cp2, and cp3. */
3958 op = (l >> OP_SH_OP) & OP_MASK_OP;
3959 if (op == OP_OP_COP0)
3960 (*info->fprintf_func) (info->stream, "%s",
3961 mips_cp0_names[(l >> OP_SH_RD) & OP_MASK_RD]);
3962 else
52da07d1 3963 (*info->fprintf_func) (info->stream, "$%ld",
6643d27e
FB
3964 (l >> OP_SH_RD) & OP_MASK_RD);
3965 break;
3966
3967 case 'K':
3968 (*info->fprintf_func) (info->stream, "%s",
3969 mips_hwr_names[(l >> OP_SH_RD) & OP_MASK_RD]);
3970 break;
3971
3972 case 'N':
52da07d1
TS
3973 (*info->fprintf_func) (info->stream,
3974 ((opp->pinfo & (FP_D | FP_S)) != 0
3975 ? "$fcc%ld" : "$cc%ld"),
6643d27e
FB
3976 (l >> OP_SH_BCC) & OP_MASK_BCC);
3977 break;
3978
3979 case 'M':
52da07d1 3980 (*info->fprintf_func) (info->stream, "$fcc%ld",
6643d27e
FB
3981 (l >> OP_SH_CCC) & OP_MASK_CCC);
3982 break;
3983
3984 case 'P':
52da07d1 3985 (*info->fprintf_func) (info->stream, "%ld",
6643d27e
FB
3986 (l >> OP_SH_PERFREG) & OP_MASK_PERFREG);
3987 break;
3988
3989 case 'e':
52da07d1 3990 (*info->fprintf_func) (info->stream, "%ld",
6643d27e
FB
3991 (l >> OP_SH_VECBYTE) & OP_MASK_VECBYTE);
3992 break;
3993
3994 case '%':
52da07d1 3995 (*info->fprintf_func) (info->stream, "%ld",
6643d27e
FB
3996 (l >> OP_SH_VECALIGN) & OP_MASK_VECALIGN);
3997 break;
3998
3999 case 'H':
52da07d1 4000 (*info->fprintf_func) (info->stream, "%ld",
6643d27e
FB
4001 (l >> OP_SH_SEL) & OP_MASK_SEL);
4002 break;
4003
4004 case 'O':
52da07d1 4005 (*info->fprintf_func) (info->stream, "%ld",
6643d27e
FB
4006 (l >> OP_SH_ALN) & OP_MASK_ALN);
4007 break;
4008
4009 case 'Q':
4010 {
4011 unsigned int vsel = (l >> OP_SH_VSEL) & OP_MASK_VSEL;
52da07d1 4012
6643d27e
FB
4013 if ((vsel & 0x10) == 0)
4014 {
4015 int fmt;
52da07d1 4016
6643d27e
FB
4017 vsel &= 0x0f;
4018 for (fmt = 0; fmt < 3; fmt++, vsel >>= 1)
4019 if ((vsel & 1) == 0)
4020 break;
52da07d1 4021 (*info->fprintf_func) (info->stream, "$v%ld[%d]",
6643d27e
FB
4022 (l >> OP_SH_FT) & OP_MASK_FT,
4023 vsel >> 1);
4024 }
4025 else if ((vsel & 0x08) == 0)
4026 {
52da07d1 4027 (*info->fprintf_func) (info->stream, "$v%ld",
6643d27e
FB
4028 (l >> OP_SH_FT) & OP_MASK_FT);
4029 }
4030 else
4031 {
52da07d1 4032 (*info->fprintf_func) (info->stream, "0x%lx",
6643d27e
FB
4033 (l >> OP_SH_FT) & OP_MASK_FT);
4034 }
4035 }
4036 break;
4037
4038 case 'X':
52da07d1 4039 (*info->fprintf_func) (info->stream, "$v%ld",
6643d27e
FB
4040 (l >> OP_SH_FD) & OP_MASK_FD);
4041 break;
4042
4043 case 'Y':
52da07d1 4044 (*info->fprintf_func) (info->stream, "$v%ld",
6643d27e
FB
4045 (l >> OP_SH_FS) & OP_MASK_FS);
4046 break;
4047
4048 case 'Z':
52da07d1 4049 (*info->fprintf_func) (info->stream, "$v%ld",
6643d27e
FB
4050 (l >> OP_SH_FT) & OP_MASK_FT);
4051 break;
4052
4053 default:
4054 /* xgettext:c-format */
4055 (*info->fprintf_func) (info->stream,
4056 _("# internal error, undefined modifier(%c)"),
4057 *d);
4058 return;
4059 }
4060 }
4061}
4062\f
4063/* Check if the object uses NewABI conventions. */
4064#if 0
4065static int
4066is_newabi (header)
4067 Elf_Internal_Ehdr *header;
4068{
4069 /* There are no old-style ABIs which use 64-bit ELF. */
4070 if (header->e_ident[EI_CLASS] == ELFCLASS64)
4071 return 1;
4072
4073 /* If a 32-bit ELF file, n32 is a new-style ABI. */
4074 if ((header->e_flags & EF_MIPS_ABI2) != 0)
4075 return 1;
4076
4077 return 0;
4078}
4079#endif
4080\f
4081/* Print the mips instruction at address MEMADDR in debugged memory,
4082 on using INFO. Returns length of the instruction, in bytes, which is
4083 always INSNLEN. BIGENDIAN must be 1 if this is big-endian code, 0 if
4084 this is little-endian code. */
4085
4086static int
52da07d1
TS
4087print_insn_mips (bfd_vma memaddr,
4088 unsigned long int word,
4089 struct disassemble_info *info)
6643d27e 4090{
52da07d1 4091 const struct mips_opcode *op;
6643d27e
FB
4092 static bfd_boolean init = 0;
4093 static const struct mips_opcode *mips_hash[OP_MASK_OP + 1];
4094
4095 /* Build a hash table to shorten the search time. */
4096 if (! init)
4097 {
4098 unsigned int i;
4099
4100 for (i = 0; i <= OP_MASK_OP; i++)
4101 {
4102 for (op = mips_opcodes; op < &mips_opcodes[NUMOPCODES]; op++)
4103 {
52da07d1
TS
4104 if (op->pinfo == INSN_MACRO
4105 || (no_aliases && (op->pinfo2 & INSN2_ALIAS)))
6643d27e
FB
4106 continue;
4107 if (i == ((op->match >> OP_SH_OP) & OP_MASK_OP))
4108 {
4109 mips_hash[i] = op;
4110 break;
4111 }
4112 }
4113 }
4114
4115 init = 1;
4116 }
4117
4118 info->bytes_per_chunk = INSNLEN;
4119 info->display_endian = info->endian;
4120 info->insn_info_valid = 1;
4121 info->branch_delay_insns = 0;
4122 info->data_size = 0;
4123 info->insn_type = dis_nonbranch;
4124 info->target = 0;
4125 info->target2 = 0;
4126
4127 op = mips_hash[(word >> OP_SH_OP) & OP_MASK_OP];
4128 if (op != NULL)
4129 {
4130 for (; op < &mips_opcodes[NUMOPCODES]; op++)
4131 {
52da07d1
TS
4132 if (op->pinfo != INSN_MACRO
4133 && !(no_aliases && (op->pinfo2 & INSN2_ALIAS))
4134 && (word & op->mask) == op->match)
6643d27e 4135 {
52da07d1 4136 const char *d;
6643d27e
FB
4137
4138 /* We always allow to disassemble the jalx instruction. */
4139 if (! OPCODE_IS_MEMBER (op, mips_isa, mips_processor)
4140 && strcmp (op->name, "jalx"))
4141 continue;
4142
31837be3
YK
4143 if (strcmp(op->name, "bovc") == 0
4144 || strcmp(op->name, "bnvc") == 0) {
4145 if (((word >> OP_SH_RS) & OP_MASK_RS) <
4146 ((word >> OP_SH_RT) & OP_MASK_RT)) {
4147 continue;
4148 }
4149 }
4150 if (strcmp(op->name, "bgezc") == 0
4151 || strcmp(op->name, "bltzc") == 0
4152 || strcmp(op->name, "bgezalc") == 0
4153 || strcmp(op->name, "bltzalc") == 0) {
4154 if (((word >> OP_SH_RS) & OP_MASK_RS) !=
4155 ((word >> OP_SH_RT) & OP_MASK_RT)) {
4156 continue;
4157 }
4158 }
4159
6643d27e
FB
4160 /* Figure out instruction type and branch delay information. */
4161 if ((op->pinfo & INSN_UNCOND_BRANCH_DELAY) != 0)
4162 {
4163 if ((info->insn_type & INSN_WRITE_GPR_31) != 0)
4164 info->insn_type = dis_jsr;
4165 else
4166 info->insn_type = dis_branch;
4167 info->branch_delay_insns = 1;
4168 }
4169 else if ((op->pinfo & (INSN_COND_BRANCH_DELAY
4170 | INSN_COND_BRANCH_LIKELY)) != 0)
4171 {
4172 if ((info->insn_type & INSN_WRITE_GPR_31) != 0)
4173 info->insn_type = dis_condjsr;
4174 else
4175 info->insn_type = dis_condbranch;
4176 info->branch_delay_insns = 1;
4177 }
4178 else if ((op->pinfo & (INSN_STORE_MEMORY
4179 | INSN_LOAD_MEMORY_DELAY)) != 0)
4180 info->insn_type = dis_dref;
4181
4182 (*info->fprintf_func) (info->stream, "%s", op->name);
4183
4184 d = op->args;
4185 if (d != NULL && *d != '\0')
4186 {
4187 (*info->fprintf_func) (info->stream, "\t");
52da07d1 4188 print_insn_args (d, word, memaddr, info, op);
6643d27e
FB
4189 }
4190
4191 return INSNLEN;
4192 }
4193 }
4194 }
4195
4196 /* Handle undefined instructions. */
4197 info->insn_type = dis_noninsn;
52da07d1 4198 (*info->fprintf_func) (info->stream, "0x%lx", word);
6643d27e
FB
4199 return INSNLEN;
4200}
4201\f
4202/* In an environment where we do not know the symbol type of the
4203 instruction we are forced to assume that the low order bit of the
4204 instructions' address may mark it as a mips16 instruction. If we
4205 are single stepping, or the pc is within the disassembled function,
4206 this works. Otherwise, we need a clue. Sometimes. */
4207
6643d27e 4208static int
52da07d1
TS
4209_print_insn_mips (bfd_vma memaddr,
4210 struct disassemble_info *info,
4211 enum bfd_endian endianness)
6643d27e
FB
4212{
4213 bfd_byte buffer[INSNLEN];
4214 int status;
4215
4216 set_default_mips_dis_options (info);
4217 parse_mips_dis_options (info->disassembler_options);
4218
4219#if 0
4220#if 1
4221 /* FIXME: If odd address, this is CLEARLY a mips 16 instruction. */
4222 /* Only a few tools will work this way. */
4223 if (memaddr & 0x01)
4224 return print_insn_mips16 (memaddr, info);
4225#endif
4226
4227#if SYMTAB_AVAILABLE
4228 if (info->mach == bfd_mach_mips16
4229 || (info->flavour == bfd_target_elf_flavour
4230 && info->symbols != NULL
4231 && ((*(elf_symbol_type **) info->symbols)->internal_elf_sym.st_other
4232 == STO_MIPS16)))
4233 return print_insn_mips16 (memaddr, info);
4234#endif
4235#endif
4236
4237 status = (*info->read_memory_func) (memaddr, buffer, INSNLEN, info);
4238 if (status == 0)
4239 {
4240 unsigned long insn;
4241
4242 if (endianness == BFD_ENDIAN_BIG)
4243 insn = (unsigned long) bfd_getb32 (buffer);
4244 else
4245 insn = (unsigned long) bfd_getl32 (buffer);
4246
4247 return print_insn_mips (memaddr, insn, info);
4248 }
4249 else
4250 {
4251 (*info->memory_error_func) (status, memaddr, info);
4252 return -1;
4253 }
4254}
4255
4256int
52da07d1 4257print_insn_big_mips (bfd_vma memaddr, struct disassemble_info *info)
6643d27e
FB
4258{
4259 return _print_insn_mips (memaddr, info, BFD_ENDIAN_BIG);
4260}
4261
4262int
52da07d1 4263print_insn_little_mips (bfd_vma memaddr, struct disassemble_info *info)
6643d27e
FB
4264{
4265 return _print_insn_mips (memaddr, info, BFD_ENDIAN_LITTLE);
4266}
4267\f
4268/* Disassemble mips16 instructions. */
4269#if 0
4270static int
52da07d1 4271print_insn_mips16 (bfd_vma memaddr, struct disassemble_info *info)
6643d27e
FB
4272{
4273 int status;
4274 bfd_byte buffer[2];
4275 int length;
4276 int insn;
4277 bfd_boolean use_extend;
4278 int extend = 0;
4279 const struct mips_opcode *op, *opend;
4280
4281 info->bytes_per_chunk = 2;
4282 info->display_endian = info->endian;
4283 info->insn_info_valid = 1;
4284 info->branch_delay_insns = 0;
4285 info->data_size = 0;
4286 info->insn_type = dis_nonbranch;
4287 info->target = 0;
4288 info->target2 = 0;
4289
4290 status = (*info->read_memory_func) (memaddr, buffer, 2, info);
4291 if (status != 0)
4292 {
4293 (*info->memory_error_func) (status, memaddr, info);
4294 return -1;
4295 }
4296
4297 length = 2;
4298
4299 if (info->endian == BFD_ENDIAN_BIG)
4300 insn = bfd_getb16 (buffer);
4301 else
4302 insn = bfd_getl16 (buffer);
4303
4304 /* Handle the extend opcode specially. */
4305 use_extend = FALSE;
4306 if ((insn & 0xf800) == 0xf000)
4307 {
4308 use_extend = TRUE;
4309 extend = insn & 0x7ff;
4310
4311 memaddr += 2;
4312
4313 status = (*info->read_memory_func) (memaddr, buffer, 2, info);
4314 if (status != 0)
4315 {
4316 (*info->fprintf_func) (info->stream, "extend 0x%x",
4317 (unsigned int) extend);
4318 (*info->memory_error_func) (status, memaddr, info);
4319 return -1;
4320 }
4321
4322 if (info->endian == BFD_ENDIAN_BIG)
4323 insn = bfd_getb16 (buffer);
4324 else
4325 insn = bfd_getl16 (buffer);
4326
4327 /* Check for an extend opcode followed by an extend opcode. */
4328 if ((insn & 0xf800) == 0xf000)
4329 {
4330 (*info->fprintf_func) (info->stream, "extend 0x%x",
4331 (unsigned int) extend);
4332 info->insn_type = dis_noninsn;
4333 return length;
4334 }
4335
4336 length += 2;
4337 }
4338
4339 /* FIXME: Should probably use a hash table on the major opcode here. */
4340
4341 opend = mips16_opcodes + bfd_mips16_num_opcodes;
4342 for (op = mips16_opcodes; op < opend; op++)
4343 {
52da07d1
TS
4344 if (op->pinfo != INSN_MACRO
4345 && !(no_aliases && (op->pinfo2 & INSN2_ALIAS))
4346 && (insn & op->mask) == op->match)
6643d27e
FB
4347 {
4348 const char *s;
4349
4350 if (strchr (op->args, 'a') != NULL)
4351 {
4352 if (use_extend)
4353 {
4354 (*info->fprintf_func) (info->stream, "extend 0x%x",
4355 (unsigned int) extend);
4356 info->insn_type = dis_noninsn;
4357 return length - 2;
4358 }
4359
4360 use_extend = FALSE;
4361
4362 memaddr += 2;
4363
4364 status = (*info->read_memory_func) (memaddr, buffer, 2,
4365 info);
4366 if (status == 0)
4367 {
4368 use_extend = TRUE;
4369 if (info->endian == BFD_ENDIAN_BIG)
4370 extend = bfd_getb16 (buffer);
4371 else
4372 extend = bfd_getl16 (buffer);
4373 length += 2;
4374 }
4375 }
4376
4377 (*info->fprintf_func) (info->stream, "%s", op->name);
4378 if (op->args[0] != '\0')
4379 (*info->fprintf_func) (info->stream, "\t");
4380
4381 for (s = op->args; *s != '\0'; s++)
4382 {
4383 if (*s == ','
4384 && s[1] == 'w'
4385 && (((insn >> MIPS16OP_SH_RX) & MIPS16OP_MASK_RX)
4386 == ((insn >> MIPS16OP_SH_RY) & MIPS16OP_MASK_RY)))
4387 {
4388 /* Skip the register and the comma. */
4389 ++s;
4390 continue;
4391 }
4392 if (*s == ','
4393 && s[1] == 'v'
4394 && (((insn >> MIPS16OP_SH_RZ) & MIPS16OP_MASK_RZ)
4395 == ((insn >> MIPS16OP_SH_RX) & MIPS16OP_MASK_RX)))
4396 {
4397 /* Skip the register and the comma. */
4398 ++s;
4399 continue;
4400 }
4401 print_mips16_insn_arg (*s, op, insn, use_extend, extend, memaddr,
4402 info);
4403 }
4404
4405 if ((op->pinfo & INSN_UNCOND_BRANCH_DELAY) != 0)
4406 {
4407 info->branch_delay_insns = 1;
4408 if (info->insn_type != dis_jsr)
4409 info->insn_type = dis_branch;
4410 }
4411
4412 return length;
4413 }
4414 }
4415
4416 if (use_extend)
4417 (*info->fprintf_func) (info->stream, "0x%x", extend | 0xf000);
4418 (*info->fprintf_func) (info->stream, "0x%x", insn);
4419 info->insn_type = dis_noninsn;
4420
4421 return length;
4422}
4423
4424/* Disassemble an operand for a mips16 instruction. */
4425
4426static void
52da07d1
TS
4427print_mips16_insn_arg (char type,
4428 const struct mips_opcode *op,
4429 int l,
4430 bfd_boolean use_extend,
4431 int extend,
4432 bfd_vma memaddr,
4433 struct disassemble_info *info)
6643d27e
FB
4434{
4435 switch (type)
4436 {
4437 case ',':
4438 case '(':
4439 case ')':
4440 (*info->fprintf_func) (info->stream, "%c", type);
4441 break;
4442
4443 case 'y':
4444 case 'w':
4445 (*info->fprintf_func) (info->stream, "%s",
52da07d1
TS
4446 mips16_reg_names(((l >> MIPS16OP_SH_RY)
4447 & MIPS16OP_MASK_RY)));
6643d27e
FB
4448 break;
4449
4450 case 'x':
4451 case 'v':
4452 (*info->fprintf_func) (info->stream, "%s",
52da07d1
TS
4453 mips16_reg_names(((l >> MIPS16OP_SH_RX)
4454 & MIPS16OP_MASK_RX)));
6643d27e
FB
4455 break;
4456
4457 case 'z':
4458 (*info->fprintf_func) (info->stream, "%s",
52da07d1
TS
4459 mips16_reg_names(((l >> MIPS16OP_SH_RZ)
4460 & MIPS16OP_MASK_RZ)));
6643d27e
FB
4461 break;
4462
4463 case 'Z':
4464 (*info->fprintf_func) (info->stream, "%s",
52da07d1
TS
4465 mips16_reg_names(((l >> MIPS16OP_SH_MOVE32Z)
4466 & MIPS16OP_MASK_MOVE32Z)));
6643d27e
FB
4467 break;
4468
4469 case '0':
4470 (*info->fprintf_func) (info->stream, "%s", mips_gpr_names[0]);
4471 break;
4472
4473 case 'S':
4474 (*info->fprintf_func) (info->stream, "%s", mips_gpr_names[29]);
4475 break;
4476
4477 case 'P':
4478 (*info->fprintf_func) (info->stream, "$pc");
4479 break;
4480
4481 case 'R':
4482 (*info->fprintf_func) (info->stream, "%s", mips_gpr_names[31]);
4483 break;
4484
4485 case 'X':
4486 (*info->fprintf_func) (info->stream, "%s",
4487 mips_gpr_names[((l >> MIPS16OP_SH_REGR32)
4488 & MIPS16OP_MASK_REGR32)]);
4489 break;
4490
4491 case 'Y':
4492 (*info->fprintf_func) (info->stream, "%s",
4493 mips_gpr_names[MIPS16OP_EXTRACT_REG32R (l)]);
4494 break;
4495
4496 case '<':
4497 case '>':
4498 case '[':
4499 case ']':
4500 case '4':
4501 case '5':
4502 case 'H':
4503 case 'W':
4504 case 'D':
4505 case 'j':
4506 case '6':
4507 case '8':
4508 case 'V':
4509 case 'C':
4510 case 'U':
4511 case 'k':
4512 case 'K':
4513 case 'p':
4514 case 'q':
4515 case 'A':
4516 case 'B':
4517 case 'E':
4518 {
4519 int immed, nbits, shift, signedp, extbits, pcrel, extu, branch;
4520
4521 shift = 0;
4522 signedp = 0;
4523 extbits = 16;
4524 pcrel = 0;
4525 extu = 0;
4526 branch = 0;
4527 switch (type)
4528 {
4529 case '<':
4530 nbits = 3;
4531 immed = (l >> MIPS16OP_SH_RZ) & MIPS16OP_MASK_RZ;
4532 extbits = 5;
4533 extu = 1;
4534 break;
4535 case '>':
4536 nbits = 3;
4537 immed = (l >> MIPS16OP_SH_RX) & MIPS16OP_MASK_RX;
4538 extbits = 5;
4539 extu = 1;
4540 break;
4541 case '[':
4542 nbits = 3;
4543 immed = (l >> MIPS16OP_SH_RZ) & MIPS16OP_MASK_RZ;
4544 extbits = 6;
4545 extu = 1;
4546 break;
4547 case ']':
4548 nbits = 3;
4549 immed = (l >> MIPS16OP_SH_RX) & MIPS16OP_MASK_RX;
4550 extbits = 6;
4551 extu = 1;
4552 break;
4553 case '4':
4554 nbits = 4;
4555 immed = (l >> MIPS16OP_SH_IMM4) & MIPS16OP_MASK_IMM4;
4556 signedp = 1;
4557 extbits = 15;
4558 break;
4559 case '5':
4560 nbits = 5;
4561 immed = (l >> MIPS16OP_SH_IMM5) & MIPS16OP_MASK_IMM5;
4562 info->insn_type = dis_dref;
4563 info->data_size = 1;
4564 break;
4565 case 'H':
4566 nbits = 5;
4567 shift = 1;
4568 immed = (l >> MIPS16OP_SH_IMM5) & MIPS16OP_MASK_IMM5;
4569 info->insn_type = dis_dref;
4570 info->data_size = 2;
4571 break;
4572 case 'W':
4573 nbits = 5;
4574 shift = 2;
4575 immed = (l >> MIPS16OP_SH_IMM5) & MIPS16OP_MASK_IMM5;
4576 if ((op->pinfo & MIPS16_INSN_READ_PC) == 0
4577 && (op->pinfo & MIPS16_INSN_READ_SP) == 0)
4578 {
4579 info->insn_type = dis_dref;
4580 info->data_size = 4;
4581 }
4582 break;
4583 case 'D':
4584 nbits = 5;
4585 shift = 3;
4586 immed = (l >> MIPS16OP_SH_IMM5) & MIPS16OP_MASK_IMM5;
4587 info->insn_type = dis_dref;
4588 info->data_size = 8;
4589 break;
4590 case 'j':
4591 nbits = 5;
4592 immed = (l >> MIPS16OP_SH_IMM5) & MIPS16OP_MASK_IMM5;
4593 signedp = 1;
4594 break;
4595 case '6':
4596 nbits = 6;
4597 immed = (l >> MIPS16OP_SH_IMM6) & MIPS16OP_MASK_IMM6;
4598 break;
4599 case '8':
4600 nbits = 8;
4601 immed = (l >> MIPS16OP_SH_IMM8) & MIPS16OP_MASK_IMM8;
4602 break;
4603 case 'V':
4604 nbits = 8;
4605 shift = 2;
4606 immed = (l >> MIPS16OP_SH_IMM8) & MIPS16OP_MASK_IMM8;
4607 /* FIXME: This might be lw, or it might be addiu to $sp or
4608 $pc. We assume it's load. */
4609 info->insn_type = dis_dref;
4610 info->data_size = 4;
4611 break;
4612 case 'C':
4613 nbits = 8;
4614 shift = 3;
4615 immed = (l >> MIPS16OP_SH_IMM8) & MIPS16OP_MASK_IMM8;
4616 info->insn_type = dis_dref;
4617 info->data_size = 8;
4618 break;
4619 case 'U':
4620 nbits = 8;
4621 immed = (l >> MIPS16OP_SH_IMM8) & MIPS16OP_MASK_IMM8;
4622 extu = 1;
4623 break;
4624 case 'k':
4625 nbits = 8;
4626 immed = (l >> MIPS16OP_SH_IMM8) & MIPS16OP_MASK_IMM8;
4627 signedp = 1;
4628 break;
4629 case 'K':
4630 nbits = 8;
4631 shift = 3;
4632 immed = (l >> MIPS16OP_SH_IMM8) & MIPS16OP_MASK_IMM8;
4633 signedp = 1;
4634 break;
4635 case 'p':
4636 nbits = 8;
4637 immed = (l >> MIPS16OP_SH_IMM8) & MIPS16OP_MASK_IMM8;
4638 signedp = 1;
4639 pcrel = 1;
4640 branch = 1;
4641 info->insn_type = dis_condbranch;
4642 break;
4643 case 'q':
4644 nbits = 11;
4645 immed = (l >> MIPS16OP_SH_IMM11) & MIPS16OP_MASK_IMM11;
4646 signedp = 1;
4647 pcrel = 1;
4648 branch = 1;
4649 info->insn_type = dis_branch;
4650 break;
4651 case 'A':
4652 nbits = 8;
4653 shift = 2;
4654 immed = (l >> MIPS16OP_SH_IMM8) & MIPS16OP_MASK_IMM8;
4655 pcrel = 1;
4656 /* FIXME: This can be lw or la. We assume it is lw. */
4657 info->insn_type = dis_dref;
4658 info->data_size = 4;
4659 break;
4660 case 'B':
4661 nbits = 5;
4662 shift = 3;
4663 immed = (l >> MIPS16OP_SH_IMM5) & MIPS16OP_MASK_IMM5;
4664 pcrel = 1;
4665 info->insn_type = dis_dref;
4666 info->data_size = 8;
4667 break;
4668 case 'E':
4669 nbits = 5;
4670 shift = 2;
4671 immed = (l >> MIPS16OP_SH_IMM5) & MIPS16OP_MASK_IMM5;
4672 pcrel = 1;
4673 break;
4674 default:
4675 abort ();
4676 }
4677
4678 if (! use_extend)
4679 {
4680 if (signedp && immed >= (1 << (nbits - 1)))
4681 immed -= 1 << nbits;
4682 immed <<= shift;
4683 if ((type == '<' || type == '>' || type == '[' || type == ']')
4684 && immed == 0)
4685 immed = 8;
4686 }
4687 else
4688 {
4689 if (extbits == 16)
4690 immed |= ((extend & 0x1f) << 11) | (extend & 0x7e0);
4691 else if (extbits == 15)
4692 immed |= ((extend & 0xf) << 11) | (extend & 0x7f0);
4693 else
4694 immed = ((extend >> 6) & 0x1f) | (extend & 0x20);
4695 immed &= (1 << extbits) - 1;
4696 if (! extu && immed >= (1 << (extbits - 1)))
4697 immed -= 1 << extbits;
4698 }
4699
4700 if (! pcrel)
4701 (*info->fprintf_func) (info->stream, "%d", immed);
4702 else
4703 {
4704 bfd_vma baseaddr;
4705
4706 if (branch)
4707 {
4708 immed *= 2;
4709 baseaddr = memaddr + 2;
4710 }
4711 else if (use_extend)
4712 baseaddr = memaddr - 2;
4713 else
4714 {
4715 int status;
4716 bfd_byte buffer[2];
4717
4718 baseaddr = memaddr;
4719
4720 /* If this instruction is in the delay slot of a jr
4721 instruction, the base address is the address of the
4722 jr instruction. If it is in the delay slot of jalr
4723 instruction, the base address is the address of the
4724 jalr instruction. This test is unreliable: we have
4725 no way of knowing whether the previous word is
4726 instruction or data. */
4727 status = (*info->read_memory_func) (memaddr - 4, buffer, 2,
4728 info);
4729 if (status == 0
4730 && (((info->endian == BFD_ENDIAN_BIG
4731 ? bfd_getb16 (buffer)
4732 : bfd_getl16 (buffer))
4733 & 0xf800) == 0x1800))
4734 baseaddr = memaddr - 4;
4735 else
4736 {
4737 status = (*info->read_memory_func) (memaddr - 2, buffer,
4738 2, info);
4739 if (status == 0
4740 && (((info->endian == BFD_ENDIAN_BIG
4741 ? bfd_getb16 (buffer)
4742 : bfd_getl16 (buffer))
4743 & 0xf81f) == 0xe800))
4744 baseaddr = memaddr - 2;
4745 }
4746 }
4747 info->target = (baseaddr & ~((1 << shift) - 1)) + immed;
52da07d1
TS
4748 if (pcrel && branch
4749 && info->flavour == bfd_target_unknown_flavour)
4750 /* For gdb disassembler, maintain odd address. */
4751 info->target |= 1;
6643d27e
FB
4752 (*info->print_address_func) (info->target, info);
4753 }
4754 }
4755 break;
4756
4757 case 'a':
52da07d1
TS
4758 {
4759 int jalx = l & 0x400;
4760
4761 if (! use_extend)
4762 extend = 0;
4763 l = ((l & 0x1f) << 23) | ((l & 0x3e0) << 13) | (extend << 2);
4764 if (!jalx && info->flavour == bfd_target_unknown_flavour)
4765 /* For gdb disassembler, maintain odd address. */
4766 l |= 1;
4767 }
6643d27e
FB
4768 info->target = ((memaddr + 4) & ~(bfd_vma) 0x0fffffff) | l;
4769 (*info->print_address_func) (info->target, info);
4770 info->insn_type = dis_jsr;
4771 info->branch_delay_insns = 1;
4772 break;
4773
4774 case 'l':
4775 case 'L':
4776 {
4777 int need_comma, amask, smask;
4778
4779 need_comma = 0;
4780
4781 l = (l >> MIPS16OP_SH_IMM6) & MIPS16OP_MASK_IMM6;
4782
4783 amask = (l >> 3) & 7;
4784
4785 if (amask > 0 && amask < 5)
4786 {
4787 (*info->fprintf_func) (info->stream, "%s", mips_gpr_names[4]);
4788 if (amask > 1)
4789 (*info->fprintf_func) (info->stream, "-%s",
4790 mips_gpr_names[amask + 3]);
4791 need_comma = 1;
4792 }
4793
4794 smask = (l >> 1) & 3;
4795 if (smask == 3)
4796 {
4797 (*info->fprintf_func) (info->stream, "%s??",
4798 need_comma ? "," : "");
4799 need_comma = 1;
4800 }
4801 else if (smask > 0)
4802 {
4803 (*info->fprintf_func) (info->stream, "%s%s",
4804 need_comma ? "," : "",
4805 mips_gpr_names[16]);
4806 if (smask > 1)
4807 (*info->fprintf_func) (info->stream, "-%s",
4808 mips_gpr_names[smask + 15]);
4809 need_comma = 1;
4810 }
4811
4812 if (l & 1)
4813 {
4814 (*info->fprintf_func) (info->stream, "%s%s",
4815 need_comma ? "," : "",
4816 mips_gpr_names[31]);
4817 need_comma = 1;
4818 }
4819
4820 if (amask == 5 || amask == 6)
4821 {
4822 (*info->fprintf_func) (info->stream, "%s$f0",
4823 need_comma ? "," : "");
4824 if (amask == 6)
4825 (*info->fprintf_func) (info->stream, "-$f1");
4826 }
4827 }
4828 break;
4829
52da07d1
TS
4830 case 'm':
4831 case 'M':
4832 /* MIPS16e save/restore. */
4833 {
4834 int need_comma = 0;
4835 int amask, args, statics;
4836 int nsreg, smask;
4837 int framesz;
4838 int i, j;
4839
4840 l = l & 0x7f;
4841 if (use_extend)
4842 l |= extend << 16;
4843
4844 amask = (l >> 16) & 0xf;
4845 if (amask == MIPS16_ALL_ARGS)
4846 {
4847 args = 4;
4848 statics = 0;
4849 }
4850 else if (amask == MIPS16_ALL_STATICS)
4851 {
4852 args = 0;
4853 statics = 4;
4854 }
4855 else
4856 {
4857 args = amask >> 2;
4858 statics = amask & 3;
4859 }
4860
4861 if (args > 0) {
4862 (*info->fprintf_func) (info->stream, "%s", mips_gpr_names[4]);
4863 if (args > 1)
4864 (*info->fprintf_func) (info->stream, "-%s",
4865 mips_gpr_names[4 + args - 1]);
4866 need_comma = 1;
4867 }
4868
4869 framesz = (((l >> 16) & 0xf0) | (l & 0x0f)) * 8;
4870 if (framesz == 0 && !use_extend)
4871 framesz = 128;
4872
4873 (*info->fprintf_func) (info->stream, "%s%d",
4874 need_comma ? "," : "",
4875 framesz);
4876
4877 if (l & 0x40) /* $ra */
4878 (*info->fprintf_func) (info->stream, ",%s", mips_gpr_names[31]);
4879
4880 nsreg = (l >> 24) & 0x7;
4881 smask = 0;
4882 if (l & 0x20) /* $s0 */
4883 smask |= 1 << 0;
4884 if (l & 0x10) /* $s1 */
4885 smask |= 1 << 1;
4886 if (nsreg > 0) /* $s2-$s8 */
4887 smask |= ((1 << nsreg) - 1) << 2;
4888
4889 /* Find first set static reg bit. */
4890 for (i = 0; i < 9; i++)
4891 {
4892 if (smask & (1 << i))
4893 {
4894 (*info->fprintf_func) (info->stream, ",%s",
4895 mips_gpr_names[i == 8 ? 30 : (16 + i)]);
4896 /* Skip over string of set bits. */
4897 for (j = i; smask & (2 << j); j++)
4898 continue;
4899 if (j > i)
4900 (*info->fprintf_func) (info->stream, "-%s",
4901 mips_gpr_names[j == 8 ? 30 : (16 + j)]);
4902 i = j + 1;
4903 }
4904 }
4905
4906 /* Statics $ax - $a3. */
4907 if (statics == 1)
4908 (*info->fprintf_func) (info->stream, ",%s", mips_gpr_names[7]);
4909 else if (statics > 0)
4910 (*info->fprintf_func) (info->stream, ",%s-%s",
4911 mips_gpr_names[7 - statics + 1],
4912 mips_gpr_names[7]);
4913 }
4914 break;
4915
6643d27e
FB
4916 default:
4917 /* xgettext:c-format */
4918 (*info->fprintf_func)
4919 (info->stream,
4920 _("# internal disassembler error, unrecognised modifier (%c)"),
4921 type);
4922 abort ();
4923 }
4924}
6643d27e
FB
4925
4926void
52da07d1 4927print_mips_disassembler_options (FILE *stream)
6643d27e
FB
4928{
4929 unsigned int i;
4930
4931 fprintf (stream, _("\n\
4932The following MIPS specific disassembler options are supported for use\n\
4933with the -M switch (multiple options should be separated by commas):\n"));
4934
4935 fprintf (stream, _("\n\
4936 gpr-names=ABI Print GPR names according to specified ABI.\n\
4937 Default: based on binary being disassembled.\n"));
4938
4939 fprintf (stream, _("\n\
4940 fpr-names=ABI Print FPR names according to specified ABI.\n\
4941 Default: numeric.\n"));
4942
4943 fprintf (stream, _("\n\
4944 cp0-names=ARCH Print CP0 register names according to\n\
4945 specified architecture.\n\
4946 Default: based on binary being disassembled.\n"));
4947
4948 fprintf (stream, _("\n\
b2bedb21 4949 hwr-names=ARCH Print HWR names according to specified\n\
6643d27e
FB
4950 architecture.\n\
4951 Default: based on binary being disassembled.\n"));
4952
4953 fprintf (stream, _("\n\
4954 reg-names=ABI Print GPR and FPR names according to\n\
4955 specified ABI.\n"));
4956
4957 fprintf (stream, _("\n\
4958 reg-names=ARCH Print CP0 register and HWR names according to\n\
4959 specified architecture.\n"));
4960
4961 fprintf (stream, _("\n\
4962 For the options above, the following values are supported for \"ABI\":\n\
4963 "));
4964 for (i = 0; i < ARRAY_SIZE (mips_abi_choices); i++)
4965 fprintf (stream, " %s", mips_abi_choices[i].name);
4966 fprintf (stream, _("\n"));
4967
4968 fprintf (stream, _("\n\
4969 For the options above, The following values are supported for \"ARCH\":\n\
4970 "));
4971 for (i = 0; i < ARRAY_SIZE (mips_arch_choices); i++)
4972 if (*mips_arch_choices[i].name != '\0')
4973 fprintf (stream, " %s", mips_arch_choices[i].name);
4974 fprintf (stream, _("\n"));
4975
4976 fprintf (stream, _("\n"));
4977}
f9480ffc 4978#endif
This page took 1.182427 seconds and 4 git commands to generate.