1 /* mips.h. Mips opcode list for GDB, the GNU debugger.
2 Copyright (C) 1993-2016 Free Software Foundation, Inc.
3 Contributed by Ralph Campbell and OSF
4 Commented and modified by Ian Lance Taylor, Cygnus Support
6 This file is part of GDB, GAS, and the GNU binutils.
8 GDB, GAS, and the GNU binutils are free software; you can redistribute
9 them and/or modify them under the terms of the GNU General Public
10 License as published by the Free Software Foundation; either version 3,
11 or (at your option) any later version.
13 GDB, GAS, and the GNU binutils are distributed in the hope that they
14 will be useful, but WITHOUT ANY WARRANTY; without even the implied
15 warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See
16 the GNU General Public License for more details.
18 You should have received a copy of the GNU General Public License
19 along with this file; see the file COPYING3. If not, write to the Free
20 Software Foundation, 51 Franklin Street - Fifth Floor, Boston,
21 MA 02110-1301, USA. */
32 /* These are bit masks and shift counts to use to access the various
33 fields of an instruction. To retrieve the X field of an
34 instruction, use the expression
35 (i >> OP_SH_X) & OP_MASK_X
36 To set the same field (to j), use
37 i = (i &~ (OP_MASK_X << OP_SH_X)) | (j << OP_SH_X)
39 Make sure you use fields that are appropriate for the instruction,
42 The 'i' format uses OP, RS, RT and IMMEDIATE.
44 The 'j' format uses OP and TARGET.
46 The 'r' format uses OP, RS, RT, RD, SHAMT and FUNCT.
48 The 'b' format uses OP, RS, RT and DELTA.
50 The floating point 'i' format uses OP, RS, RT and IMMEDIATE.
52 The floating point 'r' format uses OP, FMT, FT, FS, FD and FUNCT.
54 A breakpoint instruction uses OP, CODE and SPEC (10 bits of the
55 breakpoint instruction are not defined; Kane says the breakpoint
56 code field in BREAK is 20 bits; yet MIPS assemblers and debuggers
57 only use ten bits). An optional two-operand form of break/sdbbp
58 allows the lower ten bits to be set too, and MIPS32 and later
59 architectures allow 20 bits to be set with a signal operand
62 The syscall instruction uses CODE20.
64 The general coprocessor instructions use COPZ. */
66 #define OP_MASK_OP 0x3f
68 #define OP_MASK_RS 0x1f
70 #define OP_MASK_FR 0x1f
72 #define OP_MASK_FMT 0x1f
74 #define OP_MASK_BCC 0x7
76 #define OP_MASK_CODE 0x3ff
78 #define OP_MASK_CODE2 0x3ff
80 #define OP_MASK_RT 0x1f
82 #define OP_MASK_FT 0x1f
84 #define OP_MASK_CACHE 0x1f
85 #define OP_SH_CACHE 16
86 #define OP_MASK_RD 0x1f
88 #define OP_MASK_FS 0x1f
90 #define OP_MASK_PREFX 0x1f
91 #define OP_SH_PREFX 11
92 #define OP_MASK_CCC 0x7
94 #define OP_MASK_CODE20 0xfffff /* 20 bit syscall/breakpoint code. */
95 #define OP_SH_CODE20 6
96 #define OP_MASK_SHAMT 0x1f
98 #define OP_MASK_EXTLSB OP_MASK_SHAMT
99 #define OP_SH_EXTLSB OP_SH_SHAMT
100 #define OP_MASK_STYPE OP_MASK_SHAMT
101 #define OP_SH_STYPE OP_SH_SHAMT
102 #define OP_MASK_FD 0x1f
104 #define OP_MASK_TARGET 0x3ffffff
105 #define OP_SH_TARGET 0
106 #define OP_MASK_COPZ 0x1ffffff
108 #define OP_MASK_IMMEDIATE 0xffff
109 #define OP_SH_IMMEDIATE 0
110 #define OP_MASK_DELTA 0xffff
111 #define OP_SH_DELTA 0
112 #define OP_MASK_FUNCT 0x3f
113 #define OP_SH_FUNCT 0
114 #define OP_MASK_SPEC 0x3f
116 #define OP_SH_LOCC 8 /* FP condition code. */
117 #define OP_SH_HICC 18 /* FP condition code. */
118 #define OP_MASK_CC 0x7
119 #define OP_SH_COP1NORM 25 /* Normal COP1 encoding. */
120 #define OP_MASK_COP1NORM 0x1 /* a single bit. */
121 #define OP_SH_COP1SPEC 21 /* COP1 encodings. */
122 #define OP_MASK_COP1SPEC 0xf
123 #define OP_MASK_COP1SCLR 0x4
124 #define OP_MASK_COP1CMP 0x3
125 #define OP_SH_COP1CMP 4
126 #define OP_SH_FORMAT 21 /* FP short format field. */
127 #define OP_MASK_FORMAT 0x7
128 #define OP_SH_TRUE 16
129 #define OP_MASK_TRUE 0x1
131 #define OP_MASK_GE 0x01
132 #define OP_SH_UNSIGNED 16
133 #define OP_MASK_UNSIGNED 0x1
134 #define OP_SH_HINT 16
135 #define OP_MASK_HINT 0x1f
136 #define OP_SH_MMI 0 /* Multimedia (parallel) op. */
137 #define OP_MASK_MMI 0x3f
138 #define OP_SH_MMISUB 6
139 #define OP_MASK_MMISUB 0x1f
140 #define OP_MASK_PERFREG 0x1f /* Performance monitoring. */
141 #define OP_SH_PERFREG 1
142 #define OP_SH_SEL 0 /* Coprocessor select field. */
143 #define OP_MASK_SEL 0x7 /* The sel field of mfcZ and mtcZ. */
144 #define OP_SH_CODE19 6 /* 19 bit wait code. */
145 #define OP_MASK_CODE19 0x7ffff
147 #define OP_MASK_ALN 0x7
148 #define OP_SH_VSEL 21
149 #define OP_MASK_VSEL 0x1f
150 #define OP_MASK_VECBYTE 0x7 /* Selector field is really 4 bits,
151 but 0x8-0xf don't select bytes. */
152 #define OP_SH_VECBYTE 22
153 #define OP_MASK_VECALIGN 0x7 /* Vector byte-align (alni.ob) op. */
154 #define OP_SH_VECALIGN 21
155 #define OP_MASK_INSMSB 0x1f /* "ins" MSB. */
156 #define OP_SH_INSMSB 11
157 #define OP_MASK_EXTMSBD 0x1f /* "ext" MSBD. */
158 #define OP_SH_EXTMSBD 11
161 #define OP_SH_DSPACC 11
162 #define OP_MASK_DSPACC 0x3
163 #define OP_SH_DSPACC_S 21
164 #define OP_MASK_DSPACC_S 0x3
165 #define OP_SH_DSPSFT 20
166 #define OP_MASK_DSPSFT 0x3f
167 #define OP_SH_DSPSFT_7 19
168 #define OP_MASK_DSPSFT_7 0x7f
170 #define OP_MASK_SA3 0x7
172 #define OP_MASK_SA4 0xf
173 #define OP_SH_IMM8 16
174 #define OP_MASK_IMM8 0xff
175 #define OP_SH_IMM10 16
176 #define OP_MASK_IMM10 0x3ff
177 #define OP_SH_WRDSP 11
178 #define OP_MASK_WRDSP 0x3f
179 #define OP_SH_RDDSP 16
180 #define OP_MASK_RDDSP 0x3f
182 #define OP_MASK_BP 0x3
186 #define OP_MASK_MT_U 0x1
188 #define OP_MASK_MT_H 0x1
189 #define OP_SH_MTACC_T 18
190 #define OP_MASK_MTACC_T 0x3
191 #define OP_SH_MTACC_D 13
192 #define OP_MASK_MTACC_D 0x3
195 #define OP_MASK_3BITPOS 0x7
196 #define OP_SH_3BITPOS 12
197 #define OP_MASK_OFFSET12 0xfff
198 #define OP_SH_OFFSET12 0
200 #define OP_OP_COP0 0x10
201 #define OP_OP_COP1 0x11
202 #define OP_OP_COP2 0x12
203 #define OP_OP_COP3 0x13
204 #define OP_OP_LWC1 0x31
205 #define OP_OP_LWC2 0x32
206 #define OP_OP_LWC3 0x33 /* a.k.a. pref */
207 #define OP_OP_LDC1 0x35
208 #define OP_OP_LDC2 0x36
209 #define OP_OP_LDC3 0x37 /* a.k.a. ld */
210 #define OP_OP_SWC1 0x39
211 #define OP_OP_SWC2 0x3a
212 #define OP_OP_SWC3 0x3b
213 #define OP_OP_SDC1 0x3d
214 #define OP_OP_SDC2 0x3e
215 #define OP_OP_SDC3 0x3f /* a.k.a. sd */
218 #define OP_MASK_CODE10 0x3ff
219 #define OP_SH_CODE10 11
221 /* Values in the 'VSEL' field. */
222 #define MDMX_FMTSEL_IMM_QH 0x1d
223 #define MDMX_FMTSEL_IMM_OB 0x1e
224 #define MDMX_FMTSEL_VEC_QH 0x15
225 #define MDMX_FMTSEL_VEC_OB 0x16
229 #define OP_MASK_UDI1 0x1f
231 #define OP_MASK_UDI2 0x3ff
233 #define OP_MASK_UDI3 0x7fff
235 #define OP_MASK_UDI4 0xfffff
238 #define OP_SH_BBITIND 16
239 #define OP_MASK_BBITIND 0x1f
240 #define OP_SH_CINSPOS 6
241 #define OP_MASK_CINSPOS 0x1f
242 #define OP_SH_CINSLM1 11
243 #define OP_MASK_CINSLM1 0x1f
245 #define OP_MASK_SEQI 0x3ff
248 #define OP_SH_OFFSET_A 6
249 #define OP_MASK_OFFSET_A 0xff
250 #define OP_SH_OFFSET_B 3
251 #define OP_MASK_OFFSET_B 0xff
252 #define OP_SH_OFFSET_C 6
253 #define OP_MASK_OFFSET_C 0x1ff
255 #define OP_MASK_RZ 0x1f
257 #define OP_MASK_FZ 0x1f
259 /* Every MICROMIPSOP_X definition requires a corresponding OP_X
260 definition, and vice versa. This simplifies various parts
261 of the operand handling in GAS. The fields below only exist
262 in the microMIPS encoding, so define each one to have an empty
264 #define OP_MASK_TRAP 0
266 #define OP_MASK_OFFSET10 0
267 #define OP_SH_OFFSET10 0
268 #define OP_MASK_RS3 0
296 #define OP_MASK_IMMA 0
298 #define OP_MASK_IMMB 0
300 #define OP_MASK_IMMC 0
302 #define OP_MASK_IMMF 0
304 #define OP_MASK_IMMG 0
306 #define OP_MASK_IMMH 0
308 #define OP_MASK_IMMI 0
310 #define OP_MASK_IMMJ 0
312 #define OP_MASK_IMML 0
314 #define OP_MASK_IMMM 0
316 #define OP_MASK_IMMN 0
318 #define OP_MASK_IMMO 0
320 #define OP_MASK_IMMP 0
322 #define OP_MASK_IMMQ 0
324 #define OP_MASK_IMMU 0
326 #define OP_MASK_IMMW 0
328 #define OP_MASK_IMMX 0
330 #define OP_MASK_IMMY 0
333 /* Enhanced VA Scheme */
334 #define OP_SH_EVAOFFSET 7
335 #define OP_MASK_EVAOFFSET 0x1ff
337 /* Enumerates the various types of MIPS operand. */
338 enum mips_operand_type
{
339 /* Described by mips_int_operand. */
342 /* Described by mips_mapped_int_operand. */
345 /* Described by mips_msb_operand. */
348 /* Described by mips_reg_operand. */
351 /* Like OP_REG, but can be omitted if the register is the same as the
355 /* Described by mips_reg_pair_operand. */
358 /* Described by mips_pcrel_operand. */
361 /* A performance register. The field is 5 bits in size, but the supported
362 values are much more restricted. */
365 /* The final operand in a microMIPS ADDIUSP instruction. It mostly acts
366 as a normal 9-bit signed offset that is multiplied by four, but there
367 are four special cases:
375 /* The target of a (D)CLO or (D)CLZ instruction. The operand spans two
376 5-bit register fields, both of which must be set to the destination
380 /* A register list for a microMIPS LWM or SWM instruction. The operand
381 size determines whether the 16-bit or 32-bit encoding is required. */
384 /* The register list for an emulated MIPS16 ENTRY or EXIT instruction. */
387 /* The register list and frame size for a MIPS16 SAVE or RESTORE
389 OP_SAVE_RESTORE_LIST
,
391 /* A 10-bit field VVVVVNNNNN used for octobyte and quadhalf instructions:
395 0EEE0 8 copies of $vN[E], OB format
396 0EE01 4 copies of $vN[E], QH format
397 10110 all 8 elements of $vN, OB format
398 10101 all 4 elements of $vN, QH format
399 11110 8 copies of immediate N, OB format
400 11101 4 copies of immediate N, QH format. */
403 /* A register operand that must match the destination register. */
406 /* A register operand that must match the previous register. */
409 /* $pc, which has no encoding in the architectural instruction. */
412 /* A 4-bit XYZW channel mask or 2-bit XYZW index; the size determines
416 /* Like OP_VU0_SUFFIX, but used when the operand's value has already
417 been set. Any suffix used here must match the previous value. */
420 /* An index selected by an integer, e.g. [1]. */
423 /* An index selected by a register, e.g. [$2]. */
426 /* The operand spans two 5-bit register fields, both of which must be set to
427 the source register. */
430 /* Described by mips_prev_operand. */
433 /* A register operand that must not be zero. */
437 /* Enumerates the types of MIPS register. */
438 enum mips_reg_operand_type
{
439 /* General registers $0-$31. Software names like $at can also be used. */
442 /* Floating-point registers $f0-$f31. */
445 /* Coprocessor condition code registers $cc0-$cc7. FPU condition codes
446 can also be written $fcc0-$fcc7. */
449 /* FPRs used in a vector capacity. They can be written $f0-$f31
450 or $v0-$v31, although the latter form is not used for the VR5400
451 vector instructions. */
454 /* DSP accumulator registers $ac0-$ac3. */
457 /* Coprocessor registers $0-$31. Mnemonic names like c0_cause can
458 also be used in some contexts. */
461 /* Hardware registers $0-$31. Mnemonic names like hwr_cpunum can
462 also be used in some contexts. */
465 /* Floating-point registers $vf0-$vf31. */
468 /* Integer registers $vi0-$vi31. */
471 /* R5900 VU0 registers $I, $Q, $R and $ACC. */
477 /* MSA registers $w0-$w31. */
480 /* MSA control registers $0-$31. */
484 /* Base class for all operands. */
487 /* The type of the operand. */
488 enum mips_operand_type type
;
490 /* The operand occupies SIZE bits of the instruction, starting at LSB. */
495 /* Describes an integer operand with a regular encoding pattern. */
496 struct mips_int_operand
498 struct mips_operand root
;
500 /* The low ROOT.SIZE bits of MAX_VAL encodes (MAX_VAL + BIAS) << SHIFT.
501 The cyclically previous field value encodes 1 << SHIFT less than that,
504 - for { { T, 4, L }, 14, 0, 0 }, field values 0...14 encode themselves,
507 - { { T, 8, L }, 127, 0, 2 } is a normal signed 8-bit operand that is
508 shifted left two places.
510 - { { T, 3, L }, 8, 0, 0 } is a normal unsigned 3-bit operand except
513 - { { ... }, 0, 1, 3 } means that N encodes (N + 1) << 3. */
514 unsigned int max_val
;
518 /* True if the operand should be printed as hex rather than decimal. */
519 bfd_boolean print_hex
;
522 /* Uses a lookup table to describe a small integer operand. */
523 struct mips_mapped_int_operand
525 struct mips_operand root
;
527 /* Maps each encoding value to the integer that it represents. */
530 /* True if the operand should be printed as hex rather than decimal. */
531 bfd_boolean print_hex
;
534 /* An operand that encodes the most significant bit position of a bitfield.
535 Given a bitfield that spans bits [MSB, LSB], some operands of this type
536 encode MSB directly while others encode MSB - LSB. Each operand of this
537 type is preceded by an integer operand that specifies LSB.
539 The assembly form varies between instructions. For some instructions,
540 such as EXT, the operand is written as the bitfield size. For others,
541 such as EXTS, it is written in raw MSB - LSB form. */
542 struct mips_msb_operand
544 struct mips_operand root
;
546 /* The assembly-level operand encoded by a field value of 0. */
549 /* True if the operand encodes MSB directly, false if it encodes
553 /* The maximum value of MSB + 1. */
557 /* Describes a single register operand. */
558 struct mips_reg_operand
560 struct mips_operand root
;
562 /* The type of register. */
563 enum mips_reg_operand_type reg_type
;
565 /* If nonnull, REG_MAP[N] gives the register associated with encoding N,
566 otherwise the encoding is the same as the register number. */
567 const unsigned char *reg_map
;
570 /* Describes an operand that which must match a condition based on the
572 struct mips_check_prev_operand
574 struct mips_operand root
;
576 bfd_boolean greater_than_ok
;
577 bfd_boolean less_than_ok
;
578 bfd_boolean equal_ok
;
582 /* Describes an operand that encodes a pair of registers. */
583 struct mips_reg_pair_operand
585 struct mips_operand root
;
587 /* The type of register. */
588 enum mips_reg_operand_type reg_type
;
590 /* Encoding N represents REG1_MAP[N], REG2_MAP[N]. */
591 unsigned char *reg1_map
;
592 unsigned char *reg2_map
;
595 /* Describes an operand that is calculated relative to a base PC.
596 The base PC is usually the address of the following instruction,
597 but the rules for MIPS16 instructions like ADDIUPC are more complicated. */
598 struct mips_pcrel_operand
600 /* Encodes the offset. */
601 struct mips_int_operand root
;
603 /* The low ALIGN_LOG2 bits of the base PC are cleared to give PC',
604 which is then added to the offset encoded by ROOT. */
605 unsigned int align_log2
: 8;
607 /* If INCLUDE_ISA_BIT, the ISA bit of the original base PC is then
608 reinstated. This is true for jumps and branches and false for
609 PC-relative data instructions. */
610 unsigned int include_isa_bit
: 1;
612 /* If FLIP_ISA_BIT, the ISA bit of the result is inverted.
613 This is true for JALX and false otherwise. */
614 unsigned int flip_isa_bit
: 1;
617 /* Return true if the assembly syntax allows OPERAND to be omitted. */
619 static inline bfd_boolean
620 mips_optional_operand_p (const struct mips_operand
*operand
)
622 return (operand
->type
== OP_OPTIONAL_REG
623 || operand
->type
== OP_REPEAT_PREV_REG
);
626 /* Return a version of INSN in which the field specified by OPERAND
629 static inline unsigned int
630 mips_insert_operand (const struct mips_operand
*operand
, unsigned int insn
,
635 mask
= (1 << operand
->size
) - 1;
636 insn
&= ~(mask
<< operand
->lsb
);
637 insn
|= (uval
& mask
) << operand
->lsb
;
641 /* Extract OPERAND from instruction INSN. */
643 static inline unsigned int
644 mips_extract_operand (const struct mips_operand
*operand
, unsigned int insn
)
646 return (insn
>> operand
->lsb
) & ((1 << operand
->size
) - 1);
649 /* UVAL is the value encoded by OPERAND. Return it in signed form. */
652 mips_signed_operand (const struct mips_operand
*operand
, unsigned int uval
)
654 unsigned int sign_bit
, mask
;
656 mask
= (1 << operand
->size
) - 1;
657 sign_bit
= 1 << (operand
->size
- 1);
658 return ((uval
+ sign_bit
) & mask
) - sign_bit
;
661 /* Return the integer that OPERAND encodes as UVAL. */
664 mips_decode_int_operand (const struct mips_int_operand
*operand
,
667 uval
|= (operand
->max_val
- uval
) & -(1 << operand
->root
.size
);
668 uval
+= operand
->bias
;
669 uval
<<= operand
->shift
;
673 /* Return the maximum value that can be encoded by OPERAND. */
676 mips_int_operand_max (const struct mips_int_operand
*operand
)
678 return (operand
->max_val
+ operand
->bias
) << operand
->shift
;
681 /* Return the minimum value that can be encoded by OPERAND. */
684 mips_int_operand_min (const struct mips_int_operand
*operand
)
688 mask
= (1 << operand
->root
.size
) - 1;
689 return mips_int_operand_max (operand
) - (mask
<< operand
->shift
);
692 /* Return the register that OPERAND encodes as UVAL. */
695 mips_decode_reg_operand (const struct mips_reg_operand
*operand
,
698 if (operand
->reg_map
)
699 uval
= operand
->reg_map
[uval
];
703 /* PC-relative operand OPERAND has value UVAL and is relative to BASE_PC.
704 Return the address that it encodes. */
706 static inline bfd_vma
707 mips_decode_pcrel_operand (const struct mips_pcrel_operand
*operand
,
708 bfd_vma base_pc
, unsigned int uval
)
712 addr
= base_pc
& -(1 << operand
->align_log2
);
713 addr
+= mips_decode_int_operand (&operand
->root
, uval
);
714 if (operand
->include_isa_bit
)
716 if (operand
->flip_isa_bit
)
721 /* This structure holds information for a particular instruction. */
725 /* The name of the instruction. */
727 /* A string describing the arguments for this instruction. */
729 /* The basic opcode for the instruction. When assembling, this
730 opcode is modified by the arguments to produce the actual opcode
731 that is used. If pinfo is INSN_MACRO, then this is 0. */
733 /* If pinfo is not INSN_MACRO, then this is a bit mask for the
734 relevant portions of the opcode when disassembling. If the
735 actual opcode anded with the match field equals the opcode field,
736 then we have found the correct instruction. If pinfo is
737 INSN_MACRO, then this field is the macro identifier. */
739 /* For a macro, this is INSN_MACRO. Otherwise, it is a collection
740 of bits describing the instruction, notably any relevant hazard
743 /* A collection of additional bits describing the instruction. */
744 unsigned long pinfo2
;
745 /* A collection of bits describing the instruction sets of which this
746 instruction or macro is a member. */
747 unsigned long membership
;
748 /* A collection of bits describing the ASE of which this instruction
749 or macro is a member. */
751 /* A collection of bits describing the instruction sets of which this
752 instruction or macro is not a member. */
753 unsigned long exclusions
;
756 /* Return true if MO is an instruction that requires 32-bit encoding. */
758 static inline bfd_boolean
759 mips_opcode_32bit_p (const struct mips_opcode
*mo
)
761 return mo
->mask
>> 16 != 0;
764 /* These are the characters which may appear in the args field of an
765 instruction. They appear in the order in which the fields appear
766 when the instruction is used. Commas and parentheses in the args
767 string are ignored when assembling, and written into the output
770 Each of these characters corresponds to a mask field defined above.
772 "1" 5 bit sync type (OP_*_STYPE)
773 "<" 5 bit shift amount (OP_*_SHAMT)
774 ">" shift amount between 32 and 63, stored after subtracting 32 (OP_*_SHAMT)
775 "a" 26 bit target address (OP_*_TARGET)
776 "+i" likewise, but flips bit 0
777 "b" 5 bit base register (OP_*_RS)
778 "c" 10 bit breakpoint code (OP_*_CODE)
779 "d" 5 bit destination register specifier (OP_*_RD)
780 "h" 5 bit prefx hint (OP_*_PREFX)
781 "i" 16 bit unsigned immediate (OP_*_IMMEDIATE)
782 "j" 16 bit signed immediate (OP_*_DELTA)
783 "k" 5 bit cache opcode in target register position (OP_*_CACHE)
784 "o" 16 bit signed offset (OP_*_DELTA)
785 "p" 16 bit PC relative branch target address (OP_*_DELTA)
786 "q" 10 bit extra breakpoint code (OP_*_CODE2)
787 "r" 5 bit same register used as both source and target (OP_*_RS)
788 "s" 5 bit source register specifier (OP_*_RS)
789 "t" 5 bit target register (OP_*_RT)
790 "u" 16 bit upper 16 bits of address (OP_*_IMMEDIATE)
791 "v" 5 bit same register used as both source and destination (OP_*_RS)
792 "w" 5 bit same register used as both target and destination (OP_*_RT)
793 "U" 5 bit same destination register in both OP_*_RD and OP_*_RT
794 (used by clo and clz)
795 "C" 25 bit coprocessor function code (OP_*_COPZ)
796 "B" 20 bit syscall/breakpoint function code (OP_*_CODE20)
797 "J" 19 bit wait function code (OP_*_CODE19)
798 "x" accept and ignore register name
799 "z" must be zero register
800 "K" 5 bit Hardware Register (rdhwr instruction) (OP_*_RD)
801 "+A" 5 bit ins/ext/dins/dext/dinsm/dextm position, which becomes
802 LSB (OP_*_SHAMT; OP_*_EXTLSB or OP_*_STYPE may be used for
803 microMIPS compatibility).
804 Enforces: 0 <= pos < 32.
805 "+B" 5 bit ins/dins size, which becomes MSB (OP_*_INSMSB).
806 Requires that "+A" or "+E" occur first to set position.
807 Enforces: 0 < (pos+size) <= 32.
808 "+C" 5 bit ext/dext size, which becomes MSBD (OP_*_EXTMSBD).
809 Requires that "+A" or "+E" occur first to set position.
810 Enforces: 0 < (pos+size) <= 32.
811 (Also used by "dext" w/ different limits, but limits for
812 that are checked by the M_DEXT macro.)
813 "+E" 5 bit dinsu/dextu position, which becomes LSB-32 (OP_*_SHAMT).
814 Enforces: 32 <= pos < 64.
815 "+F" 5 bit "dinsm/dinsu" size, which becomes MSB-32 (OP_*_INSMSB).
816 Requires that "+A" or "+E" occur first to set position.
817 Enforces: 32 < (pos+size) <= 64.
818 "+G" 5 bit "dextm" size, which becomes MSBD-32 (OP_*_EXTMSBD).
819 Requires that "+A" or "+E" occur first to set position.
820 Enforces: 32 < (pos+size) <= 64.
821 "+H" 5 bit "dextu" size, which becomes MSBD (OP_*_EXTMSBD).
822 Requires that "+A" or "+E" occur first to set position.
823 Enforces: 32 < (pos+size) <= 64.
825 Floating point instructions:
826 "D" 5 bit destination register (OP_*_FD)
827 "M" 3 bit compare condition code (OP_*_CCC) (only used for mips4 and up)
828 "N" 3 bit branch condition code (OP_*_BCC) (only used for mips4 and up)
829 "S" 5 bit fs source 1 register (OP_*_FS)
830 "T" 5 bit ft source 2 register (OP_*_FT)
831 "R" 5 bit fr source 3 register (OP_*_FR)
832 "V" 5 bit same register used as floating source and destination (OP_*_FS)
833 "W" 5 bit same register used as floating target and destination (OP_*_FT)
835 Coprocessor instructions:
836 "E" 5 bit target register (OP_*_RT)
837 "G" 5 bit destination register (OP_*_RD)
838 "H" 3 bit sel field for (d)mtc* and (d)mfc* (OP_*_SEL)
839 "P" 5 bit performance-monitor register (OP_*_PERFREG)
840 "e" 5 bit vector register byte specifier (OP_*_VECBYTE)
841 "%" 3 bit immediate vr5400 vector alignment operand (OP_*_VECALIGN)
844 "A" General 32 bit expression
845 "I" 32 bit immediate (value placed in imm_expr).
846 "F" 64 bit floating point constant in .rdata
847 "L" 64 bit floating point constant in .lit8
848 "f" 32 bit floating point constant
849 "l" 32 bit floating point constant in .lit4
851 MDMX and VR5400 instruction operands (note that while these use the
852 FP register fields, the MDMX instructions accept both $fN and $vN names
854 "O" alignment offset (OP_*_ALN)
855 "Q" vector/scalar/immediate source (OP_*_VSEL and OP_*_FT)
856 "X" destination register (OP_*_FD)
857 "Y" source register (OP_*_FS)
858 "Z" source register (OP_*_FT)
860 R5900 VU0 Macromode instructions:
861 "+5" 5 bit floating point register (FD)
862 "+6" 5 bit floating point register (FS)
863 "+7" 5 bit floating point register (FT)
864 "+8" 5 bit integer register (FD)
865 "+9" 5 bit integer register (FS)
866 "+0" 5 bit integer register (FT)
867 "+K" match an existing 4-bit channel mask starting at bit 21
868 "+L" 2-bit channel index starting at bit 21
869 "+M" 2-bit channel index starting at bit 23
870 "+N" match an existing 2-bit channel index starting at bit 0
871 "+f" 15 bit immediate for VCALLMS
872 "+g" 5 bit signed immediate for VIADDI
873 "+m" $ACC register (syntax only)
874 "+q" $Q register (syntax only)
875 "+r" $R register (syntax only)
876 "+y" $I register (syntax only)
877 "#+" "++" decorator in ($reg++) sequence
878 "#-" "--" decorator in (--$reg) sequence
881 "2" 2 bit unsigned immediate for byte align (OP_*_BP)
882 "3" 3 bit unsigned immediate (OP_*_SA3)
883 "4" 4 bit unsigned immediate (OP_*_SA4)
884 "5" 8 bit unsigned immediate (OP_*_IMM8)
885 "6" 5 bit unsigned immediate (OP_*_RS)
886 "7" 2 bit dsp accumulator register (OP_*_DSPACC)
887 "8" 6 bit unsigned immediate (OP_*_WRDSP)
888 "9" 2 bit dsp accumulator register (OP_*_DSPACC_S)
889 "0" 6 bit signed immediate (OP_*_DSPSFT)
890 ":" 7 bit signed immediate (OP_*_DSPSFT_7)
891 "'" 6 bit unsigned immediate (OP_*_RDDSP)
892 "@" 10 bit signed immediate (OP_*_IMM10)
895 "!" 1 bit usermode flag (OP_*_MT_U)
896 "$" 1 bit load high flag (OP_*_MT_H)
897 "*" 2 bit dsp/smartmips accumulator register (OP_*_MTACC_T)
898 "&" 2 bit dsp/smartmips accumulator register (OP_*_MTACC_D)
899 "g" 5 bit coprocessor 1 and 2 destination register (OP_*_RD)
900 "+t" 5 bit coprocessor 0 destination register (OP_*_RT)
903 "~" 12 bit offset (OP_*_OFFSET12)
904 "\" 3 bit position for aset and aclr (OP_*_3BITPOS)
907 "+J" 10-bit hypcall code (OP_*CODE10)
910 "+1" UDI immediate bits 6-10
911 "+2" UDI immediate bits 6-15
912 "+3" UDI immediate bits 6-20
913 "+4" UDI immediate bits 6-25
916 "+x" Bit index field of bbit. Enforces: 0 <= index < 32.
917 "+X" Bit index field of bbit aliasing bbit32. Matches if 32 <= index < 64,
918 otherwise skips to next candidate.
919 "+p" Position field of cins/cins32/exts/exts32. Enforces 0 <= pos < 32.
920 "+P" Position field of cins/exts aliasing cins32/exts32. Matches if
921 32 <= pos < 64, otherwise skips to next candidate.
922 "+Q" Immediate field of seqi/snei. Enforces -512 <= imm < 512.
923 "+s" Length-minus-one field of cins32/exts32. Requires msb position
924 of the field to be <= 31.
925 "+S" Length-minus-one field of cins/exts. Requires msb position
926 of the field to be <= 63.
929 "+a" 8-bit signed offset in bit 6 (OP_*_OFFSET_A)
930 "+b" 8-bit signed offset in bit 3 (OP_*_OFFSET_B)
931 "+c" 9-bit signed offset in bit 6 (OP_*_OFFSET_C)
932 "+z" 5-bit rz register (OP_*_RZ)
933 "+Z" 5-bit fz register (OP_*_FZ)
936 "+j" 9-bit signed offset in bit 7 (OP_*_EVAOFFSET)
939 "+d" 5-bit MSA register (FD)
940 "+e" 5-bit MSA register (FS)
941 "+h" 5-bit MSA register (FT)
942 "+k" 5-bit GPR at bit 6
943 "+l" 5-bit MSA control register at bit 6
944 "+n" 5-bit MSA control register at bit 11
945 "+o" 4-bit vector element index at bit 16
946 "+u" 3-bit vector element index at bit 16
947 "+v" 2-bit vector element index at bit 16
948 "+w" 1-bit vector element index at bit 16
949 "+T" (-512 .. 511) << 0 at bit 16
950 "+U" (-512 .. 511) << 1 at bit 16
951 "+V" (-512 .. 511) << 2 at bit 16
952 "+W" (-512 .. 511) << 3 at bit 16
953 "+~" 2 bit LSA/DLSA shift amount from 1 to 4 at bit 6
954 "+!" 3 bit unsigned bit position at bit 16
955 "+@" 4 bit unsigned bit position at bit 16
956 "+#" 6 bit unsigned bit position at bit 16
957 "+$" 5 bit unsigned immediate at bit 16
958 "+%" 5 bit signed immediate at bit 16
959 "+^" 10 bit signed immediate at bit 11
960 "+&" 0 vector element index
961 "+*" 5-bit register vector element index at bit 16
962 "+|" 8-bit mask at bit 16
965 "+:" 11-bit mask at bit 0
966 "+'" 26 bit PC relative branch target address
967 "+"" 21 bit PC relative branch target address
968 "+;" 5 bit same register in both OP_*_RS and OP_*_RT
969 "+I" 2bit unsigned bit position at bit 6
970 "+O" 3bit unsigned bit position at bit 6
971 "+R" must be program counter
972 "-a" (-262144 .. 262143) << 2 at bit 0
973 "-b" (-131072 .. 131071) << 3 at bit 0
974 "-d" Same as destination register GP
975 "-s" 5 bit source register specifier (OP_*_RS) not $0
976 "-t" 5 bit source register specifier (OP_*_RT) not $0
977 "-u" 5 bit source register specifier (OP_*_RT) greater than OP_*_RS
978 "-v" 5 bit source register specifier (OP_*_RT) not $0 not OP_*_RS
979 "-w" 5 bit source register specifier (OP_*_RT) less than or equal to OP_*_RS
980 "-x" 5 bit source register specifier (OP_*_RT) greater than or
982 "-y" 5 bit source register specifier (OP_*_RT) not $0 less than OP_*_RS
983 "-A" symbolic offset (-262144 .. 262143) << 2 at bit 0
984 "-B" symbolic offset (-131072 .. 131071) << 3 at bit 0
987 "()" parens surrounding optional value
988 "," separates operands
989 "+" Start of extension sequence.
991 Characters used so far, for quick reference when adding more:
993 "%[]<>(),+-:'@!#$*&\~"
994 "ABCDEFGHIJKLMNOPQRSTUVWXYZ"
995 "abcdefghijklopqrstuvwxz"
997 Extension character sequences used so far ("+" followed by the
998 following), for quick reference when adding more:
1001 "ABCEFGHIJKLMNOPQRSTUVWXZ"
1002 "abcdefghijklmnopqrstuvwxyz"
1004 Extension character sequences used so far ("-" followed by the
1005 following), for quick reference when adding more:
1010 /* These are the bits which may be set in the pinfo field of an
1011 instructions, if it is not equal to INSN_MACRO. */
1013 /* Writes to operand number N. */
1014 #define INSN_WRITE_SHIFT 0
1015 #define INSN_WRITE_1 0x00000001
1016 #define INSN_WRITE_2 0x00000002
1017 #define INSN_WRITE_ALL 0x00000003
1018 /* Reads from operand number N. */
1019 #define INSN_READ_SHIFT 2
1020 #define INSN_READ_1 0x00000004
1021 #define INSN_READ_2 0x00000008
1022 #define INSN_READ_3 0x00000010
1023 #define INSN_READ_4 0x00000020
1024 #define INSN_READ_ALL 0x0000003c
1025 /* Modifies general purpose register 31. */
1026 #define INSN_WRITE_GPR_31 0x00000040
1027 /* Modifies coprocessor condition code. */
1028 #define INSN_WRITE_COND_CODE 0x00000080
1029 /* Reads coprocessor condition code. */
1030 #define INSN_READ_COND_CODE 0x00000100
1031 /* TLB operation. */
1032 #define INSN_TLB 0x00000200
1033 /* Reads coprocessor register other than floating point register. */
1034 #define INSN_COP 0x00000400
1035 /* Instruction loads value from memory. */
1036 #define INSN_LOAD_MEMORY 0x00000800
1037 /* Instruction loads value from coprocessor, (may require delay). */
1038 #define INSN_LOAD_COPROC 0x00001000
1039 /* Instruction has unconditional branch delay slot. */
1040 #define INSN_UNCOND_BRANCH_DELAY 0x00002000
1041 /* Instruction has conditional branch delay slot. */
1042 #define INSN_COND_BRANCH_DELAY 0x00004000
1043 /* Conditional branch likely: if branch not taken, insn nullified. */
1044 #define INSN_COND_BRANCH_LIKELY 0x00008000
1045 /* Moves to coprocessor register, (may require delay). */
1046 #define INSN_COPROC_MOVE 0x00010000
1047 /* Loads coprocessor register from memory, requiring delay. */
1048 #define INSN_COPROC_MEMORY_DELAY 0x00020000
1049 /* Reads the HI register. */
1050 #define INSN_READ_HI 0x00040000
1051 /* Reads the LO register. */
1052 #define INSN_READ_LO 0x00080000
1053 /* Modifies the HI register. */
1054 #define INSN_WRITE_HI 0x00100000
1055 /* Modifies the LO register. */
1056 #define INSN_WRITE_LO 0x00200000
1057 /* Not to be placed in a branch delay slot, either architecturally
1058 or for ease of handling (such as with instructions that take a trap). */
1059 #define INSN_NO_DELAY_SLOT 0x00400000
1060 /* Instruction stores value into memory. */
1061 #define INSN_STORE_MEMORY 0x00800000
1062 /* Instruction uses single precision floating point. */
1063 #define FP_S 0x01000000
1064 /* Instruction uses double precision floating point. */
1065 #define FP_D 0x02000000
1066 /* Instruction is part of the tx39's integer multiply family. */
1067 #define INSN_MULT 0x04000000
1068 /* Reads general purpose register 24. */
1069 #define INSN_READ_GPR_24 0x08000000
1070 /* Writes to general purpose register 24. */
1071 #define INSN_WRITE_GPR_24 0x10000000
1072 /* A user-defined instruction. */
1073 #define INSN_UDI 0x20000000
1074 /* Instruction is actually a macro. It should be ignored by the
1075 disassembler, and requires special treatment by the assembler. */
1076 #define INSN_MACRO 0xffffffff
1078 /* These are the bits which may be set in the pinfo2 field of an
1081 /* Instruction is a simple alias (I.E. "move" for daddu/addu/or) */
1082 #define INSN2_ALIAS 0x00000001
1083 /* Instruction reads MDMX accumulator. */
1084 #define INSN2_READ_MDMX_ACC 0x00000002
1085 /* Instruction writes MDMX accumulator. */
1086 #define INSN2_WRITE_MDMX_ACC 0x00000004
1087 /* Macro uses single-precision floating-point instructions. This should
1088 only be set for macros. For instructions, FP_S in pinfo carries the
1089 same information. */
1090 #define INSN2_M_FP_S 0x00000008
1091 /* Macro uses double-precision floating-point instructions. This should
1092 only be set for macros. For instructions, FP_D in pinfo carries the
1093 same information. */
1094 #define INSN2_M_FP_D 0x00000010
1095 /* Instruction has a branch delay slot that requires a 16-bit instruction. */
1096 #define INSN2_BRANCH_DELAY_16BIT 0x00000020
1097 /* Instruction has a branch delay slot that requires a 32-bit instruction. */
1098 #define INSN2_BRANCH_DELAY_32BIT 0x00000040
1099 /* Writes to the stack pointer ($29). */
1100 #define INSN2_WRITE_SP 0x00000080
1101 /* Reads from the stack pointer ($29). */
1102 #define INSN2_READ_SP 0x00000100
1103 /* Reads the RA ($31) register. */
1104 #define INSN2_READ_GPR_31 0x00000200
1105 /* Reads the program counter ($pc). */
1106 #define INSN2_READ_PC 0x00000400
1107 /* Is an unconditional branch insn. */
1108 #define INSN2_UNCOND_BRANCH 0x00000800
1109 /* Is a conditional branch insn. */
1110 #define INSN2_COND_BRANCH 0x00001000
1111 /* Reads from $16. This is true of the MIPS16 0x6500 nop. */
1112 #define INSN2_READ_GPR_16 0x00002000
1113 /* Has an "\.x?y?z?w?" suffix based on mips_vu0_channel_mask. */
1114 #define INSN2_VU0_CHANNEL_SUFFIX 0x00004000
1115 /* Instruction has a forbidden slot. */
1116 #define INSN2_FORBIDDEN_SLOT 0x00008000
1118 /* Masks used to mark instructions to indicate which MIPS ISA level
1119 they were introduced in. INSN_ISA_MASK masks an enumeration that
1120 specifies the base ISA level(s). The remainder of a 32-bit
1121 word constructed using these macros is a bitmask of the remaining
1122 INSN_* values below. */
1124 #define INSN_ISA_MASK 0x0000001ful
1126 /* We cannot start at zero due to ISA_UNKNOWN below. */
1132 #define INSN_ISA32 6
1133 #define INSN_ISA32R2 7
1134 #define INSN_ISA32R3 8
1135 #define INSN_ISA32R5 9
1136 #define INSN_ISA32R6 10
1137 #define INSN_ISA64 11
1138 #define INSN_ISA64R2 12
1139 #define INSN_ISA64R3 13
1140 #define INSN_ISA64R5 14
1141 #define INSN_ISA64R6 15
1142 /* Below this point the INSN_* values correspond to combinations of ISAs.
1143 They are only for use in the opcodes table to indicate membership of
1144 a combination of ISAs that cannot be expressed using the usual inclusion
1145 ordering on the above INSN_* values. */
1146 #define INSN_ISA3_32 16
1147 #define INSN_ISA3_32R2 17
1148 #define INSN_ISA4_32 18
1149 #define INSN_ISA4_32R2 19
1150 #define INSN_ISA5_32R2 20
1152 /* The R6 definitions shown below state that they support all previous ISAs.
1153 This is not actually true as some instructions are removed in R6.
1154 The problem is that the removed instructions in R6 come from different
1155 ISAs. One approach to solve this would be to describe in the membership
1156 field of the opcode table the different ISAs an instruction belongs to.
1157 This would require us to create a large amount of different ISA
1158 combinations which is hard to manage. A cleaner approach (which is
1159 implemented here) is to say that R6 is an extension of R5 and then to
1160 deal with the removed instructions by adding instruction exclusions
1161 for R6 in the opcode table. */
1163 /* Bit INSN_ISA<X> - 1 of INSN_UPTO<Y> is set if ISA Y includes ISA X. */
1165 #define ISAF(X) (1 << (INSN_ISA##X - 1))
1166 #define INSN_UPTO1 ISAF(1)
1167 #define INSN_UPTO2 INSN_UPTO1 | ISAF(2)
1168 #define INSN_UPTO3 INSN_UPTO2 | ISAF(3) | ISAF(3_32) | ISAF(3_32R2)
1169 #define INSN_UPTO4 INSN_UPTO3 | ISAF(4) | ISAF(4_32) | ISAF(4_32R2)
1170 #define INSN_UPTO5 INSN_UPTO4 | ISAF(5) | ISAF(5_32R2)
1171 #define INSN_UPTO32 INSN_UPTO2 | ISAF(32) | ISAF(3_32) | ISAF(4_32)
1172 #define INSN_UPTO32R2 INSN_UPTO32 | ISAF(32R2) \
1173 | ISAF(3_32R2) | ISAF(4_32R2) | ISAF(5_32R2)
1174 #define INSN_UPTO32R3 INSN_UPTO32R2 | ISAF(32R3)
1175 #define INSN_UPTO32R5 INSN_UPTO32R3 | ISAF(32R5)
1176 #define INSN_UPTO32R6 INSN_UPTO32R5 | ISAF(32R6)
1177 #define INSN_UPTO64 INSN_UPTO5 | ISAF(64) | ISAF(32)
1178 #define INSN_UPTO64R2 INSN_UPTO64 | ISAF(64R2) | ISAF(32R2)
1179 #define INSN_UPTO64R3 INSN_UPTO64R2 | ISAF(64R3) | ISAF(32R3)
1180 #define INSN_UPTO64R5 INSN_UPTO64R3 | ISAF(64R5) | ISAF(32R5)
1181 #define INSN_UPTO64R6 INSN_UPTO64R5 | ISAF(64R6) | ISAF(32R6)
1183 /* The same information in table form: bit INSN_ISA<X> - 1 of index
1184 INSN_UPTO<Y> - 1 is set if ISA Y includes ISA X. */
1185 static const unsigned int mips_isa_table
[] = {
1204 /* Masks used for Chip specific instructions. */
1205 #define INSN_CHIP_MASK 0xc3ff4f60
1207 /* Cavium Networks Octeon instructions. */
1208 #define INSN_OCTEON 0x00000800
1209 #define INSN_OCTEONP 0x00000200
1210 #define INSN_OCTEON2 0x00000100
1211 #define INSN_OCTEON3 0x00000040
1213 /* MIPS R5900 instruction */
1214 #define INSN_5900 0x00004000
1216 /* MIPS R4650 instruction. */
1217 #define INSN_4650 0x00010000
1218 /* LSI R4010 instruction. */
1219 #define INSN_4010 0x00020000
1220 /* NEC VR4100 instruction. */
1221 #define INSN_4100 0x00040000
1222 /* Toshiba R3900 instruction. */
1223 #define INSN_3900 0x00080000
1224 /* MIPS R10000 instruction. */
1225 #define INSN_10000 0x00100000
1226 /* Broadcom SB-1 instruction. */
1227 #define INSN_SB1 0x00200000
1228 /* NEC VR4111/VR4181 instruction. */
1229 #define INSN_4111 0x00400000
1230 /* NEC VR4120 instruction. */
1231 #define INSN_4120 0x00800000
1232 /* NEC VR5400 instruction. */
1233 #define INSN_5400 0x01000000
1234 /* NEC VR5500 instruction. */
1235 #define INSN_5500 0x02000000
1237 /* ST Microelectronics Loongson 2E. */
1238 #define INSN_LOONGSON_2E 0x40000000
1239 /* ST Microelectronics Loongson 2F. */
1240 #define INSN_LOONGSON_2F 0x80000000
1242 #define INSN_LOONGSON_3A 0x00000400
1243 /* RMI Xlr instruction */
1244 #define INSN_XLR 0x00000020
1247 #define ASE_DSP 0x00000001
1248 #define ASE_DSP64 0x00000002
1250 #define ASE_DSPR2 0x00000004
1251 /* Enhanced VA Scheme */
1252 #define ASE_EVA 0x00000008
1253 /* MCU (MicroController) ASE */
1254 #define ASE_MCU 0x00000010
1256 #define ASE_MDMX 0x00000020
1258 #define ASE_MIPS3D 0x00000040
1260 #define ASE_MT 0x00000080
1262 #define ASE_SMARTMIPS 0x00000100
1263 /* Virtualization ASE */
1264 #define ASE_VIRT 0x00000200
1265 #define ASE_VIRT64 0x00000400
1267 #define ASE_MSA 0x00000800
1268 #define ASE_MSA64 0x00001000
1269 /* eXtended Physical Address (XPA) Extension. */
1270 #define ASE_XPA 0x00002000
1271 /* DSP R3 Module. */
1272 #define ASE_DSPR3 0x00004000
1274 /* MIPS ISA defines, use instead of hardcoding ISA level. */
1276 #define ISA_UNKNOWN 0 /* Gas internal use. */
1277 #define ISA_MIPS1 INSN_ISA1
1278 #define ISA_MIPS2 INSN_ISA2
1279 #define ISA_MIPS3 INSN_ISA3
1280 #define ISA_MIPS4 INSN_ISA4
1281 #define ISA_MIPS5 INSN_ISA5
1283 #define ISA_MIPS32 INSN_ISA32
1284 #define ISA_MIPS64 INSN_ISA64
1286 #define ISA_MIPS32R2 INSN_ISA32R2
1287 #define ISA_MIPS32R3 INSN_ISA32R3
1288 #define ISA_MIPS32R5 INSN_ISA32R5
1289 #define ISA_MIPS64R2 INSN_ISA64R2
1290 #define ISA_MIPS64R3 INSN_ISA64R3
1291 #define ISA_MIPS64R5 INSN_ISA64R5
1293 #define ISA_MIPS32R6 INSN_ISA32R6
1294 #define ISA_MIPS64R6 INSN_ISA64R6
1296 /* CPU defines, use instead of hardcoding processor number. Keep this
1297 in sync with bfd/archures.c in order for machine selection to work. */
1298 #define CPU_UNKNOWN 0 /* Gas internal use. */
1299 #define CPU_R3000 3000
1300 #define CPU_R3900 3900
1301 #define CPU_R4000 4000
1302 #define CPU_R4010 4010
1303 #define CPU_VR4100 4100
1304 #define CPU_R4111 4111
1305 #define CPU_VR4120 4120
1306 #define CPU_R4300 4300
1307 #define CPU_R4400 4400
1308 #define CPU_R4600 4600
1309 #define CPU_R4650 4650
1310 #define CPU_R5000 5000
1311 #define CPU_VR5400 5400
1312 #define CPU_VR5500 5500
1313 #define CPU_R5900 5900
1314 #define CPU_R6000 6000
1315 #define CPU_RM7000 7000
1316 #define CPU_R8000 8000
1317 #define CPU_RM9000 9000
1318 #define CPU_R10000 10000
1319 #define CPU_R12000 12000
1320 #define CPU_R14000 14000
1321 #define CPU_R16000 16000
1322 #define CPU_MIPS16 16
1323 #define CPU_MIPS32 32
1324 #define CPU_MIPS32R2 33
1325 #define CPU_MIPS32R3 34
1326 #define CPU_MIPS32R5 36
1327 #define CPU_MIPS32R6 37
1329 #define CPU_MIPS64 64
1330 #define CPU_MIPS64R2 65
1331 #define CPU_MIPS64R3 66
1332 #define CPU_MIPS64R5 68
1333 #define CPU_MIPS64R6 69
1334 #define CPU_SB1 12310201 /* octal 'SB', 01. */
1335 #define CPU_LOONGSON_2E 3001
1336 #define CPU_LOONGSON_2F 3002
1337 #define CPU_LOONGSON_3A 3003
1338 #define CPU_OCTEON 6501
1339 #define CPU_OCTEONP 6601
1340 #define CPU_OCTEON2 6502
1341 #define CPU_OCTEON3 6503
1342 #define CPU_XLR 887682 /* decimal 'XLR' */
1344 /* Return true if the given CPU is included in INSN_* mask MASK. */
1346 static inline bfd_boolean
1347 cpu_is_member (int cpu
, unsigned int mask
)
1354 return (mask
& INSN_4650
) != 0;
1357 return (mask
& INSN_4010
) != 0;
1360 return (mask
& INSN_4100
) != 0;
1363 return (mask
& INSN_3900
) != 0;
1369 return (mask
& INSN_10000
) != 0;
1372 return (mask
& INSN_SB1
) != 0;
1375 return (mask
& INSN_4111
) != 0;
1378 return (mask
& INSN_4120
) != 0;
1381 return (mask
& INSN_5400
) != 0;
1384 return (mask
& INSN_5500
) != 0;
1387 return (mask
& INSN_5900
) != 0;
1389 case CPU_LOONGSON_2E
:
1390 return (mask
& INSN_LOONGSON_2E
) != 0;
1392 case CPU_LOONGSON_2F
:
1393 return (mask
& INSN_LOONGSON_2F
) != 0;
1395 case CPU_LOONGSON_3A
:
1396 return (mask
& INSN_LOONGSON_3A
) != 0;
1399 return (mask
& INSN_OCTEON
) != 0;
1402 return (mask
& INSN_OCTEONP
) != 0;
1405 return (mask
& INSN_OCTEON2
) != 0;
1408 return (mask
& INSN_OCTEON3
) != 0;
1411 return (mask
& INSN_XLR
) != 0;
1414 return (mask
& INSN_ISA_MASK
) == INSN_ISA32R6
;
1417 return ((mask
& INSN_ISA_MASK
) == INSN_ISA32R6
)
1418 || ((mask
& INSN_ISA_MASK
) == INSN_ISA64R6
);
1425 /* Test for membership in an ISA including chip specific ISAs. INSN
1426 is pointer to an element of the opcode table; ISA is the specified
1427 ISA/ASE bitmask to test against; and CPU is the CPU specific ISA to
1428 test, or zero if no CPU specific ISA test is desired. Return true
1429 if instruction INSN is available to the given ISA and CPU. */
1431 static inline bfd_boolean
1432 opcode_is_member (const struct mips_opcode
*insn
, int isa
, int ase
, int cpu
)
1434 if (!cpu_is_member (cpu
, insn
->exclusions
))
1436 /* Test for ISA level compatibility. */
1437 if ((isa
& INSN_ISA_MASK
) != 0
1438 && (insn
->membership
& INSN_ISA_MASK
) != 0
1439 && ((mips_isa_table
[(isa
& INSN_ISA_MASK
) - 1]
1440 >> ((insn
->membership
& INSN_ISA_MASK
) - 1)) & 1) != 0)
1443 /* Test for ASE compatibility. */
1444 if ((ase
& insn
->ase
) != 0)
1447 /* Test for processor-specific extensions. */
1448 if (cpu_is_member (cpu
, insn
->membership
))
1454 /* This is a list of macro expanded instructions.
1456 _I appended means immediate
1457 _A appended means target address of a jump
1458 _AB appended means address with (possibly zero) base register
1459 _D appended means 64 bit floating point constant
1460 _S appended means 32 bit floating point constant. */
1713 /* The order of overloaded instructions matters. Label arguments and
1714 register arguments look the same. Instructions that can have either
1715 for arguments must apear in the correct order in this table for the
1716 assembler to pick the right one. In other words, entries with
1717 immediate operands must apear after the same instruction with
1720 Many instructions are short hand for other instructions (i.e., The
1721 jal <register> instruction is short for jalr <register>). */
1723 extern const struct mips_operand mips_vu0_channel_mask
;
1724 extern const struct mips_operand
*decode_mips_operand (const char *);
1725 extern const struct mips_opcode mips_builtin_opcodes
[];
1726 extern const int bfd_mips_num_builtin_opcodes
;
1727 extern struct mips_opcode
*mips_opcodes
;
1728 extern int bfd_mips_num_opcodes
;
1729 #define NUMOPCODES bfd_mips_num_opcodes
1732 /* The rest of this file adds definitions for the mips16 TinyRISC
1735 /* These are the bitmasks and shift counts used for the different
1736 fields in the instruction formats. Other than OP, no masks are
1737 provided for the fixed portions of an instruction, since they are
1740 The I format uses IMM11.
1742 The RI format uses RX and IMM8.
1744 The RR format uses RX, and RY.
1746 The RRI format uses RX, RY, and IMM5.
1748 The RRR format uses RX, RY, and RZ.
1750 The RRI_A format uses RX, RY, and IMM4.
1752 The SHIFT format uses RX, RY, and SHAMT.
1754 The I8 format uses IMM8.
1756 The I8_MOVR32 format uses RY and REGR32.
1758 The IR_MOV32R format uses REG32R and MOV32Z.
1760 The I64 format uses IMM8.
1762 The RI64 format uses RY and IMM5.
1765 #define MIPS16OP_MASK_OP 0x1f
1766 #define MIPS16OP_SH_OP 11
1767 #define MIPS16OP_MASK_IMM11 0x7ff
1768 #define MIPS16OP_SH_IMM11 0
1769 #define MIPS16OP_MASK_RX 0x7
1770 #define MIPS16OP_SH_RX 8
1771 #define MIPS16OP_MASK_IMM8 0xff
1772 #define MIPS16OP_SH_IMM8 0
1773 #define MIPS16OP_MASK_RY 0x7
1774 #define MIPS16OP_SH_RY 5
1775 #define MIPS16OP_MASK_IMM5 0x1f
1776 #define MIPS16OP_SH_IMM5 0
1777 #define MIPS16OP_MASK_RZ 0x7
1778 #define MIPS16OP_SH_RZ 2
1779 #define MIPS16OP_MASK_IMM4 0xf
1780 #define MIPS16OP_SH_IMM4 0
1781 #define MIPS16OP_MASK_REGR32 0x1f
1782 #define MIPS16OP_SH_REGR32 0
1783 #define MIPS16OP_MASK_REG32R 0x1f
1784 #define MIPS16OP_SH_REG32R 3
1785 #define MIPS16OP_EXTRACT_REG32R(i) ((((i) >> 5) & 7) | ((i) & 0x18))
1786 #define MIPS16OP_MASK_MOVE32Z 0x7
1787 #define MIPS16OP_SH_MOVE32Z 0
1788 #define MIPS16OP_MASK_IMM6 0x3f
1789 #define MIPS16OP_SH_IMM6 5
1791 /* These are the characters which may appears in the args field of a MIPS16
1792 instruction. They appear in the order in which the fields appear when the
1793 instruction is used. Commas and parentheses in the args string are ignored
1794 when assembling, and written into the output when disassembling.
1796 "y" 3 bit register (MIPS16OP_*_RY)
1797 "x" 3 bit register (MIPS16OP_*_RX)
1798 "z" 3 bit register (MIPS16OP_*_RZ)
1799 "Z" 3 bit register (MIPS16OP_*_MOVE32Z)
1800 "v" 3 bit same register as source and destination (MIPS16OP_*_RX)
1801 "w" 3 bit same register as source and destination (MIPS16OP_*_RY)
1802 "0" zero register ($0)
1803 "S" stack pointer ($sp or $29)
1805 "R" return address register ($ra or $31)
1806 "X" 5 bit MIPS register (MIPS16OP_*_REGR32)
1807 "Y" 5 bit MIPS register (MIPS16OP_*_REG32R)
1808 "6" 6 bit unsigned break code (MIPS16OP_*_IMM6)
1809 "a" 26 bit jump address
1810 "i" likewise, but flips bit 0
1811 "e" 11 bit extension value
1812 "l" register list for entry instruction
1813 "L" register list for exit instruction
1815 "I" an immediate value used for macros
1817 The remaining codes may be extended. Except as otherwise noted,
1818 the full extended operand is a 16 bit signed value.
1819 "<" 3 bit unsigned shift count * 0 (MIPS16OP_*_RZ) (full 5 bit unsigned)
1820 "[" 3 bit unsigned shift count * 0 (MIPS16OP_*_RZ) (full 6 bit unsigned)
1821 "]" 3 bit unsigned shift count * 0 (MIPS16OP_*_RX) (full 6 bit unsigned)
1822 "4" 4 bit signed immediate * 0 (MIPS16OP_*_IMM4) (full 15 bit signed)
1823 "5" 5 bit unsigned immediate * 0 (MIPS16OP_*_IMM5)
1824 "H" 5 bit unsigned immediate * 2 (MIPS16OP_*_IMM5)
1825 "W" 5 bit unsigned immediate * 4 (MIPS16OP_*_IMM5)
1826 "D" 5 bit unsigned immediate * 8 (MIPS16OP_*_IMM5)
1827 "j" 5 bit signed immediate * 0 (MIPS16OP_*_IMM5)
1828 "8" 8 bit unsigned immediate * 0 (MIPS16OP_*_IMM8)
1829 "V" 8 bit unsigned immediate * 4 (MIPS16OP_*_IMM8)
1830 "C" 8 bit unsigned immediate * 8 (MIPS16OP_*_IMM8)
1831 "U" 8 bit unsigned immediate * 0 (MIPS16OP_*_IMM8) (full 16 bit unsigned)
1832 "k" 8 bit signed immediate * 0 (MIPS16OP_*_IMM8)
1833 "K" 8 bit signed immediate * 8 (MIPS16OP_*_IMM8)
1834 "p" 8 bit conditional branch address (MIPS16OP_*_IMM8)
1835 "q" 11 bit branch address (MIPS16OP_*_IMM11)
1836 "A" 8 bit PC relative address * 4 (MIPS16OP_*_IMM8)
1837 "B" 5 bit PC relative address * 8 (MIPS16OP_*_IMM5)
1838 "E" 5 bit PC relative address * 4 (MIPS16OP_*_IMM5)
1839 "m" 7 bit register list for save instruction (18 bit extended)
1840 "M" 7 bit register list for restore instruction (18 bit extended)
1842 Characters used so far, for quick reference when adding more:
1845 "ABCDE HI KLM P RS UVWXYZ"
1846 "a e ijklm pq vwxyz"
1849 /* Save/restore encoding for the args field when all 4 registers are
1850 either saved as arguments or saved/restored as statics. */
1851 #define MIPS16_ALL_ARGS 0xe
1852 #define MIPS16_ALL_STATICS 0xb
1854 /* The following flags have the same value for the mips16 opcode
1859 INSN_UNCOND_BRANCH_DELAY
1860 INSN_COND_BRANCH_DELAY
1861 INSN_COND_BRANCH_LIKELY (never used)
1870 extern const struct mips_operand
*decode_mips16_operand (char, bfd_boolean
);
1871 extern const struct mips_opcode mips16_opcodes
[];
1872 extern const int bfd_mips16_num_opcodes
;
1874 /* These are the bit masks and shift counts used for the different fields
1875 in the microMIPS instruction formats. No masks are provided for the
1876 fixed portions of an instruction, since they are not needed. */
1878 #define MICROMIPSOP_MASK_IMMEDIATE 0xffff
1879 #define MICROMIPSOP_SH_IMMEDIATE 0
1880 #define MICROMIPSOP_MASK_DELTA 0xffff
1881 #define MICROMIPSOP_SH_DELTA 0
1882 #define MICROMIPSOP_MASK_CODE10 0x3ff
1883 #define MICROMIPSOP_SH_CODE10 16 /* 10-bit wait code. */
1884 #define MICROMIPSOP_MASK_TRAP 0xf
1885 #define MICROMIPSOP_SH_TRAP 12 /* 4-bit trap code. */
1886 #define MICROMIPSOP_MASK_SHAMT 0x1f
1887 #define MICROMIPSOP_SH_SHAMT 11
1888 #define MICROMIPSOP_MASK_TARGET 0x3ffffff
1889 #define MICROMIPSOP_SH_TARGET 0
1890 #define MICROMIPSOP_MASK_EXTLSB 0x1f /* "ext" LSB. */
1891 #define MICROMIPSOP_SH_EXTLSB 6
1892 #define MICROMIPSOP_MASK_EXTMSBD 0x1f /* "ext" MSBD. */
1893 #define MICROMIPSOP_SH_EXTMSBD 11
1894 #define MICROMIPSOP_MASK_INSMSB 0x1f /* "ins" MSB. */
1895 #define MICROMIPSOP_SH_INSMSB 11
1896 #define MICROMIPSOP_MASK_CODE 0x3ff
1897 #define MICROMIPSOP_SH_CODE 16 /* 10-bit higher break code. */
1898 #define MICROMIPSOP_MASK_CODE2 0x3ff
1899 #define MICROMIPSOP_SH_CODE2 6 /* 10-bit lower break code. */
1900 #define MICROMIPSOP_MASK_CACHE 0x1f
1901 #define MICROMIPSOP_SH_CACHE 21 /* 5-bit cache op. */
1902 #define MICROMIPSOP_MASK_SEL 0x7
1903 #define MICROMIPSOP_SH_SEL 11
1904 #define MICROMIPSOP_MASK_OFFSET12 0xfff
1905 #define MICROMIPSOP_SH_OFFSET12 0
1906 #define MICROMIPSOP_MASK_3BITPOS 0x7
1907 #define MICROMIPSOP_SH_3BITPOS 21
1908 #define MICROMIPSOP_MASK_STYPE 0x1f
1909 #define MICROMIPSOP_SH_STYPE 16
1910 #define MICROMIPSOP_MASK_OFFSET10 0x3ff
1911 #define MICROMIPSOP_SH_OFFSET10 6
1912 #define MICROMIPSOP_MASK_RS 0x1f
1913 #define MICROMIPSOP_SH_RS 16
1914 #define MICROMIPSOP_MASK_RT 0x1f
1915 #define MICROMIPSOP_SH_RT 21
1916 #define MICROMIPSOP_MASK_RD 0x1f
1917 #define MICROMIPSOP_SH_RD 11
1918 #define MICROMIPSOP_MASK_FS 0x1f
1919 #define MICROMIPSOP_SH_FS 16
1920 #define MICROMIPSOP_MASK_FT 0x1f
1921 #define MICROMIPSOP_SH_FT 21
1922 #define MICROMIPSOP_MASK_FD 0x1f
1923 #define MICROMIPSOP_SH_FD 11
1924 #define MICROMIPSOP_MASK_FR 0x1f
1925 #define MICROMIPSOP_SH_FR 6
1926 #define MICROMIPSOP_MASK_RS3 0x1f
1927 #define MICROMIPSOP_SH_RS3 6
1928 #define MICROMIPSOP_MASK_PREFX 0x1f
1929 #define MICROMIPSOP_SH_PREFX 11
1930 #define MICROMIPSOP_MASK_BCC 0x7
1931 #define MICROMIPSOP_SH_BCC 18
1932 #define MICROMIPSOP_MASK_CCC 0x7
1933 #define MICROMIPSOP_SH_CCC 13
1934 #define MICROMIPSOP_MASK_COPZ 0x7fffff
1935 #define MICROMIPSOP_SH_COPZ 3
1937 #define MICROMIPSOP_MASK_MB 0x7
1938 #define MICROMIPSOP_SH_MB 23
1939 #define MICROMIPSOP_MASK_MC 0x7
1940 #define MICROMIPSOP_SH_MC 4
1941 #define MICROMIPSOP_MASK_MD 0x7
1942 #define MICROMIPSOP_SH_MD 7
1943 #define MICROMIPSOP_MASK_ME 0x7
1944 #define MICROMIPSOP_SH_ME 1
1945 #define MICROMIPSOP_MASK_MF 0x7
1946 #define MICROMIPSOP_SH_MF 3
1947 #define MICROMIPSOP_MASK_MG 0x7
1948 #define MICROMIPSOP_SH_MG 0
1949 #define MICROMIPSOP_MASK_MH 0x7
1950 #define MICROMIPSOP_SH_MH 7
1951 #define MICROMIPSOP_MASK_MJ 0x1f
1952 #define MICROMIPSOP_SH_MJ 0
1953 #define MICROMIPSOP_MASK_ML 0x7
1954 #define MICROMIPSOP_SH_ML 4
1955 #define MICROMIPSOP_MASK_MM 0x7
1956 #define MICROMIPSOP_SH_MM 1
1957 #define MICROMIPSOP_MASK_MN 0x7
1958 #define MICROMIPSOP_SH_MN 4
1959 #define MICROMIPSOP_MASK_MP 0x1f
1960 #define MICROMIPSOP_SH_MP 5
1961 #define MICROMIPSOP_MASK_MQ 0x7
1962 #define MICROMIPSOP_SH_MQ 7
1964 #define MICROMIPSOP_MASK_IMMA 0x7f
1965 #define MICROMIPSOP_SH_IMMA 0
1966 #define MICROMIPSOP_MASK_IMMB 0x7
1967 #define MICROMIPSOP_SH_IMMB 1
1968 #define MICROMIPSOP_MASK_IMMC 0xf
1969 #define MICROMIPSOP_SH_IMMC 0
1970 #define MICROMIPSOP_MASK_IMMD 0x3ff
1971 #define MICROMIPSOP_SH_IMMD 0
1972 #define MICROMIPSOP_MASK_IMME 0x7f
1973 #define MICROMIPSOP_SH_IMME 0
1974 #define MICROMIPSOP_MASK_IMMF 0xf
1975 #define MICROMIPSOP_SH_IMMF 0
1976 #define MICROMIPSOP_MASK_IMMG 0xf
1977 #define MICROMIPSOP_SH_IMMG 0
1978 #define MICROMIPSOP_MASK_IMMH 0xf
1979 #define MICROMIPSOP_SH_IMMH 0
1980 #define MICROMIPSOP_MASK_IMMI 0x7f
1981 #define MICROMIPSOP_SH_IMMI 0
1982 #define MICROMIPSOP_MASK_IMMJ 0xf
1983 #define MICROMIPSOP_SH_IMMJ 0
1984 #define MICROMIPSOP_MASK_IMML 0xf
1985 #define MICROMIPSOP_SH_IMML 0
1986 #define MICROMIPSOP_MASK_IMMM 0x7
1987 #define MICROMIPSOP_SH_IMMM 1
1988 #define MICROMIPSOP_MASK_IMMN 0x3
1989 #define MICROMIPSOP_SH_IMMN 4
1990 #define MICROMIPSOP_MASK_IMMO 0xf
1991 #define MICROMIPSOP_SH_IMMO 0
1992 #define MICROMIPSOP_MASK_IMMP 0x1f
1993 #define MICROMIPSOP_SH_IMMP 0
1994 #define MICROMIPSOP_MASK_IMMQ 0x7fffff
1995 #define MICROMIPSOP_SH_IMMQ 0
1996 #define MICROMIPSOP_MASK_IMMU 0x1f
1997 #define MICROMIPSOP_SH_IMMU 0
1998 #define MICROMIPSOP_MASK_IMMW 0x3f
1999 #define MICROMIPSOP_SH_IMMW 1
2000 #define MICROMIPSOP_MASK_IMMX 0xf
2001 #define MICROMIPSOP_SH_IMMX 1
2002 #define MICROMIPSOP_MASK_IMMY 0x1ff
2003 #define MICROMIPSOP_SH_IMMY 1
2006 #define MICROMIPSOP_MASK_DSPACC 0x3
2007 #define MICROMIPSOP_SH_DSPACC 14
2008 #define MICROMIPSOP_MASK_DSPSFT 0x3f
2009 #define MICROMIPSOP_SH_DSPSFT 16
2010 #define MICROMIPSOP_MASK_SA3 0x7
2011 #define MICROMIPSOP_SH_SA3 13
2012 #define MICROMIPSOP_MASK_SA4 0xf
2013 #define MICROMIPSOP_SH_SA4 12
2014 #define MICROMIPSOP_MASK_IMM8 0xff
2015 #define MICROMIPSOP_SH_IMM8 13
2016 #define MICROMIPSOP_MASK_IMM10 0x3ff
2017 #define MICROMIPSOP_SH_IMM10 16
2018 #define MICROMIPSOP_MASK_WRDSP 0x3f
2019 #define MICROMIPSOP_SH_WRDSP 14
2020 #define MICROMIPSOP_MASK_BP 0x3
2021 #define MICROMIPSOP_SH_BP 14
2023 /* Placeholders for fields that only exist in the traditional 32-bit
2024 instruction encoding; see the comment above for details. */
2025 #define MICROMIPSOP_MASK_CODE20 0
2026 #define MICROMIPSOP_SH_CODE20 0
2027 #define MICROMIPSOP_MASK_PERFREG 0
2028 #define MICROMIPSOP_SH_PERFREG 0
2029 #define MICROMIPSOP_MASK_CODE19 0
2030 #define MICROMIPSOP_SH_CODE19 0
2031 #define MICROMIPSOP_MASK_ALN 0
2032 #define MICROMIPSOP_SH_ALN 0
2033 #define MICROMIPSOP_MASK_VECBYTE 0
2034 #define MICROMIPSOP_SH_VECBYTE 0
2035 #define MICROMIPSOP_MASK_VECALIGN 0
2036 #define MICROMIPSOP_SH_VECALIGN 0
2037 #define MICROMIPSOP_MASK_DSPACC_S 0
2038 #define MICROMIPSOP_SH_DSPACC_S 0
2039 #define MICROMIPSOP_MASK_DSPSFT_7 0
2040 #define MICROMIPSOP_SH_DSPSFT_7 0
2041 #define MICROMIPSOP_MASK_RDDSP 0
2042 #define MICROMIPSOP_SH_RDDSP 0
2043 #define MICROMIPSOP_MASK_MT_U 0
2044 #define MICROMIPSOP_SH_MT_U 0
2045 #define MICROMIPSOP_MASK_MT_H 0
2046 #define MICROMIPSOP_SH_MT_H 0
2047 #define MICROMIPSOP_MASK_MTACC_T 0
2048 #define MICROMIPSOP_SH_MTACC_T 0
2049 #define MICROMIPSOP_MASK_MTACC_D 0
2050 #define MICROMIPSOP_SH_MTACC_D 0
2051 #define MICROMIPSOP_MASK_BBITIND 0
2052 #define MICROMIPSOP_SH_BBITIND 0
2053 #define MICROMIPSOP_MASK_CINSPOS 0
2054 #define MICROMIPSOP_SH_CINSPOS 0
2055 #define MICROMIPSOP_MASK_CINSLM1 0
2056 #define MICROMIPSOP_SH_CINSLM1 0
2057 #define MICROMIPSOP_MASK_SEQI 0
2058 #define MICROMIPSOP_SH_SEQI 0
2059 #define MICROMIPSOP_SH_OFFSET_A 0
2060 #define MICROMIPSOP_MASK_OFFSET_A 0
2061 #define MICROMIPSOP_SH_OFFSET_B 0
2062 #define MICROMIPSOP_MASK_OFFSET_B 0
2063 #define MICROMIPSOP_SH_OFFSET_C 0
2064 #define MICROMIPSOP_MASK_OFFSET_C 0
2065 #define MICROMIPSOP_SH_RZ 0
2066 #define MICROMIPSOP_MASK_RZ 0
2067 #define MICROMIPSOP_SH_FZ 0
2068 #define MICROMIPSOP_MASK_FZ 0
2070 /* microMIPS Enhanced VA Scheme */
2071 #define MICROMIPSOP_SH_EVAOFFSET 0
2072 #define MICROMIPSOP_MASK_EVAOFFSET 0x1ff
2074 /* These are the characters which may appears in the args field of a microMIPS
2075 instruction. They appear in the order in which the fields appear
2076 when the instruction is used. Commas and parentheses in the args
2077 string are ignored when assembling, and written into the output
2080 The followings are for 16-bit microMIPS instructions.
2083 "mc" 3-bit MIPS registers 2-7, 16, 17 (MICROMIPSOP_*_MC) at bit 4
2084 The same register used as both source and target.
2085 "md" 3-bit MIPS registers 2-7, 16, 17 (MICROMIPSOP_*_MD) at bit 7
2086 "me" 3-bit MIPS registers 2-7, 16, 17 (MICROMIPSOP_*_ME) at bit 1
2087 The same register used as both source and target.
2088 "mf" 3-bit MIPS registers 2-7, 16, 17 (MICROMIPSOP_*_MF) at bit 3
2089 "mg" 3-bit MIPS registers 2-7, 16, 17 (MICROMIPSOP_*_MG) at bit 0
2090 "mh" 3-bit MIPS register pair (MICROMIPSOP_*_MH) at bit 7
2091 "mj" 5-bit MIPS registers (MICROMIPSOP_*_MJ) at bit 0
2092 "ml" 3-bit MIPS registers 2-7, 16, 17 (MICROMIPSOP_*_ML) at bit 4
2093 "mm" 3-bit MIPS registers 0, 2, 3, 16-20 (MICROMIPSOP_*_MM) at bit 1
2094 "mn" 3-bit MIPS registers 0, 2, 3, 16-20 (MICROMIPSOP_*_MN) at bit 4
2095 "mp" 5-bit MIPS registers (MICROMIPSOP_*_MP) at bit 5
2096 "mq" 3-bit MIPS registers 0, 2-7, 17 (MICROMIPSOP_*_MQ) at bit 7
2097 "mr" must be program counter
2099 "mt" must be the same as the previous register
2100 "mx" must be the same as the destination register
2104 "mA" 7-bit immediate (-64 .. 63) << 2 (MICROMIPSOP_*_IMMA)
2105 "mB" 3-bit immediate (-1, 1, 4, 8, 12, 16, 20, 24) (MICROMIPSOP_*_IMMB)
2106 "mC" 4-bit immediate (1, 2, 3, 4, 7, 8, 15, 16, 31, 32, 63, 64, 128, 255,
2107 32768, 65535) (MICROMIPSOP_*_IMMC)
2108 "mD" 10-bit branch address (-512 .. 511) << 1 (MICROMIPSOP_*_IMMD)
2109 "mE" 7-bit branch address (-64 .. 63) << 1 (MICROMIPSOP_*_IMME)
2110 "mF" 4-bit immediate (0 .. 15) (MICROMIPSOP_*_IMMF)
2111 "mG" 4-bit immediate (-1 .. 14) (MICROMIPSOP_*_IMMG)
2112 "mH" 4-bit immediate (0 .. 15) << 1 (MICROMIPSOP_*_IMMH)
2113 "mI" 7-bit immediate (-1 .. 126) (MICROMIPSOP_*_IMMI)
2114 "mJ" 4-bit immediate (0 .. 15) << 2 (MICROMIPSOP_*_IMMJ)
2115 "mL" 4-bit immediate (0 .. 15) (MICROMIPSOP_*_IMML)
2116 "mM" 3-bit immediate (1 .. 8) (MICROMIPSOP_*_IMMM)
2117 "mN" 2-bit immediate (0 .. 3) for register list (MICROMIPSOP_*_IMMN)
2118 "mO" 4-bit immediate (0 .. 15) (MICROMIPSOP_*_IMML)
2119 "mP" 5-bit immediate (0 .. 31) << 2 (MICROMIPSOP_*_IMMP)
2120 "mU" 5-bit immediate (0 .. 31) << 2 (MICROMIPSOP_*_IMMU)
2121 "mW" 6-bit immediate (0 .. 63) << 2 (MICROMIPSOP_*_IMMW)
2122 "mX" 4-bit immediate (-8 .. 7) (MICROMIPSOP_*_IMMX)
2123 "mY" 9-bit immediate (-258 .. -3, 2 .. 257) << 2 (MICROMIPSOP_*_IMMY)
2126 In most cases 32-bit microMIPS instructions use the same characters
2127 as MIPS (with ADDIUPC being a notable exception, but there are some
2130 "." 10-bit signed offset/number (MICROMIPSOP_*_OFFSET10)
2131 "1" 5-bit sync type (MICROMIPSOP_*_STYPE)
2132 "<" 5-bit shift amount (MICROMIPSOP_*_SHAMT)
2133 ">" shift amount between 32 and 63, stored after subtracting 32
2134 (MICROMIPSOP_*_SHAMT)
2135 "\" 3-bit position for ASET and ACLR (MICROMIPSOP_*_3BITPOS)
2136 "|" 4-bit trap code (MICROMIPSOP_*_TRAP)
2137 "~" 12-bit signed offset (MICROMIPSOP_*_OFFSET12)
2138 "a" 26-bit target address (MICROMIPSOP_*_TARGET)
2139 "+i" likewise, but flips bit 0
2140 "b" 5-bit base register (MICROMIPSOP_*_RS)
2141 "c" 10-bit higher breakpoint code (MICROMIPSOP_*_CODE)
2142 "d" 5-bit destination register specifier (MICROMIPSOP_*_RD)
2143 "h" 5-bit PREFX hint (MICROMIPSOP_*_PREFX)
2144 "i" 16-bit unsigned immediate (MICROMIPSOP_*_IMMEDIATE)
2145 "j" 16-bit signed immediate (MICROMIPSOP_*_DELTA)
2146 "k" 5-bit cache opcode in target register position (MICROMIPSOP_*_CACHE)
2147 "n" register list for 32-bit LWM/SWM instruction (MICROMIPSOP_*_RT)
2148 "o" 16-bit signed offset (MICROMIPSOP_*_DELTA)
2149 "p" 16-bit PC-relative branch target address (MICROMIPSOP_*_DELTA)
2150 "q" 10-bit lower breakpoint code (MICROMIPSOP_*_CODE2)
2151 "r" 5-bit same register used as both source and target (MICROMIPSOP_*_RS)
2152 "s" 5-bit source register specifier (MICROMIPSOP_*_RS)
2153 "t" 5-bit target register (MICROMIPSOP_*_RT)
2154 "u" 16-bit upper 16 bits of address (MICROMIPSOP_*_IMMEDIATE)
2155 "v" 5-bit same register used as both source and destination
2157 "w" 5-bit same register used as both target and destination
2159 "y" 5-bit source 3 register for ALNV.PS (MICROMIPSOP_*_RS3)
2160 "z" must be zero register
2161 "C" 23-bit coprocessor function code (MICROMIPSOP_*_COPZ)
2162 "K" 5-bit Hardware Register (RDHWR instruction) (MICROMIPSOP_*_RS)
2164 "+A" 5-bit INS/EXT/DINS/DEXT/DINSM/DEXTM position, which becomes
2165 LSB (MICROMIPSOP_*_EXTLSB).
2166 Enforces: 0 <= pos < 32.
2167 "+B" 5-bit INS/DINS size, which becomes MSB (MICROMIPSOP_*_INSMSB).
2168 Requires that "+A" or "+E" occur first to set position.
2169 Enforces: 0 < (pos+size) <= 32.
2170 "+C" 5-bit EXT/DEXT size, which becomes MSBD (MICROMIPSOP_*_EXTMSBD).
2171 Requires that "+A" or "+E" occur first to set position.
2172 Enforces: 0 < (pos+size) <= 32.
2173 (Also used by DEXT w/ different limits, but limits for
2174 that are checked by the M_DEXT macro.)
2175 "+E" 5-bit DINSU/DEXTU position, which becomes LSB-32 (MICROMIPSOP_*_EXTLSB).
2176 Enforces: 32 <= pos < 64.
2177 "+F" 5-bit DINSM/DINSU size, which becomes MSB-32 (MICROMIPSOP_*_INSMSB).
2178 Requires that "+A" or "+E" occur first to set position.
2179 Enforces: 32 < (pos+size) <= 64.
2180 "+G" 5-bit DEXTM size, which becomes MSBD-32 (MICROMIPSOP_*_EXTMSBD).
2181 Requires that "+A" or "+E" occur first to set position.
2182 Enforces: 32 < (pos+size) <= 64.
2183 "+H" 5-bit DEXTU size, which becomes MSBD (MICROMIPSOP_*_EXTMSBD).
2184 Requires that "+A" or "+E" occur first to set position.
2185 Enforces: 32 < (pos+size) <= 64.
2186 "+J" 10-bit SYSCALL/WAIT/SDBBP/HYPCALL function code
2187 (MICROMIPSOP_*_CODE10)
2189 PC-relative addition (ADDIUPC) instruction:
2190 "mQ" 23-bit offset (-4194304 .. 4194303) << 2 (MICROMIPSOP_*_IMMQ)
2191 "mb" 3-bit MIPS registers 2-7, 16, 17 (MICROMIPSOP_*_MB) at bit 23
2193 Floating point instructions:
2194 "D" 5-bit destination register (MICROMIPSOP_*_FD)
2195 "M" 3-bit compare condition code (MICROMIPSOP_*_CCC)
2196 "N" 3-bit branch condition code (MICROMIPSOP_*_BCC)
2197 "R" 5-bit fr source 3 register (MICROMIPSOP_*_FR)
2198 "S" 5-bit fs source 1 register (MICROMIPSOP_*_FS)
2199 "T" 5-bit ft source 2 register (MICROMIPSOP_*_FT)
2200 "V" 5-bit same register used as floating source and destination or target
2203 Coprocessor instructions:
2204 "E" 5-bit target register (MICROMIPSOP_*_RT)
2205 "G" 5-bit source register (MICROMIPSOP_*_RS)
2206 "H" 3-bit sel field for (D)MTC* and (D)MFC* (MICROMIPSOP_*_SEL)
2209 "A" general 32 bit expression
2210 "I" 32-bit immediate (value placed in imm_expr).
2211 "F" 64-bit floating point constant in .rdata
2212 "L" 64-bit floating point constant in .lit8
2213 "f" 32-bit floating point constant
2214 "l" 32-bit floating point constant in .lit4
2217 "2" 2-bit unsigned immediate for byte align (MICROMIPSOP_*_BP)
2218 "3" 3-bit unsigned immediate (MICROMIPSOP_*_SA3)
2219 "4" 4-bit unsigned immediate (MICROMIPSOP_*_SA4)
2220 "5" 8-bit unsigned immediate (MICROMIPSOP_*_IMM8)
2221 "6" 5-bit unsigned immediate (MICROMIPSOP_*_RS)
2222 "7" 2-bit DSP accumulator register (MICROMIPSOP_*_DSPACC)
2223 "8" 6-bit unsigned immediate (MICROMIPSOP_*_WRDSP)
2224 "0" 6-bit signed immediate (MICROMIPSOP_*_DSPSFT)
2225 "@" 10-bit signed immediate (MICROMIPSOP_*_IMM10)
2226 "^" 5-bit unsigned immediate (MICROMIPSOP_*_RD)
2228 microMIPS Enhanced VA Scheme:
2229 "+j" 9-bit signed offset in bit 0 (OP_*_EVAOFFSET)
2232 "+d" 5-bit MSA register (FD)
2233 "+e" 5-bit MSA register (FS)
2234 "+h" 5-bit MSA register (FT)
2235 "+k" 5-bit GPR at bit 6
2236 "+l" 5-bit MSA control register at bit 6
2237 "+n" 5-bit MSA control register at bit 11
2238 "+o" 4-bit vector element index at bit 16
2239 "+u" 3-bit vector element index at bit 16
2240 "+v" 2-bit vector element index at bit 16
2241 "+w" 1-bit vector element index at bit 16
2242 "+x" 5-bit shift amount at bit 16
2243 "+T" (-512 .. 511) << 0 at bit 16
2244 "+U" (-512 .. 511) << 1 at bit 16
2245 "+V" (-512 .. 511) << 2 at bit 16
2246 "+W" (-512 .. 511) << 3 at bit 16
2247 "+~" 2 bit LSA/DLSA shift amount from 1 to 4 at bit 6
2248 "+!" 3 bit unsigned bit position at bit 16
2249 "+@" 4 bit unsigned bit position at bit 16
2250 "+#" 6 bit unsigned bit position at bit 16
2251 "+$" 5 bit unsigned immediate at bit 16
2252 "+%" 5 bit signed immediate at bit 16
2253 "+^" 10 bit signed immediate at bit 11
2254 "+&" 0 vector element index
2255 "+*" 5-bit register vector element index at bit 16
2256 "+|" 8-bit mask at bit 16
2259 "()" parens surrounding optional value
2260 "," separates operands
2261 "+" start of extension sequence
2262 "m" start of microMIPS extension sequence
2264 Characters used so far, for quick reference when adding more:
2267 "ABCDEFGHI KLMN RST V "
2268 "abcd f hijklmnopqrstuvw yz"
2270 Extension character sequences used so far ("+" followed by the
2271 following), for quick reference when adding more:
2277 Extension character sequences used so far ("m" followed by the
2278 following), for quick reference when adding more:
2281 " BCDEFGHIJ LMNOPQ U WXYZ"
2282 " bcdefghij lmn pq st xyz"
2284 Extension character sequences used so far ("-" followed by the
2285 following), for quick reference when adding more:
2291 extern const struct mips_operand
*decode_micromips_operand (const char *);
2292 extern const struct mips_opcode micromips_opcodes
[];
2293 extern const int bfd_micromips_num_opcodes
;
2295 /* A NOP insn impemented as "or at,at,zero".
2296 Used to implement -mfix-loongson2f. */
2297 #define LOONGSON2F_NOP_INSN 0x00200825
2303 #endif /* _MIPS_H_ */