[RFC PATCH 1/3] MIPS: Add Allegrex VFPU assembler and disassembler support and PSP linking
Yaroslav Solodovnyk
dublikunt@gmail.com
Fri Nov 6 07:09:58 GMT 2026
Port the PSP/VFPU implementation from pspdev/binutils-gdb commit a8b53fe2b5825fa86337623c743d21a19aeb0daf to Binutils 2.47. Retain upstream Allegrex ELF machine flags and Loongson GS464 support.
Adapt the assembler operand initialization and bool API. Repair lvi/lvhi parsing, macro IDs, expansion and row/column lane offsets. Parse half-float immediates directly as IEEE binary16, diagnose overflow and malformed operands, and correct half-subnormal disassembly.
Imported copyright and license notices are preserved. The corresponding config.sub canonicalization change is supplied separately for config-patches@gnu.org.
---
gas/config/tc-mips.c | 1373 ++++++++++++++++++++++-
gas/configure | 3 +
gas/configure.ac | 3 +
include/elf/common.h | 1 +
include/opcode/mips.h | 138 ++-
include/opcode/vfpu.h | 178 +++
ld/Makefile.am | 1 +
ld/Makefile.in | 2 +
ld/configure.tgt | 4 +
ld/emulparams/elf_mipsallegrexel_psp.sh | 22 +
ld/scripttempl/elf_psp.sc | 778 +++++++++++++
opcodes/mips-dis.c | 380 +++++++
opcodes/mips-formats.h | 36 +
opcodes/mips-opc.c | 405 ++++++-
14 files changed, 3306 insertions(+), 18 deletions(-)
create mode 100644 include/opcode/vfpu.h
create mode 100644 ld/emulparams/elf_mipsallegrexel_psp.sh
create mode 100644 ld/scripttempl/elf_psp.sc
diff --git a/gas/config/tc-mips.c b/gas/config/tc-mips.c
index 4fe12161..9dccaa45 100644
--- a/gas/config/tc-mips.c
+++ b/gas/config/tc-mips.c
@@ -105,7 +105,7 @@ static char *mips_flags_frag;
#define FCSR 31
-#define ILLEGAL_REG (32)
+#define ILLEGAL_REG ~0U
#define AT mips_opts.at
@@ -541,6 +541,9 @@ static int mips_32bitmode = 0;
#define CPU_IS_OCTEON(CPU) ((CPU) == CPU_OCTEON || (CPU) == CPU_OCTEONP \
|| (CPU) == CPU_OCTEON2 || (CPU) == CPU_OCTEON3)
+/* True if the given CPU belongs to the Allegrex family. */
+#define CPU_IS_ALLEGREX(CPU) ((CPU) == CPU_ALLEGREX)
+
/* True if CPU has seq/sne and seqi/snei instructions. */
#define CPU_HAS_SEQ(CPU) (CPU_IS_OCTEON (CPU))
@@ -719,7 +722,7 @@ const char EXP_CHARS[] = "eE";
/* Chars that mean this number is a floating point constant.
As in 0f12.456
or 0d1.2345e12. */
-const char FLT_CHARS[] = "rRsSfFdDxXpP";
+const char FLT_CHARS[] = "rRsSfFdDxXpPhH";
/* Also be aware that MAXIMUM_NUMBER_OF_CHARS_FOR_FLOAT may have to be
changed in read.c . Ideally it shouldn't have to know about it at all,
@@ -830,7 +833,7 @@ static struct mips_cl_insn history[1 + MAX_NOPS + MAX_LLSC_RANGE];
#define MAX_LABELS_SAME 10
/* Arrays of operands for each instruction. */
-#define MAX_OPERANDS 6
+#define MAX_OPERANDS 16
struct mips_operand_array
{
const struct mips_operand *operand[MAX_OPERANDS];
@@ -2062,6 +2065,8 @@ static expressionS imm_expr;
operands in macros. */
static expressionS offset_expr;
+/* Raw IEEE lanes for the lvi/lvhi macros. */
+static unsigned int vfpu_immediates[4];
static bfd_reloc_code_real_type offset_reloc[3]
= {BFD_RELOC_UNUSED, BFD_RELOC_UNUSED, BFD_RELOC_UNUSED};
@@ -2706,6 +2711,7 @@ struct regname {
#define RTYPE_R5900_R 0x0200000
#define RTYPE_R5900_ACC 0x0400000
#define RTYPE_MSA 0x0800000
+#define RTYPE_VFPU_CTR 0x1000000
#define RWARN 0x8000000
#define GENERIC_REGISTER_NUMBERS \
@@ -3115,6 +3121,41 @@ struct regname {
{"$ac2", RTYPE_ACC | 2}, \
{"$ac3", RTYPE_ACC | 3}
+/* Register shapes for VFPU registers. */
+enum mips_vfpu_reg_shape {
+ /* A vector register, number of elements from 1 to 4. */
+ VFPU_REG_SHAPE_VECTOR_1,
+ VFPU_REG_SHAPE_VECTOR_2,
+ VFPU_REG_SHAPE_VECTOR_3,
+ VFPU_REG_SHAPE_VECTOR_4,
+ VFPU_REG_SHAPE_VECTOR_UNKNOWN,
+
+ /* A matrix register, number of elements from 2x2 to 4x4. */
+ VFPU_REG_SHAPE_MATRIX_2x2,
+ VFPU_REG_SHAPE_MATRIX_3x3,
+ VFPU_REG_SHAPE_MATRIX_4x4,
+ VFPU_REG_SHAPE_MATRIX_UNKNOWN
+};
+
+#define VFPU_REGISTER_NAMES \
+ /* VFPU control registers */ \
+ {"$128", RTYPE_VFPU_CTR | 128}, \
+ {"$129", RTYPE_VFPU_CTR | 129}, \
+ {"$130", RTYPE_VFPU_CTR | 130}, \
+ {"$131", RTYPE_VFPU_CTR | 131}, \
+ {"$132", RTYPE_VFPU_CTR | 132}, \
+ {"$133", RTYPE_VFPU_CTR | 133}, \
+ {"$134", RTYPE_VFPU_CTR | 134}, \
+ {"$135", RTYPE_VFPU_CTR | 135}, \
+ {"$136", RTYPE_VFPU_CTR | 136}, \
+ {"$137", RTYPE_VFPU_CTR | 137}, \
+ {"$138", RTYPE_VFPU_CTR | 138}, \
+ {"$139", RTYPE_VFPU_CTR | 139}, \
+ {"$140", RTYPE_VFPU_CTR | 140}, \
+ {"$141", RTYPE_VFPU_CTR | 141}, \
+ {"$142", RTYPE_VFPU_CTR | 142}, \
+ {"$143", RTYPE_VFPU_CTR | 143}
+
static const struct regname reg_names[] = {
GENERIC_REGISTER_NUMBERS,
FPU_REGISTER_NAMES,
@@ -3133,6 +3174,7 @@ static const struct regname reg_names[] = {
R5900_Q_NAMES,
R5900_R_NAMES,
R5900_ACC_NAMES,
+ VFPU_REGISTER_NAMES,
MIPS_DSP_ACCUMULATOR_NAMES,
{0, 0}
};
@@ -3266,6 +3308,229 @@ mips_parse_register (char **sptr, unsigned int *symval_ptr,
return true;
}
+/* Try to parse a VFPU register and fill its shape */
+static bool
+mips_vfpu_parse_register (char **sptr, unsigned int *regval, enum mips_vfpu_reg_shape *regshape)
+{
+ char *s = *sptr;
+ char regtype = TOLOWER(*s++);
+ unsigned suffix = 0;
+ unsigned int m, c, r;
+
+ static const enum mips_vfpu_reg_shape vecsz[] = {
+ VFPU_REG_SHAPE_VECTOR_UNKNOWN,
+ VFPU_REG_SHAPE_VECTOR_1, VFPU_REG_SHAPE_VECTOR_2,
+ VFPU_REG_SHAPE_VECTOR_3, VFPU_REG_SHAPE_VECTOR_4
+ };
+ static const enum mips_vfpu_reg_shape mtxsz[] = {
+ VFPU_REG_SHAPE_MATRIX_UNKNOWN, VFPU_REG_SHAPE_MATRIX_UNKNOWN,
+ VFPU_REG_SHAPE_MATRIX_2x2,
+ VFPU_REG_SHAPE_MATRIX_3x3,
+ VFPU_REG_SHAPE_MATRIX_4x4
+ };
+
+ /* Check digit ranges */
+ if (s[0] < '0' || s[0] > '7' ||
+ s[1] < '0' || s[1] > '3' ||
+ s[2] < '0' || s[2] > '3')
+ return false;
+
+ m = *s++ - '0';
+ c = *s++ - '0';
+ r = *s++ - '0';
+
+ /* Attempt to parse suffix (.s/.p/.t/.q) */
+ if (*s == '.') {
+ s++;
+ switch (*s++) {
+ case 's': suffix = 1; break;
+ case 'p': suffix = 2; break;
+ case 't': suffix = 3; break;
+ case 'q': suffix = 4; break;
+ default:
+ return false;
+ };
+ }
+
+ /* S/.s prefix/suffix matching */
+ if ((regtype == 's' && suffix > 1) ||
+ (regtype != 's' && suffix == 1))
+ return false;
+
+ switch (regtype) {
+ case 's':
+ /* Single register type */
+ *regval = c + m * 4 + r * 32;
+ *regshape = VFPU_REG_SHAPE_VECTOR_1;
+ break;
+
+ case 'c':
+ /* Vector register (column) type */
+ switch (r) {
+ case 0:
+ *regval = c + m * 4;
+ *regshape = vecsz[suffix];
+ break;
+ case 1:
+ if (suffix && suffix != 3)
+ return false;
+ *regval = c + m * 4 + 64;
+ *regshape = VFPU_REG_SHAPE_VECTOR_3;
+ break;
+ case 2:
+ if (suffix && suffix != 2)
+ return false;
+ *regval = c + m * 4 + 64;
+ *regshape = VFPU_REG_SHAPE_VECTOR_2;
+ break;
+ default:
+ return false;
+ };
+ break;
+
+ case 'r':
+ /* Vector register (row) type */
+ switch (c) {
+ case 0:
+ *regval = r + m * 4 + 32;
+ *regshape = vecsz[suffix];
+ break;
+ case 1:
+ if (suffix && suffix != 3)
+ return false;
+ *regval = r + m * 4 + 96;
+ *regshape = VFPU_REG_SHAPE_VECTOR_3;
+ break;
+ case 2:
+ if (suffix && suffix != 2)
+ return false;
+ *regval = r + m * 4 + 96;
+ *regshape = VFPU_REG_SHAPE_VECTOR_2;
+ break;
+ default:
+ return false;
+ };
+ break;
+
+ case 'm':
+ /* Matrix register type */
+ switch (c + r * 4) {
+ case 0: /* MX00 */
+ *regval = m * 4;
+ *regshape = mtxsz[suffix];
+ break;
+ case 1: /* MX10 */
+ if (suffix && suffix != 3)
+ return false;
+ *regval = (m * 4) | 1;
+ *regshape = VFPU_REG_SHAPE_MATRIX_3x3;
+ break;
+ case 2: /* MX20 */
+ if (suffix && suffix != 2)
+ return false;
+ *regval = (m * 4) | 2;
+ *regshape = VFPU_REG_SHAPE_MATRIX_2x2;
+ break;
+
+ case 4: /* MX01 */
+ case 5: /* MX11 */
+ if (suffix && suffix != 3)
+ return false;
+ *regval = (m * 4 + c) | 64;
+ *regshape = VFPU_REG_SHAPE_MATRIX_3x3;
+ break;
+
+ case 8: /* MX02 */
+ case 10: /* MX22 */
+ if (suffix && suffix != 2)
+ return false;
+ *regval = (m * 4 + c) | 64;
+ *regshape = VFPU_REG_SHAPE_MATRIX_2x2;
+ break;
+
+ default:
+ return false;
+ };
+ break;
+
+ case 'e':
+ /* Matrix register (transposed) type */
+ switch (c + r * 4) {
+ case 0: /* EX00 */
+ *regval = (m * 4) | 32;
+ *regshape = mtxsz[suffix];
+ break;
+ case 1: /* EX10 */
+ if (suffix && suffix != 3)
+ return false;
+ *regval = (m * 4) | 96;
+ *regshape = VFPU_REG_SHAPE_MATRIX_3x3;
+ break;
+ case 2: /* EX20 */
+ if (suffix && suffix != 2)
+ return false;
+ *regval = (m * 4) | 96;
+ *regshape = VFPU_REG_SHAPE_MATRIX_2x2;
+ break;
+
+ case 4: /* EX01 */
+ case 5: /* EX11 */
+ if (suffix && suffix != 3)
+ return false;
+ *regval = (m * 4 + c * 64) | 32 | 1;
+ *regshape = VFPU_REG_SHAPE_MATRIX_3x3;
+ break;
+
+ case 8: /* EX02 */
+ case 10: /* EX22 */
+ if (suffix && suffix != 2)
+ return false;
+ *regval = (m * 4 + c * 32) | 32 | 2;
+ *regshape = VFPU_REG_SHAPE_MATRIX_2x2;
+ break;
+
+ default:
+ return false;
+ };
+ break;
+
+ default:
+ return false;
+ };
+
+ *sptr = s;
+ return true;
+}
+
+/* Try to parse a VFPU register and fill its attributes */
+static bool
+mips_vfpu_parse_condcode (char **sptr, unsigned int *regval)
+{
+ char *s = *sptr;
+ char code[3];
+
+ static const char * const vfpu_cond_names[16] = {
+ "FL", "EQ", "LT", "LE", "TR", "NE", "GE", "GT",
+ "EZ", "EN", "EI", "ES", "NZ", "NN", "NI", "NS"
+ };
+
+ if (IS_SPACE_OR_NUL(s[0]) || IS_SPACE_OR_NUL(s[1]))
+ return false;
+
+ code[0] = TOUPPER(s[0]);
+ code[1] = TOUPPER(s[1]);
+ code[2] = 0;
+
+ for (unsigned i = 0; i < 16; i++) {
+ if (!strcmp(code, vfpu_cond_names[i])) {
+ *regval = RTYPE_VFPU_CTR | i ;
+ *sptr = *sptr + 2;
+ return true;
+ }
+ }
+ return false;
+}
+
/* Check if SPTR points at a valid register specifier according to TYPES.
If so, then return 1, advance S to consume the specifier and store
the register's number in REGNOP, otherwise return 0. */
@@ -3330,6 +3595,12 @@ enum mips_operand_token_type {
/* A continuous range of registers, e.g. $s0-$s4. */
OT_REG_RANGE,
+ /* A VFPU register, including register shape information. */
+ OT_REG_VFPU,
+
+ /* A VFPU immediate, with different kinds of meanings depending on the inst. */
+ OT_IMM_VFPU,
+
/* A (possibly relocated) expression. */
OT_INTEGER,
@@ -3369,6 +3640,15 @@ struct mips_operand_token
unsigned int regno2;
} reg_range;
+ /* The register symbol value for an OT_REG_VFPU and its shape. */
+ struct {
+ unsigned int regno;
+ enum mips_vfpu_reg_shape shape;
+ } reg_vfpu;
+
+ /* An VFPU immediate (up to 24 bits). */
+ unsigned int vfpu_immediate;
+
/* The value of an OT_INTEGER. The value is represented as an
expression and the relocation operators that were applied to
that expression. The reloc entries are BFD_RELOC_UNUSED if no
@@ -3403,6 +3683,175 @@ mips_add_token (struct mips_operand_token *token,
obstack_grow (&mips_operand_tokens, token, sizeof (*token));
}
+#define PFX_DST 0x80 // Mask or saturation
+#define PFX_CST 0x40
+#define PFX_SWZ 0x20
+#define PFX_NEG 0x10
+#define PFX_ABS 0x08
+
+#define PFX_X 0
+#define PFX_Y 1
+#define PFX_Z 2
+#define PFX_W 3
+
+#define PFX_01 1
+#define PFX_11 3
+#define PFX_MSK 4
+
+#define PFX_C0 0
+#define PFX_C1 1
+#define PFX_C2 2
+#define PFX_C12 3
+#define PFX_C3 4
+#define PFX_C13 5
+#define PFX_C14 6
+#define PFX_C16 7
+
+/* Parse one VFPU prefix channel, which can be either source or destination.
+ Returns NULL if the parsed data cannot be a valid prefix. */
+static char *
+mips_parse_vfpu_prefix (char *s, unsigned int *chan)
+{
+ static const struct
+ {
+ const char *token;
+ unsigned char value;
+ } fixed_tokens[] = {
+ { "m", PFX_DST | PFX_MSK }, { "M", PFX_DST | PFX_MSK },
+ { "0:1", PFX_DST | PFX_01 }, { "[0:1]", PFX_DST | PFX_01 },
+ { "-1:1", PFX_DST | PFX_11 }, { "[-1:1]", PFX_DST | PFX_11 },
+ { "1/2", PFX_CST | PFX_C12 }, { "-1/2", PFX_NEG | PFX_CST | PFX_C12 },
+ { "1/3", PFX_CST | PFX_C13 }, { "-1/3", PFX_NEG | PFX_CST | PFX_C13 },
+ { "1/4", PFX_CST | PFX_C14 }, { "-1/4", PFX_NEG | PFX_CST | PFX_C14 },
+ { "1/6", PFX_CST | PFX_C16 }, { "-1/6", PFX_NEG | PFX_CST | PFX_C16 },
+ { "0", PFX_CST | PFX_C0 }, { "-0", PFX_NEG | PFX_CST | PFX_C0 },
+ { "1", PFX_CST | PFX_C1 }, { "-1", PFX_NEG | PFX_CST | PFX_C1 },
+ { "2", PFX_CST | PFX_C2 }, { "-2", PFX_NEG | PFX_CST | PFX_C2 },
+ { "3", PFX_CST | PFX_C3 }, { "-3", PFX_NEG | PFX_CST | PFX_C3 },
+ };
+
+ SKIP_SPACE_TABS (s);
+ *chan = 0;
+
+ if (*s == ',' || *s == ']' || *s == 0)
+ return s;
+
+ for (unsigned i = 0; i < ARRAY_SIZE(fixed_tokens); i++) {
+ unsigned tokenl = strlen(fixed_tokens[i].token);
+ if (!strncmp(s, fixed_tokens[i].token, tokenl)) {
+ *chan = fixed_tokens[i].value;
+ return &s[tokenl];
+ }
+ }
+
+ // Parse a swizzle channel: -?[xyzw] or -?|[xyzw]|
+ if (*s == '-') {
+ *chan |= PFX_NEG;
+ s++;
+ SKIP_SPACE_TABS (s);
+ }
+
+ if (*s == '|') {
+ *chan |= PFX_ABS;
+ s++;
+ SKIP_SPACE_TABS (s);
+ }
+
+ switch (*s++) {
+ case 'x': case 'X': *chan |= PFX_SWZ | PFX_X; break;
+ case 'y': case 'Y': *chan |= PFX_SWZ | PFX_Y; break;
+ case 'z': case 'Z': *chan |= PFX_SWZ | PFX_Z; break;
+ case 'w': case 'W': *chan |= PFX_SWZ | PFX_W; break;
+ default:
+ set_insn_error (0, _("invalid VFPU prefix"));
+ return NULL;
+ };
+ SKIP_SPACE_TABS (s);
+
+ if (*chan & PFX_ABS) {
+ if (*s != '|')
+ set_insn_error (0, _("unmatched '|' in VFPU prefix"));
+ s++;
+ }
+ return s;
+}
+
+/* Parse vrot rotation code array. This encodes the argument into some
+ temporary expression to be encoded later. It accepts expressions that
+ are not encodeable but look plausibly so. */
+static char *
+mips_parse_vfpu_vrotarg (char *s, unsigned int *immval)
+{
+ unsigned p = 0;
+ int chs[4] = {-1, -1, -1, -1};
+ int neg = -1;
+ while (*s != 0) {
+ SKIP_SPACE_TABS (s);
+
+ switch (*s++) {
+ default:
+ return NULL;
+
+ case ',':
+ if (p >= 3 || chs[p] < 0)
+ return NULL; // Empty argument or too many args
+ p++;
+ break;
+
+ case ']':
+ if (p < 1 || chs[p] < 0)
+ return NULL; // Missing last operand
+
+ // Calculate the final imm value
+ *immval = 0;
+ for (unsigned j = 0; j <= p; j++)
+ *immval = ((*immval) << 2) | chs[j];
+ if (neg == 1)
+ *immval |= 0x800;
+ *immval |= (p-1) << 8;
+
+ return s;
+
+ case '0':
+ if (chs[p] >= 0)
+ return NULL;
+ chs[p] = 0;
+ break;
+
+ case 'c':
+ if (chs[p] >= 0)
+ return NULL;
+ chs[p] = 3;
+ break;
+
+ case 's':
+ // Cannot mix `s` and `-s`
+ if (neg == 1)
+ return NULL;
+ if (chs[p] >= 0)
+ return NULL;
+ chs[p] = 2;
+ neg = 0;
+ break;
+
+ case '-':
+ // Only sine can be negated
+ if (TOLOWER(*s) != 's')
+ return NULL;
+ // Cannot mix `s` and `-s`
+ if (neg == 0)
+ return NULL;
+ if (chs[p] >= 0)
+ return NULL;
+ chs[p] = 2;
+ neg = 1;
+ s++;
+ break;
+ };
+ }
+ return NULL;
+}
+
/* Check whether S is '(' followed by a register name. Add OT_CHAR
and OT_REG tokens for them if so, and return a pointer to the first
unconsumed character. Return null otherwise. */
@@ -3470,7 +3919,7 @@ mips_parse_base_start (char *s)
mips_parse_arguments. */
static char *
-mips_parse_argument_token (char *s, char float_format)
+mips_parse_argument_token (char *s, char float_format, const struct mips_opcode *mo)
{
char *end, *save_in;
const char *err;
@@ -3483,8 +3932,30 @@ mips_parse_argument_token (char *s, char float_format)
if (end)
return end;
+ /* Attempt to parse a VFPU prefix argument */
+ if (!strncmp(mo->name, "vpfx", 4)) {
+ for (unsigned i = 0; i < 4; i++) {
+ s = mips_parse_vfpu_prefix (s, &token.u.vfpu_immediate);
+ if (!s)
+ break;
+ mips_add_token (&token, OT_IMM_VFPU);
+
+ // Check that we have a separator or EOF
+ SKIP_SPACE_TABS (s);
+
+ if (*s == ',') {
+ token.u.ch = ',';
+ mips_add_token (&token, OT_CHAR);
+ s++;
+ }
+ }
+ return s;
+ }
+
/* Handle other characters that end up as OT_CHARs. */
- if (*s == ')' || *s == ',')
+ if (*s == ')' || *s == ','
+ || (float_format && startswith (mo->name, "lv")
+ && (*s == '[' || *s == ']')))
{
token.u.ch = *s;
mips_add_token (&token, OT_CHAR);
@@ -3492,6 +3963,54 @@ mips_parse_argument_token (char *s, char float_format)
return s;
}
+ /* Handle VFPU condition codes. */
+ if ((mo->pinfo2 & INSN2_VFPU_CC) && mips_vfpu_parse_condcode (&s, ®no1))
+ {
+ /* This is essentially treated as a register. */
+ token.u.regno = regno1;
+ mips_add_token (&token, OT_REG);
+ return s;
+ }
+
+ /* Handle VFPU registers (and potential prefixes). */
+ if ((mo->pinfo2 & INSN2_VFPU_REG) &&
+ mips_vfpu_parse_register (&s, &token.u.reg_vfpu.regno, &token.u.reg_vfpu.shape))
+ {
+ /* Add the register itself. */
+ mips_add_token (&token, OT_REG_VFPU);
+
+ if (*s == '[')
+ {
+ /* We just parsed the VFPU reg, now parse the prefix */
+ for (unsigned i = 0; i < 4; i++) {
+ s = mips_parse_vfpu_prefix (s + 1, &token.u.vfpu_immediate);
+ if (!s)
+ return NULL;
+
+ mips_add_token (&token, OT_IMM_VFPU);
+
+ // Check that we have a separator or EOF
+ SKIP_SPACE_TABS (s);
+
+ if (*s == ',') {
+ if (i == 3) {
+ set_insn_error (0, _("invalid VFPU prefix, too many elements"));
+ return NULL;
+ }
+ }
+ else if (*s == ']') {
+ return s + 1;
+ }
+ else {
+ set_insn_error (0, _("invalid VFPU prefix, expecting ',' or ']'"));
+ return NULL;
+ }
+ }
+ return s;
+ }
+ return s;
+ }
+
/* Handle tokens that start with a register. */
if (mips_parse_register (&s, ®no1, &channels))
{
@@ -3560,6 +4079,15 @@ mips_parse_argument_token (char *s, char float_format)
return s;
}
+ /* Explicit hexadecimal lvi operands represent raw binary32 bits.
+ Decimal operands retain the floating-point syntax of li.s. */
+ end = s;
+ if (*end == '+' || *end == '-')
+ ++end;
+ if (startswith (mo->name, "lvi.")
+ && end[0] == '0' && (end[1] == 'x' || end[1] == 'X'))
+ goto integer_expression;
+
if (float_format)
{
/* First try to treat expressions as floats. */
@@ -3581,7 +4109,18 @@ mips_parse_argument_token (char *s, char float_format)
}
}
+ /* Attempt to parse vrot constants */
+ if (!strncmp(mo->name, "vrot", 4) && *s == '[') {
+ char *endp = mips_parse_vfpu_vrotarg(s+1, ®no1);
+ if (endp) {
+ token.u.vfpu_immediate = regno1;
+ mips_add_token (&token, OT_IMM_VFPU);
+ return endp;
+ }
+ }
+
/* Treat everything else as an integer expression. */
+integer_expression:
token.u.integer.relocs[0] = BFD_RELOC_UNUSED;
token.u.integer.relocs[1] = BFD_RELOC_UNUSED;
token.u.integer.relocs[2] = BFD_RELOC_UNUSED;
@@ -3600,14 +4139,14 @@ mips_parse_argument_token (char *s, char float_format)
must obstack_free the list after use. */
static struct mips_operand_token *
-mips_parse_arguments (char *s, char float_format)
+mips_parse_arguments (char *s, char float_format, const struct mips_opcode *mo)
{
struct mips_operand_token token;
SKIP_SPACE_TABS (s);
while (*s)
{
- s = mips_parse_argument_token (s, float_format);
+ s = mips_parse_argument_token (s, float_format, mo);
if (!s)
{
obstack_free (&mips_operand_tokens,
@@ -3795,6 +4334,11 @@ validate_mips_insn (const struct mips_opcode *opcode,
s++;
break;
+ case '[':
+ case ']':
+ if (opcode->pinfo == INSN_MACRO)
+ break;
+ /* Fall through. */
default:
if (!decode_operand)
operand = decode_mips16_operand (*s, mips_opcode_32bit_p (opcode));
@@ -3825,10 +4369,19 @@ validate_mips_insn (const struct mips_opcode *opcode,
operand field that cannot be fully described with LSB/SIZE. */
if (operand->type == OP_SAVE_RESTORE_LIST && operand->lsb == 6)
used_bits &= ~0x6000;
+ if (operand->type == OP_VFPU_OPERAND) {
+ const struct mips_vfpu_operand *opvfpu = (struct mips_vfpu_operand*)operand;
+ used_bits |= ((1 << opvfpu->size2) - 1) << opvfpu->lsb2;
+ }
}
/* Skip prefix characters. */
if (decode_operand && (*s == '+' || *s == 'm' || *s == '-'))
++s;
+ if (*s == '?') {
+ while (s[1] != 0 && s[1] != '?' && s[1] != ',' &&
+ s[1] != '(' && s[1] != '[' && s[1] != ')' && s[1] != ']')
+ s++;
+ }
opno += 1;
break;
}
@@ -4405,6 +4958,10 @@ file_mips_check_options (void)
/* End of GCC-shared inference code. */
+ /* R5900 and ALLEGREX only support single hardware mode */
+ if (CPU_IS_ALLEGREX (mips_opts.arch) || mips_opts.arch == CPU_R5900)
+ file_mips_opts.single_float = true;
+
/* This flag is set when we have a 64-bit capable CPU but use only
32-bit wide registers. Note that EABI does not use it. */
if (ISA_HAS_64BIT_REGS (file_mips_opts.isa)
@@ -4964,6 +5521,7 @@ operand_reg_mask (const struct mips_cl_insn *insn,
case OP_VU0_SUFFIX:
case OP_VU0_MATCH_SUFFIX:
case OP_IMM_INDEX:
+ case OP_VFPU_OPERAND:
abort ();
case OP_REG28:
@@ -5402,6 +5960,9 @@ convert_reg_type (const struct mips_opcode *opcode,
case OP_REG_MSA_CTRL:
return RTYPE_NUM;
+
+ case OP_REG_VFPU_CTR:
+ return RTYPE_VFPU_CTR;
}
abort ();
}
@@ -5417,6 +5978,7 @@ check_regno (struct mips_arg_info *arg,
if (type == OP_REG_FP
&& (regno & 1) != 0
+ && ! CPU_IS_ALLEGREX (mips_opts.arch)
&& !mips_oddfpreg_ok (arg->insn->insn_mo, arg->opnum))
{
/* This was a warning prior to introducing O32 FPXX and FP64 support
@@ -5507,6 +6069,25 @@ match_reg_range (struct mips_arg_info *arg, enum mips_reg_operand_type type,
return false;
}
+/* Try to interpret the next token in ARG as a VFPU register.
+ Consume the token and return true on success, storing the register
+ number in *REGNO and shape in *REGSHAPE. Return false on failure. */
+
+static bool
+match_vfpu_reg (struct mips_arg_info *arg,
+ unsigned int *regno, enum mips_vfpu_reg_shape *regshape)
+{
+ if (arg->token->type == OT_REG_VFPU
+ && arg->token->u.reg_vfpu.regno < 128)
+ {
+ *regno = arg->token->u.reg_vfpu.regno;
+ *regshape = arg->token->u.reg_vfpu.shape;
+ ++arg->token;
+ return true;
+ }
+ return false;
+}
+
/* OP_INT matcher. */
static bool
@@ -6511,6 +7092,500 @@ match_float_constant (struct mips_arg_info *arg, expressionS *imm,
return true;
}
+/* Parses the source prefix operand, into a prefix opcode */
+static unsigned int parse_vfpu_spfx_channel(unsigned chval, unsigned chn)
+{
+ unsigned int uval = 0;
+
+ /* If no value, it means empty arg, so use the natural swizzle */
+ if (!chval)
+ chval = PFX_SWZ | chn;
+
+ if (chval & PFX_NEG)
+ uval |= (1 << (16 + chn));
+
+ if (chval & PFX_CST) {
+ uval |= (0x1000 << chn);
+ if (chval & 0x4)
+ uval |= (0x100 << chn);
+ } else {
+ /* Variable, fill abs field too */
+ if (chval & PFX_ABS)
+ uval |= (0x100 << chn);
+ }
+ uval |= (chval & 0x3) << (chn * 2);
+ return uval;
+}
+
+/* Parses the destination prefix operand, into a prefix opcode */
+static unsigned int parse_vfpu_dpfx_channel(unsigned chval, unsigned chn)
+{
+ unsigned int uval = 0;
+
+ if (chval & PFX_MSK)
+ uval |= (0x100 << chn);
+ else
+ uval |= (chval & 0x3) << (chn * 2);
+ return uval;
+}
+
+static const unsigned short vreg_usage[8][16] = {
+ // Vectors
+ { 0x0001, 0x0010, 0x0100, 0x1000,
+ 0x0002, 0x0020, 0x0200, 0x2000,
+ 0x0004, 0x0040, 0x0400, 0x4000,
+ 0x0008, 0x0080, 0x0800, 0x8000 },
+ { 0x0003, 0x0030, 0x0300, 0x3000,
+ 0x0011, 0x0022, 0x0044, 0x0088,
+ 0x000c, 0x00c0, 0x0c00, 0xc000,
+ 0x1100, 0x2200, 0x4400, 0x8800 },
+ { 0x0007, 0x0070, 0x0700, 0x7000,
+ 0x0111, 0x0222, 0x0444, 0x0888,
+ 0x000e, 0x00e0, 0x0e00, 0xe000,
+ 0x1110, 0x2220, 0x4440, 0x8880 },
+ { 0x000f, 0x00f0, 0x0f00, 0xf000,
+ 0x1111, 0x2222, 0x4444, 0x8888,
+ 0x000f, 0x00f0, 0x0f00, 0xf000,
+ 0x1111, 0x2222, 0x4444, 0x8888 },
+ // Matrices
+ { 0x0033, 0x0033, 0x3300, 0x3300,
+ 0x0033, 0x0033, 0x00cc, 0x00cc,
+ 0x00cc, 0x00cc, 0xcc00, 0xcc00,
+ 0x3300, 0x3300, 0xcc00, 0xcc00 },
+ { 0x0777, 0x7770, 0x0777, 0x7770,
+ 0x0777, 0x0eee, 0x0777, 0x0eee,
+ 0x0eee, 0xeee0, 0x0eee, 0xeee0,
+ 0x7770, 0xeee0, 0x7770, 0xeee0 },
+ { 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff,
+ 0xffff, 0xffff, 0xffff, 0xffff },
+};
+
+#define INVALID_REG(msg) \
+{ \
+ set_insn_error (arg->argnum, _(msg)); \
+ return false; \
+}
+
+#define INVALID_REG_EX(msg, ...) \
+{ \
+ char errmsg[1024]; \
+ snprintf(errmsg, sizeof(errmsg), _(msg), __VA_ARGS__); \
+ set_insn_error_ss(arg->argnum, "%s%s", errmsg, ""); \
+ return false; \
+}
+
+/* Matches VFPU operands and their subtypes */
+static bool
+match_vfpu_operand (struct mips_arg_info *arg,
+ const struct mips_operand *operand)
+{
+ const struct mips_vfpu_operand *vfpuop = (struct mips_vfpu_operand*)operand;
+ unsigned int uval = 0;
+ enum mips_vfpu_reg_shape shape;
+
+ switch (vfpuop->op_type) {
+ case OP_VFPU_REGS:
+ case OP_VFPU_REGT:
+ case OP_VFPU_REGD:
+ case OP_VFPU_REGX:
+ case OP_VFPU_REGV:
+ {
+ unsigned isdest = (vfpuop->op_type == OP_VFPU_REGD ||
+ vfpuop->op_type == OP_VFPU_REGX ||
+ vfpuop->op_type == OP_VFPU_REGV);
+
+ if (!match_vfpu_reg (arg, &uval, &shape))
+ return false;
+
+ /* Validate register type, to ensure we use the right register prefix */
+ static const struct {
+ enum mips_vfpu_reg_shape gen, spc;
+ const char *errmsg;
+ } val_shap[] = {
+ { VFPU_REG_SHAPE_VECTOR_1, VFPU_REG_SHAPE_VECTOR_1, "single" },
+ { VFPU_REG_SHAPE_VECTOR_UNKNOWN, VFPU_REG_SHAPE_VECTOR_2, "pair" },
+ { VFPU_REG_SHAPE_VECTOR_UNKNOWN, VFPU_REG_SHAPE_VECTOR_3, "triple" },
+ { VFPU_REG_SHAPE_VECTOR_UNKNOWN, VFPU_REG_SHAPE_VECTOR_4, "quad" },
+ { VFPU_REG_SHAPE_MATRIX_UNKNOWN, VFPU_REG_SHAPE_MATRIX_2x2, "2x2 matrix" },
+ { VFPU_REG_SHAPE_MATRIX_UNKNOWN, VFPU_REG_SHAPE_MATRIX_3x3, "3x3 matrix" },
+ { VFPU_REG_SHAPE_MATRIX_UNKNOWN, VFPU_REG_SHAPE_MATRIX_4x4, "4x4 matrix" },
+ };
+
+ if (shape != val_shap[vfpuop->extra].gen &&
+ shape != val_shap[vfpuop->extra].spc) {
+ set_insn_error_ss(arg->argnum,
+ "VFPU register type mismatch: a %s%s register is required",
+ val_shap[vfpuop->extra].errmsg, "");
+ return false;
+ }
+
+ /* Validate that source registers do not overlap with the destination reg */
+ switch (vfpuop->op_type) {
+ case OP_VFPU_REGD:
+ arg->dest_regno = ILLEGAL_REG; /* No possible collisions */
+ break;
+ case OP_VFPU_REGX:
+ /* Annotate dest reg and type of conflict for further validation */
+ arg->dest_regno = uval | (vfpuop->extra << 7);
+ break;
+ case OP_VFPU_REGV:
+ arg->dest_regno = uval | (vfpuop->extra << 7) | 0x8000;
+ break;
+ case OP_VFPU_REGS:
+ case OP_VFPU_REGT:
+ if (arg->dest_regno != ILLEGAL_REG) {
+ unsigned dreg = arg->dest_regno;
+ /* There are no collisions across different matrices */
+ unsigned dmtx = (dreg >> VF_SH_MR_MTX) & VF_MASK_MR_MTX;
+ unsigned smtx = (uval >> VF_SH_MR_MTX) & VF_MASK_MR_MTX;
+ if (dmtx == smtx) {
+ /* Whether it's an X type (no collision allowed at all) */
+ unsigned dstexcl = dreg >> 15;
+ unsigned dstsize = (dreg >> 7) & 7;
+ unsigned srcsize = vfpuop->extra;
+ /* Decode the row/col indices, ignoring matrix id */
+ unsigned dfsl = (dreg >> VF_SH_MR_FSL) & VF_MASK_MR_FSL;
+ unsigned didx = (dreg >> VF_SH_MR_IDX) & VF_MASK_MR_IDX;
+ unsigned drxc = (dreg >> VF_SH_MR_RXC) & VF_MASK_MR_RXC;
+ unsigned sfsl = (uval >> VF_SH_MR_FSL) & VF_MASK_MR_FSL;
+ unsigned sidx = (uval >> VF_SH_MR_IDX) & VF_MASK_MR_IDX;
+ unsigned srxc = (uval >> VF_SH_MR_RXC) & VF_MASK_MR_RXC;
+
+ /* These hold a 16 bit boolean mask with the used registers */
+ unsigned dstregs = vreg_usage[dstsize][(dfsl << 2) | didx];
+ unsigned srcregs = vreg_usage[srcsize][(sfsl << 2) | sidx];
+ unsigned comregs = (srcregs & dstregs);
+
+ /* If there's register overlap we need to notify the user if
+ the destination is type V (strict overlap) or if it's X type
+ but the register overlap is not "compatible", that is, if the
+ area and direction do not match */
+
+ if (comregs && (dstexcl || (dstregs != srcregs) || (drxc != srxc))) {
+ /* Produce some user meaningful error code */
+ unsigned dvfsl = (dreg >> VF_SH_MR_VFSL) & VF_MASK_MR_VFSL;
+ switch (dstsize) {
+ case 1:
+ dvfsl <<= 1;
+ /* fallthrough */
+ case 2:
+ case 3:
+ if (drxc)
+ INVALID_REG_EX("destination register conflict (R%u%u%u)", dmtx, dvfsl, didx)
+ else
+ INVALID_REG_EX("destination register conflict (C%u%u%u)", dmtx, didx, dvfsl)
+
+ case 4:
+ dvfsl <<= 1;
+ /* fallthrough */
+ case 5:
+ case 6:
+ if (drxc)
+ INVALID_REG_EX("destination register conflict (E%u%u%u)", dmtx, dvfsl, didx)
+ else
+ INVALID_REG_EX("destination register conflict (M%u%u%u)", dmtx, didx, dvfsl)
+ };
+ }
+ }
+ }
+ break;
+ default:
+ abort ();
+ };
+
+ /* vmmul is special for VS register, this must be done *after* register conflict */
+ if (vfpuop->op_type == OP_VFPU_REGS && !strncmp(arg->insn->insn_mo->name, "vmmul", 5))
+ uval ^= 0x20;
+
+ insn_insert_operand (arg->insn, operand, uval);
+
+ /* Now try to parse any prefix that might be there */
+ if (arg->token->type == OT_IMM_VFPU) {
+ unsigned int opcode = 0;
+ bfd_reloc_code_real_type unused_reloc[3]
+ = {BFD_RELOC_UNUSED, BFD_RELOC_UNUSED, BFD_RELOC_UNUSED};
+ struct mips_cl_insn pins;
+ struct mips_opcode *pop = (struct mips_opcode *) str_hash_find (
+ op_hash, vfpuop->op_type == OP_VFPU_REGS ? "vpfxs" :
+ vfpuop->op_type == OP_VFPU_REGT ? "vpfxt" : "vpfxd");
+
+ /* Check whether the prefixes are allowed */
+ if (vfpuop->op_type == OP_VFPU_REGS && vfpuop->pfxcompat == 'f') {
+ set_insn_error (arg->argnum, _("source reg does not support prefixes"));
+ return false;
+ }
+ if (vfpuop->op_type == OP_VFPU_REGT && vfpuop->pfxcompat == 'f') {
+ set_insn_error (arg->argnum, _("target reg does not support prefixes"));
+ return false;
+ }
+ if (isdest && vfpuop->pfxcompat == 'f') {
+ set_insn_error (arg->argnum, _("destination reg does not support prefixes"));
+ return false;
+ }
+
+ /* Fill all elements, even if they are not needed (binary compat) */
+ for (unsigned i = 0; i < 4; i++) {
+ /* Mantains a default that's binary compatible, should not matter */
+ unsigned int chnv = isdest ? PFX_MSK : 0;
+ if (i <= vfpuop->extra) {
+ /* Only if this is required, otherwise will fill chnv=0 */
+ chnv = arg->token->u.vfpu_immediate;
+ if (arg->token->type != OT_IMM_VFPU) {
+ set_insn_error (arg->argnum, _("mismatched prefix size, too few elements"));
+ return false;
+ }
+ ++arg->token;
+
+ if (isdest && vfpuop->pfxcompat == 'm' && !(chnv & PFX_MSK) && chnv != 0) {
+ set_insn_error (arg->argnum, _("instruction can only do masking in destination prefix"));
+ return false;
+ }
+ if (!isdest && vfpuop->pfxcompat == 'w' && (chnv & (PFX_CST|PFX_NEG|PFX_ABS))) {
+ set_insn_error (arg->argnum, _("instruction can only perform swizzle in source prefix"));
+ return false;
+ }
+ }
+
+ if (isdest) {
+ if (chnv & (PFX_CST|PFX_SWZ|PFX_NEG|PFX_ABS)) {
+ set_insn_error (arg->argnum, _("destination prefix cannot contain swizzle, "
+ "negation, constants or absolute value operations"));
+ return false;
+ }
+
+ opcode |= parse_vfpu_dpfx_channel(chnv, i);
+ } else {
+ if (chnv & PFX_DST) {
+ set_insn_error (arg->argnum, _("source prefix cannot contain masking or saturation operations"));
+ return false;
+ }
+
+ /* Check whether this channel is even allowed */
+ if (!(chnv & PFX_CST) && ((chnv & 3) > vfpuop->extra)) {
+ set_insn_error (arg->argnum, _("swizzle operand is out of range"));
+ return false;
+ }
+ opcode |= parse_vfpu_spfx_channel(chnv, i);
+ }
+ }
+
+ if (arg->token->type == OT_IMM_VFPU)
+ set_insn_error (arg->argnum, _("mismatched prefix size, too many elements"));
+
+ /* Emit prefix instruction right here */
+ create_insn (&pins, pop);
+ pins.insn_opcode |= opcode;
+ append_insn (&pins, NULL, unused_reloc, false);
+ }
+
+ return true;
+
+ }
+ case OP_VFPU_REG2:
+ if (!match_vfpu_reg (arg, &uval, &shape))
+ return false;
+
+ switch (vfpuop->extra) {
+ case 0:
+ if (shape != VFPU_REG_SHAPE_VECTOR_UNKNOWN && shape != VFPU_REG_SHAPE_VECTOR_1)
+ INVALID_REG("register type mismatch: a single register is required");
+ break;
+ case 3:
+ if (shape != VFPU_REG_SHAPE_VECTOR_UNKNOWN && shape != VFPU_REG_SHAPE_VECTOR_4)
+ INVALID_REG("register type mismatch: a quad register is required");
+ break;
+ };
+
+ // This takes care of the two-part register encoding
+ insn_insert_operand (arg->insn, operand, uval);
+ return true;
+
+ case OP_VFPU_CREG:
+ if (!match_reg (arg, OP_REG_VFPU_CTR, &uval))
+ return false;
+
+ if (!(uval >= VF_MIN_VCR && uval <= VF_MAX_VCR)) {
+ set_insn_error (arg->argnum, _("invalid coprocessor register"));
+ return false;
+ }
+
+ insn_insert_operand (arg->insn, operand, uval);
+ return true;
+
+ case OP_VFPU_NCNT:
+ if (arg->token->type == OT_INTEGER &&
+ arg->token->u.integer.value.X_op == O_symbol) {
+
+ static const char *cnt_names[] = {
+ "VFPU_HUGE", "VFPU_SQRT2", "VFPU_SQRT1_2", "VFPU_2_SQRTPI",
+ "VFPU_2_PI", "VFPU_1_PI", "VFPU_PI_4", "VFPU_PI_2",
+ "VFPU_PI", "VFPU_E", "VFPU_LOG2E", "VFPU_LOG10E",
+ "VFPU_LN2", "VFPU_LN10", "VFPU_2PI", "VFPU_PI_6",
+ "VFPU_LOG10TWO", "VFPU_LOG2TEN", "VFPU_SQRT3_2"
+ };
+
+ const char *cc = S_GET_NAME(arg->token->u.integer.value.X_add_symbol);
+ for (unsigned i = 0; i < 19; i++) {
+ if (!strcmp(cc, cnt_names[i])) {
+ ++arg->token;
+ insn_insert_operand (arg->insn, operand, i + 1);
+ return true;
+ }
+ }
+ }
+
+ set_insn_error (arg->argnum, _("invalid constant code"));
+ return false;
+
+ case OP_VFPU_COND:
+ if (!match_reg (arg, OP_REG_VFPU_CTR, &uval))
+ return false;
+
+ if (uval > 16) {
+ set_insn_error (arg->argnum, _("invalid condition code"));
+ return false;
+ }
+
+ // Validate number of operands and operation
+ switch (vfpuop->extra) {
+ case 1:
+ // Unary operations only work for some codes
+ if (uval < 8) {
+ set_insn_error (arg->argnum, _("invalid condition code for unary operation"));
+ return false;
+ }
+ break;
+ case 0:
+ if (uval != VFPU_CONDCODE_FL && uval != VFPU_CONDCODE_TR) {
+ set_insn_error (arg->argnum, _("invalid condition code: must be FL or TR"));
+ return false;
+ }
+ break;
+ };
+
+ insn_insert_operand (arg->insn, operand, uval);
+ return true;
+
+ case OP_VFPU_HFLOAT:
+ if (arg->token->type != OT_FLOAT)
+ return false;
+
+ /* Parse directly as IEEE binary16. Converting a binary32 token here
+ loses subnormals and can round twice near a halfway value. */
+ gas_assert (arg->token->u.flt.length == 2);
+ uval = (target_big_endian
+ ? bfd_getb16 (arg->token->u.flt.data)
+ : bfd_getl16 (arg->token->u.flt.data));
+ insn_insert_operand (arg->insn, operand, uval);
+ ++arg->token;
+ return true;
+
+ case OP_VFPU_SPREFIX:
+ {
+ if (arg->token->type != OT_IMM_VFPU)
+ return false;
+
+ if (arg->token->u.vfpu_immediate & PFX_DST) {
+ set_insn_error (arg->argnum, _("source prefix cannot contain masking or saturation operations"));
+ return false;
+ }
+
+ arg->insn->insn_opcode |= parse_vfpu_spfx_channel(arg->token->u.vfpu_immediate, vfpuop->extra);
+ ++arg->token;
+ return true;
+ }
+
+ case OP_VFPU_DPREFIX:
+ {
+ if (arg->token->type != OT_IMM_VFPU)
+ return false;
+
+ if (arg->token->u.vfpu_immediate & (PFX_CST|PFX_SWZ|PFX_NEG|PFX_ABS)) {
+ set_insn_error (arg->argnum, _("destination prefix cannot contain swizzle, negation, constants or absolute value operations"));
+ return false;
+ }
+
+ arg->insn->insn_opcode |= parse_vfpu_dpfx_channel(arg->token->u.vfpu_immediate, vfpuop->extra);
+ ++arg->token;
+ return true;
+ }
+
+ case OP_VFPU_WRAPCNT:
+ {
+ offsetT val;
+ if (!match_const_int (arg, &val))
+ return false;
+
+ insn_insert_operand (arg->insn, operand, val);
+ return true;
+ }
+
+ case OP_VFPU_ROTCNT:
+ if (arg->token->type == OT_IMM_VFPU) {
+ static const struct
+ {
+ unsigned int encoded_expr[3]; // Three possible sizes
+ unsigned int imm5; // The actual instruction encoding
+ } vrot_enct[16] = {
+ {{14, 58, 234}, 0}, // csss
+ {{11, 44, 176}, 1}, // sc00
+ {{ 8, 35, 140}, 2}, // s0c0
+ {{ 8, 32, 131}, 3}, // s00c
+ {{14, 56, 224}, 4}, // cs00
+ {{11, 46, 186}, 5}, // scss
+ {{ 2, 11, 44}, 6}, // 0sc0
+ {{ 2, 8, 35}, 7}, // 0s0c
+ {{12, 50, 200}, 8}, // c0s0
+ {{ 3, 14, 56}, 9}, // 0cs0
+ {{10, 43, 174}, 10}, // sscs
+ {{ 0, 2, 11}, 11}, // 00sc
+ {{12, 48, 194}, 12}, // c00s
+ {{ 3, 12, 50}, 13}, // 0c0s
+ {{ 0, 3, 14}, 14}, // 00cs
+ {{10, 42, 171}, 15}, // sssc
+ };
+
+ unsigned int regidx = arg->token->u.vfpu_immediate & 0xff;
+ unsigned int regsze = (arg->token->u.vfpu_immediate >> 8) & 0x3;
+ bool neg = arg->token->u.vfpu_immediate & 0x800;
+
+ /* Pick the first match, there might be more than one encoding */
+ for (unsigned i = 0; i < 16; i++) {
+ if (vrot_enct[i].encoded_expr[regsze] == regidx) {
+ unsigned immval = vrot_enct[i].imm5 | (neg ? 16 : 0);
+ insn_insert_operand (arg->insn, operand, immval);
+ ++arg->token;
+ return true;
+ }
+ }
+ }
+ return false;
+
+ case OP_VFPU_WRB_BOOL:
+ if (arg->token->type == OT_INTEGER &&
+ arg->token->u.integer.value.X_op == O_symbol) {
+
+ const char *cc = S_GET_NAME(arg->token->u.integer.value.X_add_symbol);
+ if (!strcmp(cc, "wb") || !strcmp(cc, "WB")) {
+ ++arg->token;
+ insn_insert_operand (arg->insn, operand, 1);
+ return true;
+ }
+ else if (!strcmp(cc, "wt") || !strcmp(cc, "WT")) {
+ ++arg->token;
+ insn_insert_operand (arg->insn, operand, 0);
+ return true;
+ }
+ }
+
+ set_insn_error (arg->argnum, _("invalid sv.q suffix, only 'wb' and 'wt' suffixes are allowed"));
+ return false;
+ };
+ return false;
+}
+
/* OP_VU0_SUFFIX and OP_VU0_MATCH_SUFFIX matcher; MATCH_P selects between
them. */
@@ -6614,6 +7689,9 @@ match_operand (struct mips_arg_info *arg,
case OP_VU0_MATCH_SUFFIX:
return match_vu0_suffix_operand (arg, operand, true);
+ case OP_VFPU_OPERAND:
+ return match_vfpu_operand (arg, operand);
+
case OP_IMM_INDEX:
return match_imm_index_operand (arg, operand);
@@ -8637,7 +9715,9 @@ match_insn (struct mips_cl_insn *insn, const struct mips_opcode *opcode,
return false;
/* Handle characters that need to match exactly. */
- if (*args == '(' || *args == ')' || *args == ',')
+ if (*args == '(' || *args == ')' || *args == ','
+ || (opcode->pinfo == INSN_MACRO
+ && (*args == '[' || *args == ']')))
{
if (match_char (&arg, *args))
continue;
@@ -8655,6 +9735,48 @@ match_insn (struct mips_cl_insn *insn, const struct mips_opcode *opcode,
return false;
}
+ /* The VFPU load-immediate macros retain each floating-point lane
+ separately. These are macro operands, not instruction fields. */
+ if (args[0] == '?' && args[1] == 'y')
+ {
+ unsigned int lane = args[2] - '0';
+ unsigned char *data;
+ int length = startswith (opcode->name, "lvhi") ? 2 : 4;
+
+ gas_assert (lane < ARRAY_SIZE (vfpu_immediates));
+ if (length == 4 && arg.token->type == OT_INTEGER)
+ {
+ offsetT value;
+ if (!match_const_int (&arg, &value))
+ return false;
+ if (value < -0x80000000LL || value > 0xffffffffLL)
+ {
+ set_insn_error (arg.argnum,
+ _("VFPU immediate out of 32-bit range"));
+ return false;
+ }
+ vfpu_immediates[lane] = value;
+ args += 2;
+ continue;
+ }
+ if (arg.token->type != OT_FLOAT)
+ {
+ set_insn_error (arg.argnum,
+ _("floating-point expression required"));
+ return false;
+ }
+ gas_assert (arg.token->u.flt.length == length);
+ data = arg.token->u.flt.data;
+ vfpu_immediates[lane] = (length == 2
+ ? (target_big_endian
+ ? bfd_getb16 (data) : bfd_getl16 (data))
+ : (target_big_endian
+ ? bfd_getb32 (data) : bfd_getl32 (data)));
+ ++arg.token;
+ args += 2;
+ continue;
+ }
+
/* Handle special macro operands. Work out the properties of
other operands. */
arg.opnum += 1;
@@ -8774,6 +9896,11 @@ match_insn (struct mips_cl_insn *insn, const struct mips_opcode *opcode,
/* Skip prefixes. */
if (*args == '+' || *args == 'm' || *args == '-')
args++;
+ if (*args == '?') {
+ while (args[1] != 0 && args[1] != '?' && args[1] != ',' &&
+ args[1] != '(' && args[1] != '[' && args[1] != ')' && args[1] != ']')
+ args++;
+ }
if (mips_optional_operand_p (operand)
&& args[1] == ','
@@ -9473,6 +10600,55 @@ macro_build (expressionS *ep, const char *name, const char *fmt, ...)
*r = BFD_RELOC_MIPS_JMP;
break;
+ /* VFPU fields */
+ case '?':
+ switch (*(++fmt))
+ {
+ case 'o':
+ macro_read_relocs (&args, r);
+ gas_assert (*r == BFD_RELOC_GPREL16
+ || *r == BFD_RELOC_MIPS_LITERAL
+ || *r == BFD_RELOC_MIPS_HIGHER
+ || *r == BFD_RELOC_HI16_S
+ || *r == BFD_RELOC_LO16
+ || *r == BFD_RELOC_MIPS_GOT16
+ || *r == BFD_RELOC_MIPS_CALL16
+ || *r == BFD_RELOC_MIPS_GOT_DISP
+ || *r == BFD_RELOC_MIPS_GOT_PAGE
+ || *r == BFD_RELOC_MIPS_GOT_OFST
+ || *r == BFD_RELOC_MIPS_GOT_LO16
+ || *r == BFD_RELOC_MIPS_CALL_LO16);
+ break;
+ case 'd':
+ insn.insn_opcode |= va_arg (args, int) << VF_SH_VD;
+ fmt += 2;
+ break;
+ case 's':
+ insn.insn_opcode |= va_arg (args, int) << VF_SH_VS;
+ fmt += 2;
+ break;
+ case 'm':
+ {
+ int vtreg = va_arg (args, int);
+ insn.insn_opcode |= (vtreg & VF_MASK_VML) << VF_SH_VML;
+ insn.insn_opcode |= ((vtreg >> 5) & VF_MASK_VMH) << VF_SH_VMH;
+ fmt += 2;
+ break;
+ }
+ case 'n':
+ {
+ int vtreg = va_arg (args, int);
+ insn.insn_opcode |= (vtreg & VF_MASK_VNL) << VF_SH_VNL;
+ insn.insn_opcode |= ((vtreg >> 5) & VF_MASK_VNH) << VF_SH_VNH;
+ fmt += 2;
+ break;
+ }
+ case 'e':
+ insn.insn_opcode |= va_arg (args, int) << VF_SH_MCOND;
+ break;
+ }
+ continue;
+
default:
operand = (mips_opts.micromips
? decode_micromips_operand (fmt)
@@ -10614,6 +11790,7 @@ macro (struct mips_cl_insn *ip, char *str)
const struct mips_operand_array *operands;
unsigned int breg, i;
unsigned int tempreg;
+ int vsreg, vtreg, vdreg, vmreg, vwb;
int mask;
int used_at = 0;
expressionS label_expr;
@@ -10649,6 +11826,13 @@ macro (struct mips_cl_insn *ip, char *str)
mask = ip->insn_mo->mask;
+ vmreg = ((ip->insn_opcode >> 16) & 0x1f)
+ | ((ip->insn_opcode << 5) & 0x60);
+ vtreg = (ip->insn_opcode >> 16) & 0x7f;
+ vsreg = (ip->insn_opcode >> 8) & 0x7f;
+ vdreg = ip->insn_opcode & 0x7f;
+ vwb = (ip->insn_opcode >> 1) & 1;
+
label_expr = (expressionS) { .X_op = O_constant };
expr1 = (expressionS) { .X_op = O_constant, .X_add_number = 1 };
@@ -12283,6 +13467,34 @@ macro (struct mips_cl_insn *ip, char *str)
/* Itbl support may require additional care here. */
coproc = 1;
goto ld_st;
+ case M_LV_S_AB:
+ s = "lv.s";
+ /* Itbl support may require additional care here. */
+ coproc = 1;
+ fmt = "?m0f,?o(b)";
+ op[0] = vmreg;
+ goto ld;
+ case M_LV_Q_AB:
+ s = "lv.q";
+ /* Itbl support may require additional care here. */
+ coproc = 1;
+ fmt = "?n3f,?o(b)";
+ op[0] = vmreg;
+ goto ld;
+ case M_LVL_Q_AB:
+ s = "lvl.q";
+ /* Itbl support may require additional care here. */
+ coproc = 1;
+ fmt = "?n3f,?o(b)";
+ op[0] = vmreg;
+ goto ld;
+ case M_LVR_Q_AB:
+ s = "lvr.q";
+ /* Itbl support may require additional care here. */
+ coproc = 1;
+ fmt = "?n3f,?o(b)";
+ op[0] = vmreg;
+ goto ld;
case M_LWL_AB:
s = "lwl";
fmt = MEM12_FMT;
@@ -12448,6 +13660,37 @@ macro (struct mips_cl_insn *ip, char *str)
/* Itbl support may require additional care here. */
coproc = 1;
goto ld_st;
+ case M_SV_S_AB:
+ s = "sv.s";
+ /* Itbl support may require additional care here. */
+ coproc = 1;
+ fmt = "?m0f,?o(b)";
+ op[0] = vmreg;
+ goto ld_st;
+ case M_SV_Q_AB:
+ if (vwb)
+ s = "vwb.q";
+ else
+ s = "sv.q";
+ /* Itbl support may require additional care here. */
+ coproc = 1;
+ fmt = "?n3f,?o(b)";
+ op[0] = vmreg;
+ goto ld_st;
+ case M_SVL_Q_AB:
+ s = "svl.q";
+ /* Itbl support may require additional care here. */
+ coproc = 1;
+ fmt = "?n3f,?o(b)";
+ op[0] = vmreg;
+ goto ld_st;
+ case M_SVR_Q_AB:
+ s = "svr.q";
+ /* Itbl support may require additional care here. */
+ coproc = 1;
+ fmt = "?n3f,?o(b)";
+ op[0] = vmreg;
+ goto ld_st;
case M_SWL_AB:
s = "swl";
fmt = MEM12_FMT;
@@ -13027,6 +14270,64 @@ macro (struct mips_cl_insn *ip, char *str)
break;
}
+ case M_LVI_S:
+ case M_LVI_P:
+ case M_LVI_T:
+ case M_LVI_Q:
+ case M_LVHI_S:
+ case M_LVHI_P:
+ {
+ unsigned int size, first, stride, scalar;
+ bool half = mask == M_LVHI_S || mask == M_LVHI_P;
+
+ switch (mask)
+ {
+ case M_LVI_S:
+ case M_LVHI_S: size = 1; break;
+ case M_LVI_P:
+ case M_LVHI_P: size = 2; break;
+ case M_LVI_T: size = 3; break;
+ default: size = 4; break;
+ }
+
+ if (size == 1)
+ {
+ scalar = vtreg;
+ stride = 0;
+ }
+ else
+ {
+ /* A vector's bit 6 selects its starting row/column: two for
+ pairs, one for triples. Bit 5 selects row orientation. */
+ first = size == 4 ? 0 : ((vtreg >> 6) & 1) * (size == 2 ? 2 : 1);
+ scalar = (vtreg & 0x1c);
+ if (vtreg & 0x20)
+ {
+ scalar |= ((vtreg & 3) << 5) | first;
+ stride = 1;
+ }
+ else
+ {
+ scalar |= (vtreg & 3) | (first << 5);
+ stride = 32;
+ }
+ }
+
+ for (i = 0; i < size; ++i)
+ {
+ imm_expr.X_op = O_constant;
+ imm_expr.X_add_number = (half
+ ? (vfpu_immediates[2 * i]
+ | (vfpu_immediates[2 * i + 1] << 16))
+ : vfpu_immediates[i]);
+ load_register (AT, &imm_expr, 0);
+ macro_build (NULL, "mtv", "t,?d0f", AT, scalar);
+ scalar += stride;
+ }
+ used_at = 1;
+ break;
+ }
+
case M_LI_D:
/* Check if we have a constant in IMM_EXPR. If the GPRs are 64 bits
wide, IMM_EXPR is the entire value. Otherwise IMM_EXPR is the high
@@ -13573,6 +14874,27 @@ macro (struct mips_cl_insn *ip, char *str)
micromips_to_32_reg_n_map[op[2]]);
break;
+ case M_VCMOV_S:
+ s = "vcmovt.s";
+ fmt = "?d0a,?s0a,?e";
+ goto vcmov;
+ case M_VCMOV_P:
+ s = "vcmovt.p";
+ fmt = "?d1a,?s1a,?e";
+ goto vcmov;
+ case M_VCMOV_T:
+ s = "vcmovt.t";
+ fmt = "?d2a,?s2a,?e";
+ goto vcmov;
+ case M_VCMOV_Q:
+ s = "vcmovt.q";
+ fmt = "?d3a,?s3a,?e";
+ vcmov:
+ macro_build ((expressionS *) NULL, s, fmt,
+ vdreg, vsreg,
+ (ip->insn_opcode >> VF_SH_MCOND) & VF_MASK_MCOND);
+ return;
+
case M_DMUL:
dbl = 1;
/* Fall through. */
@@ -14176,6 +15498,19 @@ macro (struct mips_cl_insn *ip, char *str)
offbits = (mips_opts.micromips ? 12 : 16);
off = 3;
goto uld_st;
+
+ case M_ULV_Q_AB:
+ off = 12;
+ if (offset_expr.X_add_number >= 0x8000 - off)
+ as_bad (_("operand overflow"));
+ offset_expr.X_add_number += off;
+ macro_build (&offset_expr, "lvl.q", "?n3f,?o(b)",
+ vmreg, (int) BFD_RELOC_LO16, op[2]);
+ offset_expr.X_add_number -= off;
+ macro_build (&offset_expr, "lvr.q", "?n3f,?o(b)",
+ vmreg, (int) BFD_RELOC_LO16, op[2]);
+ return;
+
case M_ULD_AB:
s = "ldl";
s2 = "ldr";
@@ -14195,6 +15530,19 @@ macro (struct mips_cl_insn *ip, char *str)
off = 3;
ust = 1;
goto uld_st;
+
+ case M_USV_Q_AB:
+ off = 12;
+ if (offset_expr.X_add_number >= 0x8000 - off)
+ as_bad (_("operand overflow"));
+ offset_expr.X_add_number += off;
+ macro_build (&offset_expr, "svl.q", "?n3f,?o(b)",
+ vmreg, (int) BFD_RELOC_LO16, op[2]);
+ offset_expr.X_add_number -= off;
+ macro_build (&offset_expr, "svr.q", "?n3f,?o(b)",
+ vmreg, (int) BFD_RELOC_LO16, op[2]);
+ return;
+
case M_USD_AB:
s = "sdl";
s2 = "sdr";
@@ -14658,13 +16006,16 @@ mips_ip (char *str, struct mips_cl_insn *insn)
return;
}
- if (strcmp (first->name, "li.s") == 0)
+ if (strcmp (first->name, "li.s") == 0
+ || startswith (first->name, "lvi."))
format = 'f';
else if (strcmp (first->name, "li.d") == 0)
format = 'd';
+ else if (!strncmp(first->name, "lvhi", 4) || !strncmp(first->name, "vfim", 4))
+ format = 'h';
else
format = 0;
- tokens = mips_parse_arguments (str + end, format);
+ tokens = mips_parse_arguments (str + end, format, first);
if (!tokens)
return;
@@ -14726,7 +16077,7 @@ mips16_ip (char *str, struct mips_cl_insn *insn)
return;
}
- tokens = mips_parse_arguments (s, 0);
+ tokens = mips_parse_arguments (s, 0, first);
if (!tokens)
return;
diff --git a/gas/configure b/gas/configure
index bf3ccf30..f50dfbc6 100755
--- a/gas/configure
+++ b/gas/configure
@@ -12648,6 +12648,9 @@ _ACEOF
mips64vr | mips64vrel)
mips_cpu=vr4100
;;
+ mipsallegrex | mipsallegrexel)
+ mips_cpu=allegrex
+ ;;
mipsisa32r2* | mipsisa64r2*)
mips_cpu=`echo $target_cpu | sed -e 's/[a-z]*..r2//' -e 's/el$//'`
;;
diff --git a/gas/configure.ac b/gas/configure.ac
index 09089b39..f3571c2c 100644
--- a/gas/configure.ac
+++ b/gas/configure.ac
@@ -357,6 +357,9 @@ changequote([,])dnl
mips64vr | mips64vrel)
mips_cpu=vr4100
;;
+ mipsallegrex | mipsallegrexel)
+ mips_cpu=allegrex
+ ;;
mipsisa32r2* | mipsisa64r2*)
changequote(,)dnl
mips_cpu=`echo $target_cpu | sed -e 's/[a-z]*..r2//' -e 's/el$//'`
diff --git a/include/elf/common.h b/include/elf/common.h
index 6b99f007..b3a3601d 100644
--- a/include/elf/common.h
+++ b/include/elf/common.h
@@ -102,6 +102,7 @@
#define ET_HIOS 0xFEFF /* Operating system-specific */
#define ET_LOPROC 0xFF00 /* Processor-specific */
#define ET_HIPROC 0xFFFF /* Processor-specific */
+#define ET_PSPEXEC 0xFFA0 /* Sony PSP executable file */
/* Values for e_machine, which identifies the architecture. These numbers
are officially assigned by registry@sco.com. See below for a list of
diff --git a/include/opcode/mips.h b/include/opcode/mips.h
index 1edacd88..5974d6f2 100644
--- a/include/opcode/mips.h
+++ b/include/opcode/mips.h
@@ -25,6 +25,8 @@
#include "bfd.h"
+#include "vfpu.h"
+
#ifdef __cplusplus
extern "C" {
#endif
@@ -182,7 +184,49 @@ enum mips_operand_type {
OP_CHECK_PREV,
/* A register operand that must not be zero. */
- OP_NON_ZERO_REG
+ OP_NON_ZERO_REG,
+
+ /* A VFPU operand, described by mips_vfpu_operand */
+ OP_VFPU_OPERAND
+};
+
+/* Enumerates the types of VFPU register. */
+enum mips_vfpu_operand_type {
+ /* Regular VFPU registers: source and target. */
+ OP_VFPU_REGS, OP_VFPU_REGT,
+
+ /* Regular VFPU registers: destination (three types). */
+ OP_VFPU_REGD, OP_VFPU_REGX, OP_VFPU_REGV,
+
+ /* Two parts VFPU register (used in lv/sq insts). */
+ OP_VFPU_REG2,
+
+ /* VFPU control register number (8 bit). */
+ OP_VFPU_CREG,
+
+ /* Source prefix operand, for s/t prefix operations. */
+ OP_VFPU_SPREFIX,
+
+ /* Destination prefix operand, for d prefix operations. */
+ OP_VFPU_DPREFIX,
+
+ /* VFPU named constant value (5 bit). */
+ OP_VFPU_NCNT,
+
+ /* VFPU condition code (4 bit). */
+ OP_VFPU_COND,
+
+ /* Half float constant (16 bit). */
+ OP_VFPU_HFLOAT,
+
+ /* Wrap constant (used by vwbn, 8 bit). */
+ OP_VFPU_WRAPCNT,
+
+ /* Rotation mode immediate (5 bit, used by vrot) */
+ OP_VFPU_ROTCNT,
+
+ /* Write back boolean (1 bit, used by sv.q) */
+ OP_VFPU_WRB_BOOL
};
/* Enumerates the types of MIPS register. */
@@ -233,7 +277,10 @@ enum mips_reg_operand_type {
OP_REG_MSA,
/* MSA control registers $0-$31. */
- OP_REG_MSA_CTRL
+ OP_REG_MSA_CTRL,
+
+ /* VFPU register types */
+ OP_REG_VFPU_CTR
};
/* Base class for all operands. */
@@ -347,6 +394,27 @@ struct mips_reg_pair_operand
unsigned char *reg2_map;
};
+/* Describes an VFPU operand, which can be a register, or some immediate
+ such a constant value, condition code, or a prefix operand */
+struct mips_vfpu_operand
+{
+ /* Encodes the offset. */
+ struct mips_operand root;
+
+ /* The type of register. */
+ enum mips_vfpu_operand_type op_type;
+
+ /* Extra information, register subtype or extra bits */
+ unsigned extra;
+
+ /* For prefix tracking, store the compatibility information */
+ char pfxcompat;
+
+ /* n/m encodings encode the vt register in two chunks */
+ unsigned short size2;
+ unsigned short lsb2;
+};
+
/* Describes an operand that is calculated relative to a base PC.
The base PC is usually the address of the following instruction,
but the rules for MIPS16 instructions like ADDIUPC are more complicated. */
@@ -390,6 +458,15 @@ mips_insert_operand (const struct mips_operand *operand, unsigned int insn,
mask = (1 << operand->size) - 1;
insn &= ~(mask << operand->lsb);
insn |= (uval & mask) << operand->lsb;
+
+ /* Honor lsb2 and size2 for divided fields */
+ if (operand->type == OP_VFPU_OPERAND) {
+ const struct mips_vfpu_operand *vop = (const struct mips_vfpu_operand*)operand;
+ mask = (1 << vop->size2) - 1;
+ insn &= ~(mask << vop->lsb2);
+ insn |= ((uval >> operand->size) & mask) << vop->lsb2;
+ }
+
return insn;
}
@@ -398,7 +475,13 @@ mips_insert_operand (const struct mips_operand *operand, unsigned int insn,
static inline unsigned int
mips_extract_operand (const struct mips_operand *operand, unsigned int insn)
{
- return (insn >> operand->lsb) & ((1 << operand->size) - 1);
+ /* Honor lsb2 and size2 for divided fields */
+ unsigned int op = (insn >> operand->lsb) & ((1 << operand->size) - 1);
+ if (operand->type == OP_VFPU_OPERAND) {
+ const struct mips_vfpu_operand *vop = (const struct mips_vfpu_operand*)operand;
+ op |= ((insn >> vop->lsb2) & ((1 << vop->size2) - 1)) << operand->size;
+ }
+ return op;
}
/* UVAL is the value encoded by OPERAND. Return it in signed form. */
@@ -575,6 +658,29 @@ mips_opcode_32bit_p (const struct mips_opcode *mo)
Requires that "+A" or "+E" occur first to set position.
Enforces: 32 < (pos+size) <= 64.
+ Sony Allegrex VFPU instructions:
+ "?o" - 14 bit load/store offset (must be 4 byte aligned)
+ "?0" - "?3" - Prefix operation code for vpfxs/vpfxt instructions
+ "?4" - "?7" - Prefix operation code for vpfxd instruction
+ "?a" - 5 bit named constant (VFPU_*) used by vcst instruction
+ "?b" - 5 bit scaling constant used by int/float conversion instructions
+ "?c" - 3 bit condition code constant used by branching instructions
+ "?e" - 3 bit condition code constant used by conditional move instructions
+ "?f" - 4 bit comparison operation code used by vcmp instructions
+ "?i" - 8 bit scaling constant used by vwbn.s instruction
+ "?k" - Just a logical decorator (has no bits assigned)
+ "?q/?r" - VFPU control register number (8bit)
+ "?u" - 16 bit half float constant number (for insts/macros like vfim)
+ "?w" - 5 bit rotation code expression for vrot instructions
+ "?d" - Destination register number
+ "?m" - Source/destination register for lv.s/sv.s memory operations
+ "?n" - Source/destination register for lv.q/sv.q memory operations
+ "?s" - Operand source register (vs)
+ "?t" - Operand target register (vt)
+ "?v" - Destination register number that can't overlap with sources
+ "?x" - Destination register number that can partially overlap with sources
+ "?z" - 1 bit write mode boolean usev by sv.q instruction
+
Floating point instructions:
"D" 5-bit destination register at bit 6 (FD).
"M" 3-bit compare condition code at bit 8 (only used for mips4 and up).
@@ -887,6 +993,10 @@ mips_opcode_32bit_p (const struct mips_opcode *mo)
encoding is needed or otherwise the final EXTEND entry will apply,
for the disassembly of the prefix only. */
#define INSN2_SHORT_ONLY 0x00010000
+/* Instruction reads and writes VFPU registers. */
+#define INSN2_VFPU_REG 0x00020000
+/* Instruction uses a named condition code. */
+#define INSN2_VFPU_CC 0x00040000
/* Masks used to mark instructions to indicate which MIPS ISA level
they were introduced in. INSN_ISA_MASK masks an enumeration that
@@ -1410,6 +1520,16 @@ enum
M_LLWP_AB,
M_LLWPE_AB,
M_LQ_AB,
+ M_LVHI_P,
+ M_LVHI_S,
+ M_LVI_P,
+ M_LVI_Q,
+ M_LVI_S,
+ M_LVI_T,
+ M_LVL_Q_AB,
+ M_LVR_Q_AB,
+ M_LV_Q_AB,
+ M_LV_S_AB,
M_LW_AB,
M_LWE_AB,
M_LWC0_AB,
@@ -1510,6 +1630,10 @@ enum
M_SUB_I,
M_SUBU_I,
M_SUBU_I_2,
+ M_SVL_Q_AB,
+ M_SV_Q_AB,
+ M_SVR_Q_AB,
+ M_SV_S_AB,
M_TEQ_I,
M_TGE_I,
M_TGEU_I,
@@ -1521,10 +1645,18 @@ enum
M_ULD_AB,
M_ULH_AB,
M_ULHU_AB,
+ M_ULV_Q_AB,
+ M_ULV_S,
M_ULW_AB,
M_USH_AB,
+ M_USV_Q_AB,
+ M_USV_S,
M_USW_AB,
M_USD_AB,
+ M_VCMOV_P,
+ M_VCMOV_Q,
+ M_VCMOV_S,
+ M_VCMOV_T,
M_XOR_I,
M_COP0,
M_COP1,
diff --git a/include/opcode/vfpu.h b/include/opcode/vfpu.h
new file mode 100644
index 00000000..1fa1d321
--- /dev/null
+++ b/include/opcode/vfpu.h
@@ -0,0 +1,178 @@
+#ifndef _VFPU_H_
+#define _VFPU_H_
+
+/* Condition codes used by vcmp instructions. */
+#define VFPU_CONDCODE_FL 0
+#define VFPU_CONDCODE_EQ 1
+#define VFPU_CONDCODE_LT 2
+#define VFPU_CONDCODE_LE 3
+#define VFPU_CONDCODE_TR 4
+#define VFPU_CONDCODE_NE 5
+#define VFPU_CONDCODE_GE 6
+#define VFPU_CONDCODE_GT 7
+#define VFPU_CONDCODE_EZ 8
+#define VFPU_CONDCODE_EN 9
+#define VFPU_CONDCODE_EI 10
+#define VFPU_CONDCODE_ES 11
+#define VFPU_CONDCODE_NZ 12
+#define VFPU_CONDCODE_NN 13
+#define VFPU_CONDCODE_NI 14
+#define VFPU_CONDCODE_NS 15
+
+
+#define VF_BITCNT_VT 7
+#define VF_SH_VT 16
+#define VF_BITCNT_VS 7
+#define VF_SH_VS 8
+#define VF_BITCNT_VD 7
+#define VF_SH_VD 0
+#define VF_BITCNT_VML 5
+#define VF_MASK_VML 0x1f
+#define VF_SH_VML 16
+#define VF_BITCNT_VMH 2
+#define VF_MASK_VMH 0x3
+#define VF_SH_VMH 0
+#define VF_BITCNT_VNL 5
+#define VF_MASK_VNL 0x1f
+#define VF_SH_VNL 16
+#define VF_BITCNT_VNH 1
+#define VF_MASK_VNH 0x1
+#define VF_SH_VNH 0
+#define VF_BITCNT_OFFSET 14
+#define VF_MASK_OFFSET 0x3fff
+#define VF_SH_OFFSET 2
+#define VF_BITCNT_CC 4
+#define VF_SH_CC 0
+#define VF_BITCNT_CONST 5
+#define VF_SH_CONST 16
+#define VF_BITCNT_SCALE 5
+#define VF_SH_SCALE 16
+#define VF_BITCNT_BCOND 3
+#define VF_SH_BCOND 18
+#define VF_BITCNT_MCOND 3
+#define VF_MASK_MCOND 0x7
+#define VF_SH_MCOND 16
+#define VF_BITCNT_VCD 8
+#define VF_SH_VCD 0
+#define VF_BITCNT_VCS 8
+#define VF_SH_VCS 8
+#define VF_BITCNT_ROT 5
+#define VF_SH_ROT 16
+#define VF_BITCNT_WRAP 8
+#define VF_SH_WRAP 16
+#define VF_SH_BMCOND 0
+#define VF_BITCNT_HFLOAT 16
+#define VF_SH_HFLOAT 0
+#define VF_BITCNT_PFX 24
+#define VF_SH_PFX 0
+#define VF_BITCNT_RWB 0x1
+#define VF_SH_RWB 1
+
+#define VF_MASK_MR_MTX 0x7
+#define VF_SH_MR_MTX 2
+#define VF_MASK_MR_IDX 0x3
+#define VF_SH_MR_IDX 0
+#define VF_MASK_MR_FSL 0x3
+#define VF_SH_MR_FSL 5
+#define VF_MASK_MR_RXC 0x1
+#define VF_SH_MR_RXC 5
+#define VF_MASK_MR_VFSL 0x1
+#define VF_SH_MR_VFSL 6
+
+#define VF_MIN_VCR 128
+#define VF_MAX_VCR 143
+#define VF_MIN_CONST 1
+#define VF_MAX_CONST 19
+#define VF_MIN_BCOND 0
+#define VF_MAX_BCOND 5
+#define VF_MIN_MCOND 0
+#define VF_MAX_MCOND 6
+#define VF_MIN_WRAP 0
+#define VF_MAX_WRAP 255
+#define VF_MIN_BMCOND 0
+#define VF_MAX_BMCOND 31
+
+#define VF_MASK_F32_SIGN 0x1
+#define VF_SH_F32_SIGN 31
+#define VF_MASK_F32_EXP 0xff
+#define VF_SH_F32_EXP 23
+#define VF_MASK_F32_FRA 0x7fffff
+#define VF_SH_F32_FRA 0
+#define VF_MASK_F16_SIGN 0x1
+#define VF_SH_F16_SIGN 15
+#define VF_MASK_F16_EXP 0x1f
+#define VF_SH_F16_EXP 10
+#define VF_MASK_F16_FRA 0x3ff
+#define VF_SH_F16_FRA 0
+
+#define VF_MIN_F32_EXP 0
+#define VF_MAX_F32_EXP 255
+#define VF_BIAS_F32_EXP 127
+#define VF_MIN_F16_EXP 0
+#define VF_MAX_F16_EXP 31
+#define VF_BIAS_F16_EXP 15
+
+#define OP_SH_VFPU_DELTA 0
+#define OP_MASK_VFPU_DELTA 0xfffc
+#define OP_SH_VFPU_IMM3 16
+#define OP_MASK_VFPU_IMM3 0x7
+#define OP_SH_VFPU_IMM5 16
+#define OP_MASK_VFPU_IMM5 0x1f
+#define OP_SH_VFPU_IMM8 16
+#define OP_MASK_VFPU_IMM8 0xff
+#define OP_SH_VFPU_CC 18 /* Condition code. */
+#define OP_MASK_VFPU_CC 0x7
+#define OP_SH_VFPU_CONST 16
+#define OP_MASK_VFPU_CONST 0x1f
+#define OP_SH_VFPU_COND 0 /* Conditional compare. */
+#define OP_MASK_VFPU_COND 0xf
+#define OP_SH_VFPU_VMTVC 0
+#define OP_MASK_VFPU_VMTVC 0xff
+#define OP_SH_VFPU_VMFVC 8
+#define OP_MASK_VFPU_VMFVC 0xff
+#define OP_SH_VFPU_RWB 1
+#define OP_MASK_VFPU_RWB 0x1
+#define OP_SH_VFPU_ROT 16 /* Rotators used in vrot. */
+#define OP_MASK_VFPU_ROT 0x1f
+#define OP_SH_VFPU_FLOAT16 0
+#define OP_MASK_VFPU_FLOAT16 0xffff
+
+/* VFPU registers. */
+#define OP_SH_VFPU_VD 0
+#define OP_MASK_VFPU_VD 0x7f
+#define OP_SH_VFPU_VS 8
+#define OP_MASK_VFPU_VS 0x7f
+#define OP_SH_VFPU_VT 16
+#define OP_MASK_VFPU_VT 0x7f
+#define OP_SH_VFPU_VT_LO 16 /* Bits 0-4 of vt. */
+#define OP_MASK_VFPU_VT_LO 0x1f
+#define OP_SH_VFPU_VT_HI 5 /* Right-shifted. */
+#define OP_MASK_VFPU_VT_HI1 0x1 /* Bit 5 of vt. */
+#define OP_MASK_VFPU_VT_HI2 0x3 /* Bits 5-6 of vt. */
+
+/* VFPU prefix instruction operands. The *_SH_* values really specify where
+ the bitfield begins, as VFPU prefix instructions have four operands
+ encoded within the immediate field. */
+#define VFPU_SH_PFX_NEG 16
+#define VFPU_MASK_PFX_NEG 0x1 /* Negation. */
+#define VFPU_SH_PFX_CST 12
+#define VFPU_MASK_PFX_CST 0x1 /* Constant. */
+#define VFPU_SH_PFX_ABS_CSTHI 8
+#define VFPU_MASK_PFX_ABS_CSTHI 0x1 /* Abs/Constant (bit 2). */
+#define VFPU_SH_PFX_SWZ_CSTLO 0
+#define VFPU_MASK_PFX_SWZ_CSTLO 0x3 /* Swizzle/Constant (bits 0-1). */
+#define VFPU_SH_PFX_MASK 8
+#define VFPU_MASK_PFX_MASK 0x1 /* Mask. */
+#define VFPU_SH_PFX_SAT 0
+#define VFPU_MASK_PFX_SAT 0x3 /* Saturation. */
+
+/* VFPU 16-bit floating-point format. */
+#define VFPU_FLOAT16_EXP_MAX 0x1f
+#define VFPU_SH_FLOAT16_SIGN 15
+#define VFPU_MASK_FLOAT16_SIGN 0x1
+#define VFPU_SH_FLOAT16_EXP 10
+#define VFPU_MASK_FLOAT16_EXP 0x1f
+#define VFPU_SH_FLOAT16_FRAC 0
+#define VFPU_MASK_FLOAT16_FRAC 0x3ff
+
+#endif /* _VFPU_H_ */
diff --git a/ld/Makefile.am b/ld/Makefile.am
index b6244d08..29a7e599 100644
--- a/ld/Makefile.am
+++ b/ld/Makefile.am
@@ -282,6 +282,7 @@ ALL_EMULATION_SOURCES = \
eelf_i386_sol2.c \
eelf_i386_vxworks.c \
eelf_iamcu.c \
+ eelf_mipsallegrexel_psp.c \
eelf_s390.c \
eh8300elf.c \
eh8300elf_linux.c \
diff --git a/ld/Makefile.in b/ld/Makefile.in
index 60f0264d..38f84d30 100644
--- a/ld/Makefile.in
+++ b/ld/Makefile.in
@@ -797,6 +797,7 @@ ALL_EMULATION_SOURCES = \
eelf_i386_sol2.c \
eelf_i386_vxworks.c \
eelf_iamcu.c \
+ eelf_mipsallegrexel_psp.c \
eelf_s390.c \
eh8300elf.c \
eh8300elf_linux.c \
@@ -1472,6 +1473,7 @@ distclean-compile:
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_sol2.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_i386_vxworks.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_iamcu.Po@am__quote@
+@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_mipsallegrexel_psp.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_mipsel_haiku.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_s390.Po@am__quote@
@AMDEP_TRUE@@am__include@ @am__quote@./$(DEPDIR)/eelf_x86_64.Po@am__quote@
diff --git a/ld/configure.tgt b/ld/configure.tgt
index 55eb6e94..1f18a5f0 100644
--- a/ld/configure.tgt
+++ b/ld/configure.tgt
@@ -532,6 +532,10 @@ mips*vr5000el-*-elf*) targ_emul=elf32l4300
;;
mips*vr5000-*-elf*) targ_emul=elf32b4300
;;
+mips*allegrexel-psp-elf*)
+ targ_emul=elf_mipsallegrexel_psp
+ targ_extra_emuls="elf32elmip"
+ ;;
mips*el-sde-elf* | mips*el-mti-elf* | mips*el-img-elf*)
targ_emul=elf32ltsmip
targ_extra_emuls="elf32btsmip elf32ltsmipn32 elf64ltsmip elf32btsmipn32 elf64btsmip"
diff --git a/ld/emulparams/elf_mipsallegrexel_psp.sh b/ld/emulparams/elf_mipsallegrexel_psp.sh
new file mode 100644
index 00000000..571badae
--- /dev/null
+++ b/ld/emulparams/elf_mipsallegrexel_psp.sh
@@ -0,0 +1,22 @@
+# Based off of the default elf32 MIPS target. However, we use a seperate
+# script template because the PSP architecture defines sections that normally
+# cannot be overriden here and would normally get absorbed (i.e.
+# .rodata.sceModuleInfo would be absorbed into .rodata).
+
+EMBEDDED=yes
+source_sh ${srcdir}/emulparams/elf32lmip.sh
+unset NONPAGED_TEXT_START_ADDR
+unset SHLIB_TEXT_START_ADDR
+unset COMMONPAGESIZE
+
+SCRIPT_NAME=elf_psp
+TEXT_START_ADDR=0x08804000
+MAXPAGESIZE=256
+ARCH="mips:allegrex"
+MACHINE=
+TEMPLATE_NAME=elf
+GENERATE_SHLIB_SCRIPT=yes
+DYNAMIC_LINK=false
+
+# Discard the .comment and .pdr sections.
+OTHER_SECTIONS="/DISCARD/ : { *(.comment) *(.pdr) }"
diff --git a/ld/scripttempl/elf_psp.sc b/ld/scripttempl/elf_psp.sc
new file mode 100644
index 00000000..a76f3a3c
--- /dev/null
+++ b/ld/scripttempl/elf_psp.sc
@@ -0,0 +1,778 @@
+# Copyright (C) 2014-2021 Free Software Foundation, Inc.
+#
+# Copying and distribution of this file, with or without modification,
+# are permitted in any medium without royalty provided the copyright
+# notice and this notice are preserved.
+#
+# Unusual variables checked by this code:
+# NOP - four byte opcode for no-op (defaults to none)
+# NO_SMALL_DATA - no .sbss/.sbss2/.sdata/.sdata2 sections if not
+# empty.
+# HAVE_NOINIT - Include a .noinit output section in the script.
+# HAVE_PERSISTENT - Include a .persistent output section in the script.
+# SMALL_DATA_CTOR - .ctors contains small data.
+# SMALL_DATA_DTOR - .dtors contains small data.
+# DATA_ADDR - if end-of-text-plus-one-page isn't right for data start
+# INITIAL_READONLY_SECTIONS - at start of text segment
+# OTHER_READONLY_SECTIONS - other than .text .init .rodata ...
+# (e.g., .PARISC.milli)
+# OTHER_TEXT_SECTIONS - these get put in .text when relocating
+# INITIAL_READWRITE_SECTIONS - at start of data segment (after relro)
+# OTHER_READWRITE_SECTIONS - other than .data .bss .ctors .sdata ...
+# (e.g., .PARISC.global)
+# OTHER_RELRO_SECTIONS - other than .data.rel.ro ...
+# (e.g. PPC32 .fixup, .got[12])
+# OTHER_RELRO_SECTIONS_2 - as above, but after .dynamic in text segment
+# OTHER_BSS_SECTIONS - other than .bss .sbss ...
+# ATTRS_SECTIONS - at the end
+# OTHER_SECTIONS - at the end
+# EXECUTABLE_SYMBOLS - symbols that must be defined for an
+# executable (e.g., _DYNAMIC_LINK)
+# TEXT_START_ADDR - the first byte of the text segment, after any
+# headers.
+# TEXT_BASE_ADDRESS - the first byte of the text segment.
+# TEXT_START_SYMBOLS - symbols that appear at the start of the
+# .text section.
+# DATA_START_SYMBOLS - symbols that appear at the start of the
+# .data section.
+# DATA_END_SYMBOLS - symbols that appear at the end of the
+# writeable data sections.
+# OTHER_GOT_SYMBOLS - symbols defined just before .got.
+# OTHER_GOT_SECTIONS - sections just after .got.
+# OTHER_PLT_SECTIONS - sections just after .plt.
+# OTHER_SDATA_SECTIONS - sections just after .sdata.
+# OTHER_BSS_SYMBOLS - symbols that appear at the start of the
+# .bss section besides __bss_start.
+# PLT_NEXT_DATA - .plt next to data segment when .plt is in text segment.
+# DATA_PLT - .plt should be in data segment, not text segment.
+# PLT_BEFORE_GOT - .plt just before .got when .plt is in data segement.
+# BSS_PLT - .plt should be in bss segment
+# NO_REL_RELOCS - Don't include .rel.* sections in script
+# NO_RELA_RELOCS - Don't include .rela.* sections in script
+# NON_ALLOC_DYN - Place dynamic sections after data segment.
+# TEXT_DYNAMIC - .dynamic in text segment, not data segment.
+# EMBEDDED - whether this is for an embedded system.
+# SHLIB_TEXT_START_ADDR - if set, add to SIZEOF_HEADERS to set
+# start address of shared library.
+# INPUT_FILES - INPUT command of files to always include
+# WRITABLE_RODATA - if set, the .rodata section should be writable
+# INIT_START, INIT_END - statements just before and just after
+# combination of .init sections.
+# FINI_START, FINI_END - statements just before and just after
+# combination of .fini sections.
+# STACK_ADDR - start of a .stack section.
+# OTHER_SYMBOLS - symbols to place right at the end of the script.
+# ETEXT_NAME - name of a symbol for the end of the text section,
+# normally etext.
+# ETEXT_LAST_IN_RODATA_SEGMENT - emit ETEXT_NAME after all sections in
+# the read-only data segment (which may or may not be equal to
+# the code segment), instead of after just the code parts.
+# SEPARATE_CODE - if set, .text and similar sections containing
+# actual machine instructions must be in wholly disjoint
+# pages from any other data, including headers
+# SEPARATE_GOTPLT - if set, .got.plt should be separate output section,
+# so that .got can be in the RELRO area. It should be set to
+# the number of bytes in the beginning of .got.plt which can be
+# in the RELRO area as well.
+# USER_LABEL_PREFIX - prefix to add to user-visible symbols.
+# RODATA_NAME, SDATA_NAME, SBSS_NAME, BSS_NAME - base parts of names
+# for standard sections, without initial "." or suffixes.
+#
+# When adding sections, do note that the names of some sections are used
+# when specifying the start address of the next.
+#
+
+# Many sections come in three flavours. There is the 'real' section,
+# like ".data". Then there are the per-procedure or per-variable
+# sections, generated by -ffunction-sections and -fdata-sections in GCC,
+# and useful for --gc-sections, which for a variable "foo" might be
+# ".data.foo". Then there are the linkonce sections, for which the linker
+# eliminates duplicates, which are named like ".gnu.linkonce.d.foo".
+# The exact correspondences are:
+#
+# Section Linkonce section
+# .text .gnu.linkonce.t.foo
+# .rodata .gnu.linkonce.r.foo
+# .data .gnu.linkonce.d.foo
+# .bss .gnu.linkonce.b.foo
+# .sdata .gnu.linkonce.s.foo
+# .sbss .gnu.linkonce.sb.foo
+# .sdata2 .gnu.linkonce.s2.foo
+# .sbss2 .gnu.linkonce.sb2.foo
+# .debug_info .gnu.linkonce.wi.foo
+# .tdata .gnu.linkonce.td.foo
+# .tbss .gnu.linkonce.tb.foo
+# .lrodata .gnu.linkonce.lr.foo
+# .ldata .gnu.linkonce.l.foo
+# .lbss .gnu.linkonce.lb.foo
+# .noinit .gnu.linkonce.n.foo
+# .persistent .gnu.linkonce.p.foo
+#
+# Each of these can also have corresponding .rel.* and .rela.* sections.
+
+if test -n "$NOP"; then
+ FILL="=$NOP"
+else
+ FILL=
+fi
+
+test -n "$CREATE_SHLIB$CREATE_PIE" && CREATE_PIC=" "
+test -z "$RODATA_NAME" && RODATA_NAME=rodata
+test -z "$SDATA_NAME" && SDATA_NAME=sdata
+test -z "$SBSS_NAME" && SBSS_NAME=sbss
+test -z "$BSS_NAME" && BSS_NAME=bss
+test -z "$ENTRY" && ENTRY=${USER_LABEL_PREFIX}_start
+test -z "${BIG_OUTPUT_FORMAT}" && BIG_OUTPUT_FORMAT=${OUTPUT_FORMAT}
+test -z "${LITTLE_OUTPUT_FORMAT}" && LITTLE_OUTPUT_FORMAT=${OUTPUT_FORMAT}
+if [ -z "$MACHINE" ]; then OUTPUT_ARCH=${ARCH}; else OUTPUT_ARCH=${ARCH}:${MACHINE}; fi
+test -z "${ELFSIZE}" && ELFSIZE=32
+test -z "${ALIGNMENT}" && ALIGNMENT="${ELFSIZE} / 8"
+test "$LD_FLAG" = "N" && DATA_ADDR=.
+test -z "${ETEXT_NAME}" && ETEXT_NAME=${USER_LABEL_PREFIX}etext
+test -n "$RELRO_NOW" && unset SEPARATE_GOTPLT
+test -z "$ATTRS_SECTIONS" && ATTRS_SECTIONS=".gnu.attributes 0 : { KEEP (*(.gnu.attributes)) }"
+if test -z "$DATA_SEGMENT_ALIGN"; then
+ test -n "$CREATE_SHLIB$CREATE_PIE" && test -n "$SHLIB_DATA_ADDR" && COMMONPAGESIZE=""
+ test -z "$CREATE_SHLIB$CREATE_PIE" && test -n "$DATA_ADDR" && COMMONPAGESIZE=""
+ DATA_SEGMENT_ALIGN="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))"
+ DATA_SEGMENT_RELRO_END=""
+ DATA_SEGMENT_END=""
+ if test -n "${COMMONPAGESIZE}"; then
+ if test "${SEGMENT_SIZE}" != "${MAXPAGESIZE}"; then
+ DATA_SEGMENT_ALIGN="ALIGN (${SEGMENT_SIZE}) - ((${MAXPAGESIZE} - .) & (${MAXPAGESIZE} - 1)); . = DATA_SEGMENT_ALIGN (${MAXPAGESIZE}, ${COMMONPAGESIZE})"
+ else
+ DATA_SEGMENT_ALIGN="DATA_SEGMENT_ALIGN (${MAXPAGESIZE}, ${COMMONPAGESIZE})"
+ fi
+ DATA_SEGMENT_END=". = DATA_SEGMENT_END (.);"
+ DATA_SEGMENT_RELRO_END=". = DATA_SEGMENT_RELRO_END (${SEPARATE_GOTPLT-0}, .);"
+ fi
+fi
+if test -z "${INITIAL_READONLY_SECTIONS}${CREATE_SHLIB}"; then
+ INITIAL_READONLY_SECTIONS=".interp ${RELOCATING-0} : { *(.interp) }"
+fi
+if test -z "$PLT"; then
+ IPLT=".iplt ${RELOCATING-0} : { *(.iplt) }"
+ PLT=".plt ${RELOCATING-0} : { *(.plt)${RELOCATING+${IREL_IN_PLT+ *(.iplt)}} }
+ ${IREL_IN_PLT-$IPLT}"
+fi
+test -n "${DATA_PLT-${BSS_PLT-text}}" && TEXT_PLT=
+if test -z "$GOT"; then
+ if test -z "$SEPARATE_GOTPLT"; then
+ GOT=".got ${RELOCATING-0} : {${RELOCATING+ *(.got.plt) *(.igot.plt)} *(.got)${RELOCATING+ *(.igot)} }"
+ else
+ GOT=".got ${RELOCATING-0} : { *(.got)${RELOCATING+ *(.igot)} }"
+ GOTPLT=".got.plt ${RELOCATING-0} : { *(.got.plt)${RELOCATING+ *(.igot.plt)} }"
+ fi
+fi
+REL_IFUNC=".rel.ifunc ${RELOCATING-0} : { *(.rel.ifunc) }"
+RELA_IFUNC=".rela.ifunc ${RELOCATING-0} : { *(.rela.ifunc) }"
+REL_IPLT=".rel.iplt ${RELOCATING-0} :
+ {
+ ${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rel_iplt_start = .);}}
+ *(.rel.iplt)
+ ${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rel_iplt_end = .);}}
+ }"
+RELA_IPLT=".rela.iplt ${RELOCATING-0} :
+ {
+ ${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_start = .);}}
+ *(.rela.iplt)
+ ${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_end = .);}}
+ }"
+DYNAMIC=".dynamic ${RELOCATING-0} : { *(.dynamic) }"
+RODATA=".${RODATA_NAME} ${RELOCATING-0} : { *(.${RODATA_NAME}${RELOCATING+ .${RODATA_NAME}.* .gnu.linkonce.r.*}) }"
+DATARELRO=".data.rel.ro : { *(.data.rel.ro.local* .gnu.linkonce.d.rel.ro.local.*) *(.data.rel.ro .data.rel.ro.* .gnu.linkonce.d.rel.ro.*) }"
+DISCARDED="/DISCARD/ : { *(.note.GNU-stack) *(.gnu_debuglink) *(.gnu.lto_*) }"
+if test -z "${NO_SMALL_DATA}"; then
+ SBSS=".${SBSS_NAME} ${RELOCATING-0} :
+ {
+ ${RELOCATING+${SBSS_START_SYMBOLS}}
+ ${CREATE_SHLIB+*(.${SBSS_NAME}2 .${SBSS_NAME}2.* .gnu.linkonce.sb2.*)}
+ ${RELOCATING+*(.dyn${SBSS_NAME})}
+ *(.${SBSS_NAME}${RELOCATING+ .${SBSS_NAME}.* .gnu.linkonce.sb.*})
+ ${RELOCATING+*(.scommon)}
+ ${RELOCATING+${SBSS_END_SYMBOLS}}
+ }"
+ SBSS2=".${SBSS_NAME}2 ${RELOCATING-0} : { *(.${SBSS_NAME}2${RELOCATING+ .${SBSS_NAME}2.* .gnu.linkonce.sb2.*}) }"
+ SDATA="/* We want the small data sections together, so single-instruction offsets
+ can access them all, and initialized data all before uninitialized, so
+ we can shorten the on-disk segment size. */
+ .${SDATA_NAME} ${RELOCATING-0} :
+ {
+ ${RELOCATING+${SDATA_START_SYMBOLS}}
+ ${CREATE_SHLIB+*(.${SDATA_NAME}2 .${SDATA_NAME}2.* .gnu.linkonce.s2.*)}
+ *(.${SDATA_NAME}${RELOCATING+ .${SDATA_NAME}.* .gnu.linkonce.s.*})
+ }"
+ SDATA2=".${SDATA_NAME}2 ${RELOCATING-0} :
+ {
+ ${RELOCATING+${SDATA2_START_SYMBOLS}}
+ *(.${SDATA_NAME}2${RELOCATING+ .${SDATA_NAME}2.* .gnu.linkonce.s2.*})
+ }"
+ REL_SDATA=".rel.${SDATA_NAME} ${RELOCATING-0} : { *(.rel.${SDATA_NAME}${RELOCATING+ .rel.${SDATA_NAME}.* .rel.gnu.linkonce.s.*}) }
+ .rela.${SDATA_NAME} ${RELOCATING-0} : { *(.rela.${SDATA_NAME}${RELOCATING+ .rela.${SDATA_NAME}.* .rela.gnu.linkonce.s.*}) }"
+ REL_SBSS=".rel.${SBSS_NAME} ${RELOCATING-0} : { *(.rel.${SBSS_NAME}${RELOCATING+ .rel.${SBSS_NAME}.* .rel.gnu.linkonce.sb.*}) }
+ .rela.${SBSS_NAME} ${RELOCATING-0} : { *(.rela.${SBSS_NAME}${RELOCATING+ .rela.${SBSS_NAME}.* .rela.gnu.linkonce.sb.*}) }"
+ REL_SDATA2=".rel.${SDATA_NAME}2 ${RELOCATING-0} : { *(.rel.${SDATA_NAME}2${RELOCATING+ .rel.${SDATA_NAME}2.* .rel.gnu.linkonce.s2.*}) }
+ .rela.${SDATA_NAME}2 ${RELOCATING-0} : { *(.rela.${SDATA_NAME}2${RELOCATING+ .rela.${SDATA_NAME}2.* .rela.gnu.linkonce.s2.*}) }"
+ REL_SBSS2=".rel.${SBSS_NAME}2 ${RELOCATING-0} : { *(.rel.${SBSS_NAME}2${RELOCATING+ .rel.${SBSS_NAME}2.* .rel.gnu.linkonce.sb2.*}) }
+ .rela.${SBSS_NAME}2 ${RELOCATING-0} : { *(.rela.${SBSS_NAME}2${RELOCATING+ .rela.${SBSS_NAME}2.* .rela.gnu.linkonce.sb2.*}) }"
+else
+ NO_SMALL_DATA=" "
+fi
+if test -z "${SDATA_GOT}${DATA_GOT}"; then
+ if test -n "${NO_SMALL_DATA}"; then
+ DATA_GOT=" "
+ fi
+fi
+if test -z "${SDATA_GOT}${DATA_GOT}"; then
+ if test -z "${NO_SMALL_DATA}"; then
+ SDATA_GOT=" "
+ fi
+fi
+test -n "$SEPARATE_GOTPLT" && SEPARATE_GOTPLT=" "
+test "${LARGE_SECTIONS}" = "yes" && REL_LARGE="
+ .rel.ldata ${RELOCATING-0} : { *(.rel.ldata${RELOCATING+ .rel.ldata.* .rel.gnu.linkonce.l.*}) }
+ .rela.ldata ${RELOCATING-0} : { *(.rela.ldata${RELOCATING+ .rela.ldata.* .rela.gnu.linkonce.l.*}) }
+ .rel.lbss ${RELOCATING-0} : { *(.rel.lbss${RELOCATING+ .rel.lbss.* .rel.gnu.linkonce.lb.*}) }
+ .rela.lbss ${RELOCATING-0} : { *(.rela.lbss${RELOCATING+ .rela.lbss.* .rela.gnu.linkonce.lb.*}) }
+ .rel.lrodata ${RELOCATING-0} : { *(.rel.lrodata${RELOCATING+ .rel.lrodata.* .rel.gnu.linkonce.lr.*}) }
+ .rela.lrodata ${RELOCATING-0} : { *(.rela.lrodata${RELOCATING+ .rela.lrodata.* .rela.gnu.linkonce.lr.*}) }"
+test "${LARGE_SECTIONS}" = "yes" && LARGE_BSS="
+ .lbss ${RELOCATING-0} :
+ {
+ ${RELOCATING+*(.dynlbss)}
+ *(.lbss${RELOCATING+ .lbss.* .gnu.linkonce.lb.*})
+ ${RELOCATING+*(LARGE_COMMON)}
+ }"
+test "${LARGE_SECTIONS}" = "yes" && LARGE_SECTIONS="
+ .lrodata ${RELOCATING-0} ${RELOCATING+ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))} :
+ {
+ *(.lrodata${RELOCATING+ .lrodata.* .gnu.linkonce.lr.*})
+ }
+ .ldata ${RELOCATING-0} ${RELOCATING+ALIGN(${MAXPAGESIZE}) + (. & (${MAXPAGESIZE} - 1))} :
+ {
+ *(.ldata${RELOCATING+ .ldata.* .gnu.linkonce.l.*})
+ ${RELOCATING+. = ALIGN(. != 0 ? ${ALIGNMENT} : 1);}
+ }"
+if test "${ENABLE_INITFINI_ARRAY}" = "yes"; then
+ SORT_INIT_ARRAY="KEEP (*(SORT_BY_INIT_PRIORITY(.init_array.*) SORT_BY_INIT_PRIORITY(.ctors.*)))"
+ SORT_FINI_ARRAY="KEEP (*(SORT_BY_INIT_PRIORITY(.fini_array.*) SORT_BY_INIT_PRIORITY(.dtors.*)))"
+ CTORS_IN_INIT_ARRAY="EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors"
+ DTORS_IN_FINI_ARRAY="EXCLUDE_FILE (*crtbegin.o *crtbegin?.o *crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors"
+else
+ SORT_INIT_ARRAY="KEEP (*(SORT(.init_array.*)))"
+ SORT_FINI_ARRAY="KEEP (*(SORT(.fini_array.*)))"
+ CTORS_IN_INIT_ARRAY=
+ DTORS_IN_FINI_ARRAY=
+fi
+PREINIT_ARRAY=".preinit_array :
+ {
+ ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_start = .);}
+ KEEP (*(.preinit_array))
+ ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__preinit_array_end = .);}
+ }"
+INIT_ARRAY=".init_array :
+ {
+ ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_start = .);}
+ ${SORT_INIT_ARRAY}
+ KEEP (*(.init_array ${CTORS_IN_INIT_ARRAY}))
+ ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__init_array_end = .);}
+ }"
+FINI_ARRAY=".fini_array :
+ {
+ ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_start = .);}
+ ${SORT_FINI_ARRAY}
+ KEEP (*(.fini_array ${DTORS_IN_FINI_ARRAY}))
+ ${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__fini_array_end = .);}
+ }"
+CTOR=".ctors ${CONSTRUCTING-0} :
+ {
+ ${CONSTRUCTING+${CTOR_START}}
+ /* gcc uses crtbegin.o to find the start of
+ the constructors, so we make sure it is
+ first. Because this is a wildcard, it
+ doesn't matter if the user does not
+ actually link against crtbegin.o; the
+ linker won't look for a file to match a
+ wildcard. The wildcard also means that it
+ doesn't matter which directory crtbegin.o
+ is in. */
+
+ KEEP (*crtbegin.o(.ctors))
+ KEEP (*crtbegin?.o(.ctors))
+
+ /* We don't want to include the .ctor section from
+ the crtend.o file until after the sorted ctors.
+ The .ctor section from the crtend file contains the
+ end of ctors marker and it must be last */
+
+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .ctors))
+ KEEP (*(SORT(.ctors.*)))
+ KEEP (*(.ctors))
+ ${CONSTRUCTING+${CTOR_END}}
+ }"
+DTOR=".dtors ${CONSTRUCTING-0} :
+ {
+ ${CONSTRUCTING+${DTOR_START}}
+ KEEP (*crtbegin.o(.dtors))
+ KEEP (*crtbegin?.o(.dtors))
+ KEEP (*(EXCLUDE_FILE (*crtend.o *crtend?.o $OTHER_EXCLUDE_FILES) .dtors))
+ KEEP (*(SORT(.dtors.*)))
+ KEEP (*(.dtors))
+ ${CONSTRUCTING+${DTOR_END}}
+ }"
+STACK=".stack ${RELOCATING-0}${RELOCATING+${STACK_ADDR}} :
+ {
+ ${RELOCATING+${USER_LABEL_PREFIX}_stack = .;}
+ *(.stack)
+ ${RELOCATING+${STACK_SENTINEL}}
+ }"
+test "${HAVE_NOINIT}" = "yes" && NOINIT="
+ /* This section contains data that is not initialized during load,
+ or during the application's initialization sequence. */
+ .noinit (NOLOAD) :
+ {
+ ${RELOCATING+. = ALIGN(${ALIGNMENT});}
+ ${RELOCATING+PROVIDE (__noinit_start = .);}
+ *(.noinit${RELOCATING+ .noinit.* .gnu.linkonce.n.*})
+ ${RELOCATING+. = ALIGN(${ALIGNMENT});}
+ ${RELOCATING+PROVIDE (__noinit_end = .);}
+ }"
+test "${HAVE_PERSISTENT}" = "yes" && PERSISTENT="
+ /* This section contains data that is initialized during load,
+ but not during the application's initialization sequence. */
+ .persistent :
+ {
+ ${RELOCATING+. = ALIGN(${ALIGNMENT});}
+ ${RELOCATING+PROVIDE (__persistent_start = .);}
+ *(.persistent${RELOCATING+ .persistent.* .gnu.linkonce.p.*})
+ ${RELOCATING+. = ALIGN(${ALIGNMENT});}
+ ${RELOCATING+PROVIDE (__persistent_end = .);}
+ }"
+
+TEXT_START_ADDR="SEGMENT_START(\"text-segment\", ${TEXT_START_ADDR})"
+SHLIB_TEXT_START_ADDR="SEGMENT_START(\"text-segment\", ${SHLIB_TEXT_START_ADDR:-0})"
+
+# Don't bother with separate code segment when there are data sections
+# between .plt and .text.
+if test -z "$TINY_READONLY_SECTION"; then
+ case "$LD_FLAG" in
+ *textonly*)
+ SEPARATE_TEXT=" "
+ TEXT_SEGMENT_ALIGN=". = ALIGN(${MAXPAGESIZE});"
+ ;;
+ esac
+fi
+
+if [ -z "$SEPARATE_CODE" ]; then
+ SIZEOF_HEADERS_CODE=" + SIZEOF_HEADERS"
+else
+ SIZEOF_HEADERS_CODE=
+fi
+
+# If this is for an embedded system, don't add SIZEOF_HEADERS.
+if [ -z "$EMBEDDED" ]; then
+ test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}${SIZEOF_HEADERS_CODE}"
+else
+ test -z "${TEXT_BASE_ADDRESS}" && TEXT_BASE_ADDRESS="${TEXT_START_ADDR}"
+fi
+
+cat <<EOF
+/* Copyright (C) 2014-2021 Free Software Foundation, Inc.
+
+ Copying and distribution of this script, with or without modification,
+ are permitted in any medium without royalty provided the copyright
+ notice and this notice are preserved. */
+
+OUTPUT_FORMAT("${OUTPUT_FORMAT}", "${BIG_OUTPUT_FORMAT}",
+ "${LITTLE_OUTPUT_FORMAT}")
+OUTPUT_ARCH(${OUTPUT_ARCH})
+${RELOCATING+ENTRY(${ENTRY})}
+
+${RELOCATING+${LIB_SEARCH_DIRS}}
+${RELOCATING+${CREATE_SHLIB-${EXECUTABLE_SYMBOLS}}}
+${RELOCATING+${INPUT_FILES}}
+${RELOCATING- /* For some reason, the Solaris linker makes bad executables
+ if gld -r is used and the intermediate file has sections starting
+ at non-zero addresses. Could be a Solaris ld bug, could be a GNU ld
+ bug. But for now assigning the zero vmas works. */}
+
+SECTIONS
+{
+ ${RELOCATING+${SEPARATE_TEXT-/* Read-only sections, merged into text segment: */}}
+ ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+PROVIDE (__executable_start = ${TEXT_START_ADDR}); . = ${TEXT_BASE_ADDRESS};}}}
+ ${CREATE_SHLIB+${RELOCATING+. = ${SHLIB_TEXT_START_ADDR}${SIZEOF_HEADERS_CODE};}}
+ ${CREATE_PIE+${RELOCATING+PROVIDE (__executable_start = ${SHLIB_TEXT_START_ADDR}); . = ${SHLIB_TEXT_START_ADDR}${SIZEOF_HEADERS_CODE};}}
+EOF
+
+emit_early_ro()
+{
+ cat <<EOF
+ ${INITIAL_READONLY_SECTIONS}
+ .note.gnu.build-id ${RELOCATING-0}: { *(.note.gnu.build-id) }
+EOF
+}
+
+test -n "${SEPARATE_CODE}" || emit_early_ro
+
+test -n "${RELOCATING+0}" || unset NON_ALLOC_DYN
+test -z "${NON_ALLOC_DYN}" || TEXT_DYNAMIC=
+cat > ldscripts/dyntmp.$$ <<EOF
+ ${TEXT_DYNAMIC+${DYNAMIC}}
+ .hash ${RELOCATING-0} : { *(.hash) }
+ .gnu.hash ${RELOCATING-0} : { *(.gnu.hash) }
+ .dynsym ${RELOCATING-0} : { *(.dynsym) }
+ .dynstr ${RELOCATING-0} : { *(.dynstr) }
+ .gnu.version ${RELOCATING-0} : { *(.gnu.version) }
+ .gnu.version_d ${RELOCATING-0}: { *(.gnu.version_d) }
+ .gnu.version_r ${RELOCATING-0}: { *(.gnu.version_r) }
+EOF
+
+if [ "x$COMBRELOC" = x ]; then
+ COMBRELOCCAT="cat >> ldscripts/dyntmp.$$"
+else
+ COMBRELOCCAT="cat > $COMBRELOC"
+fi
+eval $COMBRELOCCAT <<EOF
+ ${INITIAL_RELOC_SECTIONS}
+ .rel.init ${RELOCATING-0} : { *(.rel.init) }
+ .rela.init ${RELOCATING-0} : { *(.rela.init) }
+ .rel.text ${RELOCATING-0} : { *(.rel.text${RELOCATING+ .rel.text.* .rel.gnu.linkonce.t.*}) }
+ .rela.text ${RELOCATING-0} : { *(.rela.text${RELOCATING+ .rela.text.* .rela.gnu.linkonce.t.*}) }
+ .rel.fini ${RELOCATING-0} : { *(.rel.fini) }
+ .rela.fini ${RELOCATING-0} : { *(.rela.fini) }
+
+ /* PSP-specific relocations. */
+ .rel.sceStub.text ${RELOCATING-0} : { *(.rel.sceStub.text) *(SORT(.rel.sceStub.text.*)) }
+ .rel.lib.ent.top ${RELOCATING-0} : { *(.rel.lib.ent.top) }
+ .rel.lib.ent ${RELOCATING-0} : { *(.rel.lib.ent) }
+ .rel.lib.ent.btm ${RELOCATING-0} : { *(.rel.lib.ent.btm) }
+ .rel.lib.stub.top ${RELOCATING-0} : { *(.rel.lib.stub.top) }
+ .rel.lib.stub ${RELOCATING-0} : { *(.rel.lib.stub) }
+ .rel.lib.stub.btm ${RELOCATING-0} : { *(.rel.lib.stub.btm) }
+ .rel.rodata.sceModuleInfo ${RELOCATING-0} : { *(.rel.rodata.sceModuleInfo) }
+ .rel.rodata.sceResident ${RELOCATING-0} : { *(.rel.rodata.sceResident) }
+ .rel.rodata.sceNid ${RELOCATING-0} : { *(.rel.rodata.sceNid) }
+ .rel.rodata.sceVstub ${RELOCATING-0} : { *(.rel.rodata.sceVstub) *(SORT(.rel.rodata.sceVstub.*)) }
+
+ .rel.${RODATA_NAME} ${RELOCATING-0} : { *(.rel.${RODATA_NAME}${RELOCATING+ .rel.${RODATA_NAME}.* .rel.gnu.linkonce.r.*}) }
+ .rela.${RODATA_NAME} ${RELOCATING-0} : { *(.rela.${RODATA_NAME}${RELOCATING+ .rela.${RODATA_NAME}.* .rela.gnu.linkonce.r.*}) }
+ ${OTHER_READONLY_RELOC_SECTIONS}
+ .rel.data.rel.ro ${RELOCATING-0} : { *(.rel.data.rel.ro${RELOCATING+ .rel.data.rel.ro.* .rel.gnu.linkonce.d.rel.ro.*}) }
+ .rela.data.rel.ro ${RELOCATING-0} : { *(.rela.data.rel.ro${RELOCATING+ .rela.data.rel.ro.* .rela.gnu.linkonce.d.rel.ro.*}) }
+ .rel.data ${RELOCATING-0} : { *(.rel.data${RELOCATING+ .rel.data.* .rel.gnu.linkonce.d.*}) }
+ .rela.data ${RELOCATING-0} : { *(.rela.data${RELOCATING+ .rela.data.* .rela.gnu.linkonce.d.*}) }
+ ${OTHER_READWRITE_RELOC_SECTIONS}
+ .rel.tdata ${RELOCATING-0} : { *(.rel.tdata${RELOCATING+ .rel.tdata.* .rel.gnu.linkonce.td.*}) }
+ .rela.tdata ${RELOCATING-0} : { *(.rela.tdata${RELOCATING+ .rela.tdata.* .rela.gnu.linkonce.td.*}) }
+ .rel.tbss ${RELOCATING-0} : { *(.rel.tbss${RELOCATING+ .rel.tbss.* .rel.gnu.linkonce.tb.*}) }
+ .rela.tbss ${RELOCATING-0} : { *(.rela.tbss${RELOCATING+ .rela.tbss.* .rela.gnu.linkonce.tb.*}) }
+ .rel.ctors ${RELOCATING-0} : { *(.rel.ctors) }
+ .rela.ctors ${RELOCATING-0} : { *(.rela.ctors) }
+ .rel.dtors ${RELOCATING-0} : { *(.rel.dtors) }
+ .rela.dtors ${RELOCATING-0} : { *(.rela.dtors) }
+ .rel.got ${RELOCATING-0} : { *(.rel.got) }
+ .rela.got ${RELOCATING-0} : { *(.rela.got) }
+ ${OTHER_GOT_RELOC_SECTIONS}
+ ${REL_SDATA}
+ ${REL_SBSS}
+ ${REL_SDATA2}
+ ${REL_SBSS2}
+ .rel.${BSS_NAME} ${RELOCATING-0} : { *(.rel.${BSS_NAME}${RELOCATING+ .rel.${BSS_NAME}.* .rel.gnu.linkonce.b.*}) }
+ .rela.${BSS_NAME} ${RELOCATING-0} : { *(.rela.${BSS_NAME}${RELOCATING+ .rela.${BSS_NAME}.* .rela.gnu.linkonce.b.*}) }
+ ${REL_LARGE}
+ ${IREL_IN_PLT+$REL_IFUNC}
+ ${IREL_IN_PLT+$RELA_IFUNC}
+ ${IREL_IN_PLT-$REL_IPLT}
+ ${IREL_IN_PLT-$RELA_IPLT}
+EOF
+
+if [ -n "$COMBRELOC" ]; then
+cat >> ldscripts/dyntmp.$$ <<EOF
+ .rel.dyn ${RELOCATING-0} :
+ {
+EOF
+sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rela\./d;/__rela_iplt_/d;s/^.*: { *\(.*\)}$/ \1/' $COMBRELOC >> ldscripts/dyntmp.$$
+cat >> ldscripts/dyntmp.$$ <<EOF
+ }
+ .rela.dyn ${RELOCATING-0} :
+ {
+EOF
+sed -e '/^[ ]*[{}][ ]*$/d;/:[ ]*$/d;/\.rel\./d;/__rel_iplt_/d;s/^.*: { *\(.*\)}/ \1/' $COMBRELOC >> ldscripts/dyntmp.$$
+cat >> ldscripts/dyntmp.$$ <<EOF
+ }
+EOF
+fi
+
+cat >> ldscripts/dyntmp.$$ <<EOF
+ .rel.plt ${RELOCATING-0} :
+ {
+ *(.rel.plt)
+ ${IREL_IN_PLT+${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rel_iplt_start = .);}}}
+ ${IREL_IN_PLT+${RELOCATING+*(.rel.iplt)}}
+ ${IREL_IN_PLT+${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rel_iplt_end = .);}}}
+ }
+ .rela.plt ${RELOCATING-0} :
+ {
+ *(.rela.plt)
+ ${IREL_IN_PLT+${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_start = .);}}}
+ ${IREL_IN_PLT+${RELOCATING+*(.rela.iplt)}}
+ ${IREL_IN_PLT+${RELOCATING+${CREATE_PIC-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__rela_iplt_end = .);}}}
+ }
+ ${OTHER_PLT_RELOC_SECTIONS}
+EOF
+
+emit_dyn()
+{
+ if test -z "${NO_REL_RELOCS}${NO_RELA_RELOCS}"; then
+ cat ldscripts/dyntmp.$$
+ else
+ if test -z "${NO_REL_RELOCS}"; then
+ sed -e '/^[ ]*\.rela\.[^}]*$/,/}/d;/^[ ]*\.rela\./d;/__rela_iplt_/d' ldscripts/dyntmp.$$
+ fi
+ if test -z "${NO_RELA_RELOCS}"; then
+ sed -e '/^[ ]*\.rel\.[^}]*$/,/}/d;/^[ ]*\.rel\./d;/__rel_iplt_/d' ldscripts/dyntmp.$$
+ fi
+ fi
+ rm -f ldscripts/dyntmp.$$
+}
+
+test -n "${NON_ALLOC_DYN}${SEPARATE_CODE}" || emit_dyn
+
+cat <<EOF
+ ${RELOCATING+${TEXT_SEGMENT_ALIGN}}
+
+ .init ${RELOCATING-0}${RELOCATING+${INIT_ADDR}} :
+ {
+ ${RELOCATING+${INIT_START}}
+ KEEP (*(SORT_NONE(.init)))
+ ${RELOCATING+${INIT_END}}
+ } ${FILL}
+
+ ${TEXT_PLT+${PLT_NEXT_DATA-${PLT} ${OTHER_PLT_SECTIONS}}}
+ ${TINY_READONLY_SECTION}
+ .text ${RELOCATING-0} :
+ {
+ ${RELOCATING+${TEXT_START_SYMBOLS}}
+ ${RELOCATING+*(.text.unlikely .text.*_unlikely .text.unlikely.*)}
+ ${RELOCATING+*(.text.exit .text.exit.*)}
+ ${RELOCATING+*(.text.startup .text.startup.*)}
+ ${RELOCATING+*(.text.hot .text.hot.*)}
+ ${RELOCATING+*(SORT(.text.sorted.*))}
+ *(.text .stub${RELOCATING+ .text.* .gnu.linkonce.t.*})
+ /* .gnu.warning sections are handled specially by elf.em. */
+ *(.gnu.warning)
+ ${RELOCATING+${OTHER_TEXT_SECTIONS}}
+ } ${FILL}
+ .fini ${RELOCATING-0}${RELOCATING+${FINI_ADDR}} :
+ {
+ ${RELOCATING+${FINI_START}}
+ KEEP (*(SORT_NONE(.fini)))
+ ${RELOCATING+${FINI_END}}
+ } ${FILL}
+
+ /* PSP library stub functions. */
+ .sceStub.text ${RELOCATING-0} : { *(.sceStub.text) *(SORT(.sceStub.text.*)) }
+
+ ${RELOCATING+${ETEXT_LAST_IN_RODATA_SEGMENT-PROVIDE (__${ETEXT_NAME} = .);}}
+ ${RELOCATING+${ETEXT_LAST_IN_RODATA_SEGMENT-PROVIDE (_${ETEXT_NAME} = .);}}
+ ${RELOCATING+${ETEXT_LAST_IN_RODATA_SEGMENT-PROVIDE (${ETEXT_NAME} = .);}}
+ ${RELOCATING+${TEXT_SEGMENT_ALIGN}}
+
+ /* PSP library entry table and library stub table. */
+ .lib.ent.top ${RELOCATING-0} : { *(.lib.ent.top) }
+ .lib.ent ${RELOCATING-0} : { *(.lib.ent) }
+ .lib.ent.btm ${RELOCATING-0} : { *(.lib.ent.btm) }
+
+ .lib.stub.top ${RELOCATING-0} : { *(.lib.stub.top) }
+ .lib.stub ${RELOCATING-0} : { *(.lib.stub) }
+ .lib.stub.btm ${RELOCATING-0} : { *(.lib.stub.btm) }
+
+ /* PSP read-only data for module info, NIDs, and Vstubs. The
+ .rodata.sceModuleInfo section must appear before the .rodata section
+ otherwise it would get absorbed into .rodata and the PSP bootloader
+ would be unable to locate the module info structure. */
+ .rodata.sceModuleInfo ${RELOCATING-0} : { *(.rodata.sceModuleInfo) }
+ .rodata.sceResident ${RELOCATING-0} : { *(.rodata.sceResident) }
+ .rodata.sceNid ${RELOCATING-0} : { *(.rodata.sceNid) }
+ .rodata.sceVstub ${RELOCATING-0} : { *(.rodata.sceVstub) *(SORT(.rodata.sceVstub.*)) }
+EOF
+
+if test -n "${SEPARATE_CODE}${SEPARATE_TEXT}"; then
+ if test -n "${RODATA_ADDR}"; then
+ RODATA_ADDR="\
+SEGMENT_START(\"rodata-segment\", ${RODATA_ADDR}) + SIZEOF_HEADERS"
+ else
+ RODATA_ADDR="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))"
+ RODATA_ADDR="SEGMENT_START(\"rodata-segment\", ${RODATA_ADDR})"
+ fi
+ if test -n "${SHLIB_RODATA_ADDR}"; then
+ SHLIB_RODATA_ADDR="\
+SEGMENT_START(\"rodata-segment\", ${SHLIB_RODATA_ADDR}) + SIZEOF_HEADERS"
+ else
+ SHLIB_RODATA_ADDR="ALIGN(${SEGMENT_SIZE}) + (. & (${MAXPAGESIZE} - 1))"
+ SHLIB_RODATA_ADDR="SEGMENT_START(\"rodata-segment\", ${SHLIB_RODATA_ADDR})"
+ fi
+ cat <<EOF
+ ${RELOCATING+/* Adjust the address for the rodata segment. We want to adjust up to
+ the same address within the page on the next page up. */
+ ${CREATE_SHLIB-${CREATE_PIE-. = ${RODATA_ADDR};}}
+ ${CREATE_SHLIB+. = ${SHLIB_RODATA_ADDR};}
+ ${CREATE_PIE+. = ${SHLIB_RODATA_ADDR};}}
+EOF
+ if test -n "${SEPARATE_CODE}"; then
+ emit_early_ro
+ emit_dyn
+ fi
+fi
+
+cat <<EOF
+ ${WRITABLE_RODATA-${RODATA}}
+ .${RODATA_NAME}1 ${RELOCATING-0} : { *(.${RODATA_NAME}1) }
+ ${CREATE_SHLIB-${SDATA2}}
+ ${CREATE_SHLIB-${SBSS2}}
+ ${OTHER_READONLY_SECTIONS}
+ .eh_frame_hdr ${RELOCATING-0} : { *(.eh_frame_hdr)${RELOCATING+ *(.eh_frame_entry .eh_frame_entry.*)} }
+ .eh_frame ${RELOCATING-0} : ONLY_IF_RO { KEEP (*(.eh_frame))${RELOCATING+ *(.eh_frame.*)} }
+ .gcc_except_table ${RELOCATING-0} : ONLY_IF_RO { *(.gcc_except_table${RELOCATING+ .gcc_except_table.*}) }
+ .gnu_extab ${RELOCATING-0} : ONLY_IF_RO { *(.gnu_extab*) }
+ /* These sections are generated by the Sun/Oracle C++ compiler. */
+ .exception_ranges ${RELOCATING-0} : ONLY_IF_RO { *(.exception_ranges${RELOCATING+*}) }
+ ${TEXT_PLT+${PLT_NEXT_DATA+${PLT} ${OTHER_PLT_SECTIONS}}}
+
+ ${RELOCATING+${ETEXT_LAST_IN_RODATA_SEGMENT+PROVIDE (__${ETEXT_NAME} = .);}}
+ ${RELOCATING+${ETEXT_LAST_IN_RODATA_SEGMENT+PROVIDE (_${ETEXT_NAME} = .);}}
+ ${RELOCATING+${ETEXT_LAST_IN_RODATA_SEGMENT+PROVIDE (${ETEXT_NAME} = .);}}
+
+ ${RELOCATING+/* Adjust the address for the data segment. We want to adjust up to
+ the same address within the page on the next page up. */}
+ ${CREATE_SHLIB-${CREATE_PIE-${RELOCATING+. = ${DATA_ADDR-${DATA_SEGMENT_ALIGN}};}}}
+ ${CREATE_SHLIB+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}
+ ${CREATE_PIE+. = ${SHLIB_DATA_ADDR-${DATA_SEGMENT_ALIGN}};}
+
+ /* Exception handling */
+ .eh_frame ${RELOCATING-0} : ONLY_IF_RW { KEEP (*(.eh_frame))${RELOCATING+ *(.eh_frame.*)} }
+ .gnu_extab ${RELOCATING-0} : ONLY_IF_RW { *(.gnu_extab) }
+ .gcc_except_table ${RELOCATING-0} : ONLY_IF_RW { *(.gcc_except_table${RELOCATING+ .gcc_except_table.*}) }
+ .exception_ranges ${RELOCATING-0} : ONLY_IF_RW { *(.exception_ranges${RELOCATING+*}) }
+
+ /* Thread Local Storage sections */
+ .tdata ${RELOCATING-0} :
+ {
+ ${RELOCATING+${CREATE_SHLIB-PROVIDE_HIDDEN (${USER_LABEL_PREFIX}__tdata_start = .);}}
+ *(.tdata${RELOCATING+ .tdata.* .gnu.linkonce.td.*})
+ }
+ .tbss ${RELOCATING-0} : { *(.tbss${RELOCATING+ .tbss.* .gnu.linkonce.tb.*})${RELOCATING+ *(.tcommon)} }
+
+ ${RELOCATING+${PREINIT_ARRAY}}
+ ${RELOCATING+${INIT_ARRAY}}
+ ${RELOCATING+${FINI_ARRAY}}
+ ${SMALL_DATA_CTOR-${RELOCATING+${CTOR}}}
+ ${SMALL_DATA_DTOR-${RELOCATING+${DTOR}}}
+ .jcr ${RELOCATING-0} : { KEEP (*(.jcr)) }
+
+ ${RELOCATING+${DATARELRO}}
+ ${OTHER_RELRO_SECTIONS}
+ ${TEXT_DYNAMIC-${DYNAMIC}}
+ ${OTHER_RELRO_SECTIONS_2}
+ ${DATA_GOT+${RELRO_NOW+${DATA_PLT+${PLT_BEFORE_GOT+${PLT}}}}}
+ ${DATA_GOT+${RELRO_NOW+${GOT}}}
+ ${DATA_GOT+${RELRO_NOW+${GOTPLT}}}
+ ${DATA_GOT+${RELRO_NOW-${SEPARATE_GOTPLT+${GOT}}}}
+ ${RELOCATING+${DATA_SEGMENT_RELRO_END}}
+ ${INITIAL_READWRITE_SECTIONS}
+ ${DATA_SDATA+${SDATA}}
+ ${DATA_SDATA+${OTHER_SDATA_SECTIONS}}
+ ${DATA_SDATA+${SBSS}}
+ ${DATA_GOT+${RELRO_NOW-${DATA_PLT+${PLT_BEFORE_GOT+${PLT}}}}}
+ ${DATA_GOT+${RELRO_NOW-${SEPARATE_GOTPLT-${GOT}}}}
+ ${DATA_GOT+${RELRO_NOW-${GOTPLT}}}
+
+ ${DATA_PLT+${PLT_BEFORE_GOT-${PLT}}}
+
+ .data ${RELOCATING-0} :
+ {
+ ${RELOCATING+${DATA_START_SYMBOLS}}
+ *(.data${RELOCATING+ .data.* .gnu.linkonce.d.*})
+ ${CONSTRUCTING+SORT(CONSTRUCTORS)}
+ }
+ .data1 ${RELOCATING-0} : { *(.data1) }
+ ${WRITABLE_RODATA+${RODATA}}
+ ${OTHER_READWRITE_SECTIONS}
+ ${SMALL_DATA_CTOR+${RELOCATING+${CTOR}}}
+ ${SMALL_DATA_DTOR+${RELOCATING+${DTOR}}}
+ ${SDATA_GOT+${DATA_PLT+${PLT_BEFORE_GOT+${PLT}}}}
+ ${SDATA_GOT+${RELOCATING+${OTHER_GOT_SYMBOLS+. = .; ${OTHER_GOT_SYMBOLS}}}}
+ ${SDATA_GOT+${GOT}}
+ ${SDATA_GOT+${OTHER_GOT_SECTIONS}}
+ ${DATA_SDATA-${SDATA}}
+ ${DATA_SDATA-${OTHER_SDATA_SECTIONS}}
+ ${RELOCATING+${DATA_END_SYMBOLS-${CREATE_SHLIB+PROVIDE (}${USER_LABEL_PREFIX}_edata = .${CREATE_SHLIB+)}; PROVIDE (${USER_LABEL_PREFIX}edata = .);}}
+ ${PERSISTENT}
+ ${RELOCATING+. = .;}
+ ${RELOCATING+${CREATE_SHLIB+PROVIDE (}${USER_LABEL_PREFIX}__bss_start = .${CREATE_SHLIB+)};}
+ ${RELOCATING+${OTHER_BSS_SYMBOLS}}
+ ${DATA_SDATA-${SBSS}}
+ ${BSS_PLT+${PLT}}
+ .${BSS_NAME} ${RELOCATING-0} :
+ {
+ ${RELOCATING+*(.dynbss)}
+ *(.${BSS_NAME}${RELOCATING+ .${BSS_NAME}.* .gnu.linkonce.b.*})
+ ${RELOCATING+*(COMMON)
+ /* Align here to ensure that the .bss section occupies space up to
+ _end. Align after .bss to ensure correct alignment even if the
+ .bss section disappears because there are no input sections.
+ FIXME: Why do we need it? When there is no .bss section, we do not
+ pad the .data section. */
+ . = ALIGN(. != 0 ? ${ALIGNMENT} : 1);}
+ }
+ ${OTHER_BSS_SECTIONS}
+ ${LARGE_BSS_AFTER_BSS+${LARGE_BSS}}
+ ${RELOCATING+${OTHER_BSS_END_SYMBOLS}}
+ ${NOINIT}
+ ${RELOCATING+. = ALIGN(${ALIGNMENT});}
+EOF
+
+LARGE_DATA_ADDR=". = SEGMENT_START(\"ldata-segment\", ${LARGE_DATA_ADDR-.});"
+SHLIB_LARGE_DATA_ADDR=". = SEGMENT_START(\"ldata-segment\", ${SHLIB_LARGE_DATA_ADDR-.});"
+
+cat <<EOF
+ ${RELOCATING+${CREATE_SHLIB-${CREATE_PIE-${LARGE_DATA_ADDR}}}}
+ ${CREATE_SHLIB+${SHLIB_LARGE_DATA_ADDR}}
+ ${CREATE_PIE+${SHLIB_LARGE_DATA_ADDR}}
+ ${LARGE_SECTIONS}
+ ${LARGE_BSS_AFTER_BSS-${LARGE_BSS}}
+ ${RELOCATING+. = ALIGN(${ALIGNMENT});}
+ ${RELOCATING+${OTHER_END_SYMBOLS}}
+ ${RELOCATING+${END_SYMBOLS-${CREATE_SHLIB+PROVIDE (}${USER_LABEL_PREFIX}_end = .${CREATE_SHLIB+)}; PROVIDE (${USER_LABEL_PREFIX}end = .);}}
+ ${RELOCATING+${DATA_SEGMENT_END}}
+ ${TINY_DATA_SECTION}
+ ${TINY_BSS_SECTION}
+ ${STACK_ADDR+${STACK}}
+EOF
+
+test -z "${NON_ALLOC_DYN}" || emit_dyn
+
+cat <<EOF
+ /* Stabs debugging sections. */
+ .stab 0 : { *(.stab) }
+ .stabstr 0 : { *(.stabstr) }
+ .stab.excl 0 : { *(.stab.excl) }
+ .stab.exclstr 0 : { *(.stab.exclstr) }
+ .stab.index 0 : { *(.stab.index) }
+ .stab.indexstr 0 : { *(.stab.indexstr) }
+
+ .comment 0 : { *(.comment) }
+
+ .gnu.build.attributes : { *(.gnu.build.attributes${RELOCATING+ .gnu.build.attributes.*}) }
+
+EOF
+
+. $srcdir/scripttempl/DWARF.sc
+
+cat <<EOF
+ ${ATTRS_SECTIONS}
+ ${OTHER_SECTIONS}
+ ${RELOCATING+${OTHER_SYMBOLS}}
+ ${RELOCATING+${DISCARDED}}
+}
+EOF
diff --git a/opcodes/mips-dis.c b/opcodes/mips-dis.c
index c0e3509a..a2f9108a 100644
--- a/opcodes/mips-dis.c
+++ b/opcodes/mips-dis.c
@@ -230,6 +230,150 @@ static const char * const mips_cp1_names_mips3264[32] =
"c1_fenr", "$29", "$30", "c1_fcsr"
};
+static const char * const vfpu_sreg_names[128] = {
+ "000", "010", "020", "030", "100", "110", "120", "130",
+ "200", "210", "220", "230", "300", "310", "320", "330",
+ "400", "410", "420", "430", "500", "510", "520", "530",
+ "600", "610", "620", "630", "700", "710", "720", "730",
+ "001", "011", "021", "031", "101", "111", "121", "131",
+ "201", "211", "221", "231", "301", "311", "321", "331",
+ "401", "411", "421", "431", "501", "511", "521", "531",
+ "601", "611", "621", "631", "701", "711", "721", "731",
+ "002", "012", "022", "032", "102", "112", "122", "132",
+ "202", "212", "222", "232", "302", "312", "322", "332",
+ "402", "412", "422", "432", "502", "512", "522", "532",
+ "602", "612", "622", "632", "702", "712", "722", "732",
+ "003", "013", "023", "033", "103", "113", "123", "133",
+ "203", "213", "223", "233", "303", "313", "323", "333",
+ "403", "413", "423", "433", "503", "513", "523", "533",
+ "603", "613", "623", "633", "703", "713", "723", "733"
+};
+
+static const char * const vfpu_vpreg_names[128] = {
+ "000", "010", "020", "030", "100", "110", "120", "130",
+ "200", "210", "220", "230", "300", "310", "320", "330",
+ "400", "410", "420", "430", "500", "510", "520", "530",
+ "600", "610", "620", "630", "700", "710", "720", "730",
+ "000", "001", "002", "003", "100", "101", "102", "103",
+ "200", "201", "202", "203", "300", "301", "302", "303",
+ "400", "401", "402", "403", "500", "501", "502", "503",
+ "600", "601", "602", "603", "700", "701", "702", "703",
+ "002", "012", "022", "032", "102", "112", "122", "132",
+ "202", "212", "222", "232", "302", "312", "322", "332",
+ "402", "412", "422", "432", "502", "512", "522", "532",
+ "602", "612", "622", "632", "702", "712", "722", "732",
+ "020", "021", "022", "023", "120", "121", "122", "123",
+ "220", "221", "222", "223", "320", "321", "322", "323",
+ "420", "421", "422", "423", "520", "521", "522", "523",
+ "620", "621", "622", "623", "720", "721", "722", "723"
+};
+
+static const char * const vfpu_vtreg_names[128] = {
+ "000", "010", "020", "030", "100", "110", "120", "130",
+ "200", "210", "220", "230", "300", "310", "320", "330",
+ "400", "410", "420", "430", "500", "510", "520", "530",
+ "600", "610", "620", "630", "700", "710", "720", "730",
+ "000", "001", "002", "003", "100", "101", "102", "103",
+ "200", "201", "202", "203", "300", "301", "302", "303",
+ "400", "401", "402", "403", "500", "501", "502", "503",
+ "600", "601", "602", "603", "700", "701", "702", "703",
+ "001", "011", "021", "031", "101", "111", "121", "131",
+ "201", "211", "221", "231", "301", "311", "321", "331",
+ "401", "411", "421", "431", "501", "511", "521", "531",
+ "601", "611", "621", "631", "701", "711", "721", "731",
+ "010", "011", "012", "013", "110", "111", "112", "113",
+ "210", "211", "212", "213", "310", "311", "312", "313",
+ "410", "411", "412", "413", "510", "511", "512", "513",
+ "610", "611", "612", "613", "710", "711", "712", "713"
+};
+
+static const char * const vfpu_vqreg_names[128] = {
+ "000", "010", "020", "030", "100", "110", "120", "130",
+ "200", "210", "220", "230", "300", "310", "320", "330",
+ "400", "410", "420", "430", "500", "510", "520", "530",
+ "600", "610", "620", "630", "700", "710", "720", "730",
+ "000", "001", "002", "003", "100", "101", "102", "103",
+ "200", "201", "202", "203", "300", "301", "302", "303",
+ "400", "401", "402", "403", "500", "501", "502", "503",
+ "600", "601", "602", "603", "700", "701", "702", "703",
+ "???", "???", "???", "???", "???", "???", "???", "???",
+ "???", "???", "???", "???", "???", "???", "???", "???",
+ "???", "???", "???", "???", "???", "???", "???", "???",
+ "???", "???", "???", "???", "???", "???", "???", "???",
+ "???", "???", "???", "???", "???", "???", "???", "???",
+ "???", "???", "???", "???", "???", "???", "???", "???",
+ "???", "???", "???", "???", "???", "???", "???", "???",
+ "???", "???", "???", "???", "???", "???", "???", "???"
+};
+
+static const char * const vfpu_mpreg_names[128] = {
+ "000", "???", "020", "???", "100", "???", "120", "???",
+ "200", "???", "220", "???", "300", "???", "320", "???",
+ "400", "???", "420", "???", "500", "???", "520", "???",
+ "600", "???", "620", "???", "700", "???", "720", "???",
+ "000", "???", "002", "???", "100", "???", "102", "???",
+ "200", "???", "202", "???", "300", "???", "302", "???",
+ "400", "???", "402", "???", "500", "???", "502", "???",
+ "600", "???", "602", "???", "700", "???", "702", "???",
+ "002", "???", "022", "???", "102", "???", "122", "???",
+ "202", "???", "222", "???", "302", "???", "322", "???",
+ "402", "???", "422", "???", "502", "???", "522", "???",
+ "602", "???", "622", "???", "702", "???", "722", "???",
+ "020", "???", "022", "???", "120", "???", "122", "???",
+ "220", "???", "222", "???", "320", "???", "322", "???",
+ "420", "???", "422", "???", "520", "???", "522", "???",
+ "620", "???", "622", "???", "720", "???", "722", "???"
+};
+
+static const char * const vfpu_mtreg_names[128] = {
+ "000", "010", "???", "???", "100", "110", "???", "???",
+ "200", "210", "???", "???", "300", "310", "???", "???",
+ "400", "410", "???", "???", "500", "510", "???", "???",
+ "600", "610", "???", "???", "700", "710", "???", "???",
+ "000", "001", "???", "???", "100", "101", "???", "???",
+ "200", "201", "???", "???", "300", "301", "???", "???",
+ "400", "401", "???", "???", "500", "501", "???", "???",
+ "600", "601", "???", "???", "700", "701", "???", "???",
+ "001", "011", "???", "???", "101", "111", "???", "???",
+ "201", "211", "???", "???", "301", "311", "???", "???",
+ "401", "411", "???", "???", "501", "511", "???", "???",
+ "601", "611", "???", "???", "701", "711", "???", "???",
+ "010", "011", "???", "???", "110", "111", "???", "???",
+ "210", "211", "???", "???", "310", "311", "???", "???",
+ "410", "411", "???", "???", "510", "511", "???", "???",
+ "610", "611", "???", "???", "710", "711", "???", "???"
+};
+
+static const char * const vfpu_mqreg_names[128] = {
+ "000", "???", "???", "???", "100", "???", "???", "???",
+ "200", "???", "???", "???", "300", "???", "???", "???",
+ "400", "???", "???", "???", "500", "???", "???", "???",
+ "600", "???", "???", "???", "700", "???", "???", "???",
+ "000", "???", "???", "???", "100", "???", "???", "???",
+ "200", "???", "???", "???", "300", "???", "???", "???",
+ "400", "???", "???", "???", "500", "???", "???", "???",
+ "600", "???", "???", "???", "700", "???", "???", "???",
+ "???", "???", "???", "???", "???", "???", "???", "???",
+ "???", "???", "???", "???", "???", "???", "???", "???",
+ "???", "???", "???", "???", "???", "???", "???", "???",
+ "???", "???", "???", "???", "???", "???", "???", "???",
+ "???", "???", "???", "???", "???", "???", "???", "???",
+ "???", "???", "???", "???", "???", "???", "???", "???",
+ "???", "???", "???", "???", "???", "???", "???", "???",
+ "???", "???", "???", "???", "???", "???", "???", "???"
+};
+
+static const char * const * const vfpu_regnums[] = {
+ vfpu_sreg_names,
+ vfpu_vpreg_names,
+ vfpu_vtreg_names,
+ vfpu_vqreg_names,
+ vfpu_mpreg_names,
+ vfpu_mtreg_names,
+ vfpu_mqreg_names
+};
+
+
static const struct mips_cp0sel_name mips_cp0sel_names_mips3264[] =
{
{ 16, 1, "c0_config1" },
@@ -465,6 +609,44 @@ static const char * const msa_control_names[32] =
"$24", "$25", "$26", "$27", "$28", "$29", "$30", "$31"
};
+static const char * const vfpu_cond_names[16] = {
+ "FL", "EQ", "LT", "LE", "TR", "NE", "GE", "GT",
+ "EZ", "EN", "EI", "ES", "NZ", "NN", "NI", "NS"
+};
+
+static const char * const vfpu_const_names[20] = {
+ "",
+ "VFPU_HUGE",
+ "VFPU_SQRT2",
+ "VFPU_SQRT1_2",
+ "VFPU_2_SQRTPI",
+ "VFPU_2_PI",
+ "VFPU_1_PI",
+ "VFPU_PI_4",
+ "VFPU_PI_2",
+ "VFPU_PI",
+ "VFPU_E",
+ "VFPU_LOG2E",
+ "VFPU_LOG10E",
+ "VFPU_LN2",
+ "VFPU_LN10",
+ "VFPU_2PI",
+ "VFPU_PI_6",
+ "VFPU_LOG10TWO",
+ "VFPU_LOG2TEN",
+ "VFPU_SQRT3_2"
+};
+
+static const char * const pfx_cst_names[8] = {
+ "0", "1", "2", "1/2", "3", "1/3", "1/4", "1/6"
+};
+
+static const char * const pfx_swz_names = "xyzw";
+
+static const char * const pfx_sat_names[4] = {
+ "", "[0:1]", "", "[-1:1]"
+};
+
struct mips_abi_choice
{
const char * name;
@@ -579,6 +761,10 @@ const struct mips_arch_choice mips_arch_choices[] =
{ "mips5", 1, bfd_mach_mips5, CPU_MIPS5, ISA_MIPS5, 0,
mips_cp0_names_numeric, NULL, 0, mips_cp1_names_mips,
mips_hwr_names_numeric },
+ { "allegrex", 1, bfd_mach_mips_allegrex, CPU_ALLEGREX, ISA_MIPS2, 0,
+ mips_cp0_names_numeric, NULL, 0, mips_cp1_names_numeric,
+ mips_hwr_names_numeric },
+
/* For stock MIPS32, disassemble all applicable MIPS-specified ASEs.
Note that MIPS-3D and MDMX are not applicable to MIPS32. (See
@@ -1286,6 +1472,9 @@ print_reg (struct disassemble_info *info, const struct mips_opcode *opcode,
msa_control_names[regno]);
break;
+ case OP_REG_VFPU_CTR:
+ info->fprintf_func (info->stream, "$%d", regno);
+ break;
}
}
@@ -1312,6 +1501,187 @@ init_print_arg_state (struct mips_print_arg_state *state)
memset (state, 0, sizeof (*state));
}
+/* Print VFPU operands. */
+
+static void
+print_vfpu_arg (struct disassemble_info *info, const struct mips_opcode *opcode,
+ const struct mips_vfpu_operand *operand, unsigned int uval)
+{
+ const fprintf_ftype infprintf = info->fprintf_func;
+ void *is = info->stream;
+
+ switch (operand->op_type)
+ {
+ case OP_VFPU_CREG:
+ print_reg (info, opcode, OP_REG_VFPU_CTR, uval);
+ break;
+
+ case OP_VFPU_NCNT:
+ if (uval >= VF_MIN_CONST && uval <= VF_MAX_CONST)
+ infprintf (is, "%s", vfpu_const_names[uval]);
+ break;
+
+ case OP_VFPU_WRAPCNT:
+ infprintf (is, "0x%02x", uval);
+ break;
+
+ case OP_VFPU_COND:
+ infprintf (is, "%s", vfpu_cond_names[uval & OP_MASK_VFPU_COND]);
+ break;
+
+ case OP_VFPU_WRB_BOOL:
+ infprintf (is, (uval & OP_MASK_VFPU_RWB) ? "wb" : "wt");
+ break;
+
+ case OP_VFPU_REGS:
+ /* vmmul vs register is a bit special */
+ if (!strncmp(opcode->name, "vmmul", 5))
+ uval ^= 0x20;
+ /* fallthrough */
+ case OP_VFPU_REGT:
+ case OP_VFPU_REGD:
+ case OP_VFPU_REGV:
+ case OP_VFPU_REGX:
+ case OP_VFPU_REG2:
+ {
+ static const char *tarr = "sptqptq";
+ char rpfx = operand->extra == 0 ? 'S' :
+ operand->extra < 4 ? ((uval & 32) ? 'R' : 'C') :
+ ((uval & 32) ? 'E' : 'M');
+
+ infprintf (is, "%c%s.%c", rpfx, vfpu_regnums[operand->extra][uval], tarr[operand->extra]);
+ break;
+ }
+
+ case OP_VFPU_HFLOAT:
+ {
+ unsigned sign = (uval >> VFPU_SH_FLOAT16_SIGN) & VFPU_MASK_FLOAT16_SIGN;
+ int exponent = (uval >> VFPU_SH_FLOAT16_EXP) & VFPU_MASK_FLOAT16_EXP;
+ unsigned fraction = uval & VFPU_MASK_FLOAT16_FRAC;
+ char signchar = sign ? '-' : '+';
+
+ if (exponent == VFPU_FLOAT16_EXP_MAX) {
+ if (fraction)
+ infprintf (is, "%cNaN", signchar);
+ else
+ infprintf (is, "%cInf", signchar);
+ }
+ else if (!exponent && !fraction)
+ {
+ infprintf (is, "%c0", signchar);
+ }
+ else
+ {
+ // Handle subnormal numbers correctly
+ unsigned lead1 = exponent ? 0x400 : 0;
+
+ float f = (fraction | lead1);
+
+ // Number is shifted by 10 already due to mantissa
+ int shifta = (exponent ? exponent : 1) - 15 - 10;
+
+ // Multiply or divide depending on exponent sign
+ // This is to avoid using pow() really :)
+ if (shifta > 0)
+ f *= (1 << ((unsigned)shifta));
+ else
+ f /= (1 << ((unsigned)(-shifta)));
+
+ if (sign)
+ f = -f;
+ infprintf (is, "%g", f);
+ }
+ break;
+ }
+
+ case OP_VFPU_ROTCNT:
+ {
+ static const char * const vrot_dect[32][4] = {
+ {"c", "s", "s", "s"},
+ {"s", "c", "0", "0"},
+ {"s", "0", "c", "0"},
+ {"s", "0", "0", "c"},
+ {"c", "s", "0", "0"},
+ {"s", "c", "s", "s"},
+ {"0", "s", "c", "0"},
+ {"0", "s", "0", "c"},
+ {"c", "0", "s", "0"},
+ {"0", "c", "s", "0"},
+ {"s", "s", "c", "s"},
+ {"0", "0", "s", "c"},
+ {"c", "0", "0", "s"},
+ {"0", "c", "0", "s"},
+ {"0", "0", "c", "s"},
+ {"s", "s", "s", "c"},
+ {"c", "-s", "-s", "-s"},
+ {"-s", "c", "0", "0"},
+ {"-s", "0", "c", "0"},
+ {"-s", "0", "0", "c"},
+ {"c", "-s", "0", "0"},
+ {"-s", "c", "-s", "-s"},
+ {"0", "-s", "c", "0"},
+ {"0", "-s", "0", "c"},
+ {"c", "0", "-s", "0"},
+ {"0", "c", "-s", "0"},
+ {"-s", "-s", "c", "-s"},
+ {"0", "0", "-s", "c"},
+ {"c", "0", "0", "-s"},
+ {"0", "c", "0", "-s"},
+ {"0", "0", "c", "-s"},
+ {"-s", "-s", "-s", "c"},
+ };
+
+ unsigned opsize = (!strcmp(opcode->name, "vrot.p")) ? 2 :
+ (!strcmp(opcode->name, "vrot.t")) ? 3 : 4;
+
+ infprintf (is, "[%s", vrot_dect[uval][0]);
+ for (unsigned i = 1; i < opsize; i++)
+ infprintf (is, ",%s", vrot_dect[uval][i]);
+ infprintf (is, "]");
+
+ break;
+ }
+
+ case OP_VFPU_SPREFIX:
+ {
+ unsigned chn = operand->extra;
+ unsigned neg = (uval >> (VFPU_SH_PFX_NEG + chn)) & VFPU_MASK_PFX_NEG;
+ unsigned cnt = (uval >> (VFPU_SH_PFX_CST + chn)) & VFPU_MASK_PFX_CST;
+ unsigned swz = (uval >> (VFPU_SH_PFX_SWZ_CSTLO + chn * 2)) & VFPU_MASK_PFX_SWZ_CSTLO;
+ unsigned abs = (uval >> (VFPU_SH_PFX_ABS_CSTHI + chn)) & VFPU_MASK_PFX_ABS_CSTHI;
+
+ if (neg)
+ infprintf (is, "-");
+
+ if (cnt)
+ infprintf (is, "%s", pfx_cst_names[(abs << 2) | swz]);
+ else {
+ if (abs)
+ infprintf (is, "|%c|", pfx_swz_names[swz]);
+ else
+ infprintf (is, "%c", pfx_swz_names[swz]);
+ }
+
+ break;
+ }
+
+ case OP_VFPU_DPREFIX:
+ {
+ unsigned chn = operand->extra;
+ unsigned msk = (uval >> (VFPU_SH_PFX_MASK + chn )) & VFPU_MASK_PFX_MASK;
+ unsigned sat = (uval >> (VFPU_SH_PFX_SAT + chn * 2)) & VFPU_MASK_PFX_SAT;
+
+ if (msk)
+ infprintf (is, "m");
+ else
+ infprintf (is, "%s", pfx_sat_names[sat]);
+
+ break;
+ }
+ };
+}
+
+
/* Print OP_VU0_SUFFIX or OP_VU0_MATCH_SUFFIX operand OPERAND,
whose value is given by UVAL. */
@@ -1777,6 +2147,10 @@ print_insn_arg (struct disassemble_info *info,
print_reg (info, opcode, OP_REG_GP, uval);
infprintf (is, dis_style_text, "]");
break;
+
+ case OP_VFPU_OPERAND:
+ print_vfpu_arg (info, opcode, (struct mips_vfpu_operand*) operand, uval);
+ break;
}
}
@@ -1882,6 +2256,7 @@ validate_insn_args (const struct mips_opcode *opcode,
case OP_IMM_INDEX:
case OP_REG_INDEX:
case OP_SAVE_RESTORE_LIST:
+ case OP_VFPU_OPERAND:
break;
}
}
@@ -2003,6 +2378,11 @@ print_insn_args (struct disassemble_info *info,
}
if (*s == 'm' || *s == '+' || *s == '-')
++s;
+ if (*s == '?') {
+ while (s[1] != 0 && s[1] != '?' && s[1] != ',' &&
+ s[1] != '(' && s[1] != '[' && s[1] != ')' && s[1] != ']')
+ s++;
+ }
break;
}
}
diff --git a/opcodes/mips-formats.h b/opcodes/mips-formats.h
index aa90b2f0..32e8df2f 100644
--- a/opcodes/mips-formats.h
+++ b/opcodes/mips-formats.h
@@ -132,6 +132,42 @@
#define BRANCH(SIZE, LSB, SHIFT) \
PCREL (SIZE, LSB, true, SHIFT, 0, true, false)
+/* VFPU regsiters, unfortunately mode must be encoded like this */
+#define VFPU_FULL(SIZE, LSB, SUBTYPE, EXTRA, PFXMODE, SIZE2, LSB2) \
+ { \
+ static const struct mips_vfpu_operand op[] = { \
+ {{ OP_VFPU_OPERAND, SIZE, LSB }, \
+ OP_VFPU_##SUBTYPE, 0, PFXMODE, SIZE2, LSB2 }, \
+ {{ OP_VFPU_OPERAND, SIZE, LSB }, \
+ OP_VFPU_##SUBTYPE, 1, PFXMODE, SIZE2, LSB2 }, \
+ {{ OP_VFPU_OPERAND, SIZE, LSB }, \
+ OP_VFPU_##SUBTYPE, 2, PFXMODE, SIZE2, LSB2 }, \
+ {{ OP_VFPU_OPERAND, SIZE, LSB }, \
+ OP_VFPU_##SUBTYPE, 3, PFXMODE, SIZE2, LSB2 }, \
+ {{ OP_VFPU_OPERAND, SIZE, LSB }, \
+ OP_VFPU_##SUBTYPE, 4, PFXMODE, SIZE2, LSB2 }, \
+ {{ OP_VFPU_OPERAND, SIZE, LSB }, \
+ OP_VFPU_##SUBTYPE, 5, PFXMODE, SIZE2, LSB2 }, \
+ {{ OP_VFPU_OPERAND, SIZE, LSB }, \
+ OP_VFPU_##SUBTYPE, 6, PFXMODE, SIZE2, LSB2 } }; \
+ return &op[EXTRA].root; \
+ }
+
+#define VFPU_REG_PFX(SIZE, LSB, SUBTYPE, EXTRA, PFXMODE) \
+ switch (PFXMODE) { \
+ case 'a': VFPU_FULL(SIZE, LSB, SUBTYPE, EXTRA, 'a', 0, 0); \
+ case 'f': VFPU_FULL(SIZE, LSB, SUBTYPE, EXTRA, 'f', 0, 0); \
+ case 'm': VFPU_FULL(SIZE, LSB, SUBTYPE, EXTRA, 'm', 0, 0); \
+ case 'w': VFPU_FULL(SIZE, LSB, SUBTYPE, EXTRA, 'w', 0, 0); \
+ default: abort(); \
+ };
+
+#define VFPU_EX(SIZE, LSB, SUBTYPE, EXTRA) \
+ VFPU_FULL(SIZE, LSB, SUBTYPE, EXTRA, 0, 0, 0)
+
+#define VFPU(SIZE, LSB, SUBTYPE) \
+ VFPU_EX(SIZE, LSB, SUBTYPE, 0)
+
#define SPECIAL(SIZE, LSB, TYPE) \
{ \
static const struct mips_operand op = { OP_##TYPE, SIZE, LSB }; \
diff --git a/opcodes/mips-opc.c b/opcodes/mips-opc.c
index 1d7d72ae..7ae32862 100644
--- a/opcodes/mips-opc.c
+++ b/opcodes/mips-opc.c
@@ -25,6 +25,7 @@
#include "sysdep.h"
#include <stdio.h>
+#include <assert.h>
#include "opcode/mips.h"
#include "mips-formats.h"
@@ -38,6 +39,7 @@ static unsigned char reg_0_map[] = { 0 };
const struct mips_operand *
decode_mips_operand (const char *p)
{
+ char c;
switch (p[0])
{
case '-':
@@ -211,6 +213,92 @@ decode_mips_operand (const char *p)
case 'x': REG (0, 0, GP);
case 'y': REG (5, 16, CONTROL);
case 'z': MAPPED_REG (0, 0, GP, reg_0_map);
+
+ /* VFPU fields */
+ case '?':
+ p++;
+ switch (c = *(p++))
+ {
+ case 'y':
+ {
+ assert ((*p >= '0') && (*p <= '3'));
+ p++;
+ }
+ break;
+
+ /* Using a regular offset type, not sure whether this is OK ... */
+ case 'o': INT_ADJ(VF_BITCNT_OFFSET, VF_SH_OFFSET, (1 << (VF_BITCNT_OFFSET - 1)) - 1, VF_SH_OFFSET, false); break;
+
+ case 's':
+ case 't':
+ case 'd':
+ case 'v':
+ case 'x':
+ case 'm':
+ case 'n':
+ {
+ const unsigned regmode = *p - '0';
+ /* Sanity check, ensure the number of elements is valid */
+ assert((p[0] >= '0' && p[0] <= '6'));
+
+ /* Sanity check, ensure the allowed prefix types are valid.
+ 'a' means all prefixes are allowed.
+ 'f' means no prefixes are allowed.
+ 'm' means only masking is allowed.
+ 'w' means only swizzling is allowed. */
+ assert(p[1] == 'a' || p[1] == 'f' || p[1] == 'm' || p[1] == 'w');
+
+ switch (c)
+ {
+ case 's': VFPU_REG_PFX (VF_BITCNT_VS, VF_SH_VS, REGS, regmode, p[1]); break;
+ case 't': VFPU_REG_PFX (VF_BITCNT_VT, VF_SH_VT, REGT, regmode, p[1]); break;
+ case 'd': VFPU_REG_PFX (VF_BITCNT_VD, VF_SH_VD, REGD, regmode, p[1]); break;
+ // Same as REGD but with partial overlap incompatibility
+ case 'x': VFPU_REG_PFX (VF_BITCNT_VD, VF_SH_VD, REGX, regmode, p[1]); break;
+ // Same as REGD but prohibits any kind of input overlap
+ case 'v': VFPU_REG_PFX (VF_BITCNT_VD, VF_SH_VD, REGV, regmode, p[1]); break;
+
+ case 'm': VFPU_FULL (VF_BITCNT_VML, VF_SH_VML, REG2, regmode, 'f',
+ VF_BITCNT_VMH, VF_SH_VMH); break;
+
+ case 'n': VFPU_FULL (VF_BITCNT_VNL, VF_SH_VNL, REG2, regmode, 'f',
+ VF_BITCNT_VNH, VF_SH_VNH); break;
+ }
+ }
+ break;
+
+ case 'f': VFPU_EX (VF_BITCNT_CC, VF_SH_CC, COND, *p - '0'); break;
+
+ case 'a': VFPU (VF_BITCNT_CONST, VF_SH_CONST, NCNT); break;
+ case 'b': UINT (VF_BITCNT_SCALE, VF_SH_SCALE); break;
+ case 'c': UINT (VF_BITCNT_BCOND, VF_SH_BCOND); break;
+ case 'e': UINT (VF_BITCNT_MCOND, VF_SH_MCOND); break;
+
+ case 'i': VFPU (VF_BITCNT_WRAP, VF_SH_WRAP, WRAPCNT); break;
+
+ case 'q': VFPU (VF_BITCNT_VCD, VF_SH_VCD, CREG); break;
+ case 'r': VFPU (VF_BITCNT_VCS, VF_SH_VCS, CREG); break;
+
+ case 'u': VFPU (VF_BITCNT_HFLOAT, VF_SH_HFLOAT, HFLOAT); break;
+
+ case 'w': VFPU (VF_BITCNT_ROT, VF_SH_ROT, ROTCNT); break;
+ case 'z': VFPU (VF_BITCNT_RWB, VF_SH_RWB, WRB_BOOL); break;
+
+ case '0': VFPU_EX (VF_BITCNT_PFX, VF_SH_PFX, SPREFIX, 0); break;
+ case '1': VFPU_EX (VF_BITCNT_PFX, VF_SH_PFX, SPREFIX, 1); break;
+ case '2': VFPU_EX (VF_BITCNT_PFX, VF_SH_PFX, SPREFIX, 2); break;
+ case '3': VFPU_EX (VF_BITCNT_PFX, VF_SH_PFX, SPREFIX, 3); break;
+ case '4': VFPU_EX (VF_BITCNT_PFX, VF_SH_PFX, DPREFIX, 0); break;
+ case '5': VFPU_EX (VF_BITCNT_PFX, VF_SH_PFX, DPREFIX, 1); break;
+ case '6': VFPU_EX (VF_BITCNT_PFX, VF_SH_PFX, DPREFIX, 2); break;
+ case '7': VFPU_EX (VF_BITCNT_PFX, VF_SH_PFX, DPREFIX, 3); break;
+
+ default:
+ assert(0); // Bad operand type
+ return 0;
+
+ }
+ break;
}
return 0;
}
@@ -278,6 +366,9 @@ decode_mips_operand (const char *p)
#define RD_pc INSN2_READ_PC
#define FS INSN2_FORBIDDEN_SLOT
+#define VFPU_REG INSN2_VFPU_REG
+#define VFPU_CC INSN2_VFPU_CC
+
#define I1 INSN_ISA1
#define I2 INSN_ISA2
#define I3 INSN_ISA3
@@ -636,6 +727,7 @@ const struct mips_opcode mips_builtin_opcodes[] =
{"vmulay", "+m+K,+6+K,+7+N", 0x4a0001bd, 0xfe0007ff, CP, VU0CH, VU0, 0, 0 },
{"vmulaz", "+m+K,+6+K,+7+N", 0x4a0001be, 0xfe0007ff, CP, VU0CH, VU0, 0, 0 },
{"vnop", "", 0x4a0002ff, 0xffffffff, CP, 0, VU0, 0, 0 },
+{"vnop", "", 0xffff0000, 0xffffffff, RD_C2, 0, ALX, 0, 0 },
{"vopmula.xyz", "+m+K,+6+K,+7+K", 0x4bc002fe, 0xffe007ff, CP, 0, VU0, 0, 0 },
{"vopmula", "+m+K,+6+K,+7+K", 0x4bc002fe, 0xffe007ff, CP, 0, VU0, 0, 0 },
{"vopmsub.xyz", "+5+K,+6+K,+7+K", 0x4bc0002e, 0xffe0003f, CP, 0, VU0, 0, 0 },
@@ -1330,8 +1422,8 @@ const struct mips_opcode mips_builtin_opcodes[] =
{"l.s", "T,o(b)", 0xc4000000, 0xfc000000, WR_1|RD_3|CLD|FP_S, 0, I1, 0, 0 }, /* lwc1 */
{"l.s", "T,A(b)", 0, (int) M_LWC1_AB, INSN_MACRO, INSN2_M_FP_S, I1, 0, 0 },
{"lwc2", "E,+:(d)", 0x49400000, 0xffe00000, RD_3|WR_C2|CLD, 0, I37, 0, 0 },
-{"lwc2", "E,o(b)", 0xc8000000, 0xfc000000, RD_3|WR_CC|CLD, 0, I1, 0, N54|IOCT|IOCTP|IOCT2|EE|I37 },
-{"lwc2", "E,A(b)", 0, (int) M_LWC2_AB, INSN_MACRO, 0, I1, 0, N54|IOCT|IOCTP|IOCT2|EE },
+{"lwc2", "E,o(b)", 0xc8000000, 0xfc000000, RD_3|WR_CC|CLD, 0, I1, 0, N54|IOCT|IOCTP|IOCT2|EE|ALX|I37 },
+{"lwc2", "E,A(b)", 0, (int) M_LWC2_AB, INSN_MACRO, 0, I1, 0, N54|IOCT|IOCTP|IOCT2|EE|ALX },
{"lwc3", "E,o(b)", 0xcc000000, 0xfc000000, RD_3|WR_CC|CLD, 0, I1, 0, I3_32|EE|ALX },
{"lwc3", "E,A(b)", 0, (int) M_LWC3_AB, INSN_MACRO, 0, I1, 0, I3_32|EE|ALX },
{"lwl", "t,o(b)", 0x88000000, 0xfc000000, WR_1|RD_3|LM, 0, I1, 0, I37 },
@@ -2004,8 +2096,8 @@ const struct mips_opcode mips_builtin_opcodes[] =
{"s.s", "T,o(b)", 0xe4000000, 0xfc000000, RD_1|RD_3|SM|FP_S, 0, I1, 0, 0 }, /* swc1 */
{"s.s", "T,A(b)", 0, (int) M_SWC1_AB, INSN_MACRO, INSN2_M_FP_S, I1, 0, 0 },
{"swc2", "E,+:(d)", 0x49600000, 0xffe00000, RD_3|RD_C2|SM, 0, I37, 0, 0 },
-{"swc2", "E,o(b)", 0xe8000000, 0xfc000000, RD_3|RD_C2|SM, 0, I1, 0, N54|IOCT|IOCTP|IOCT2|EE|I37 },
-{"swc2", "E,A(b)", 0, (int) M_SWC2_AB, INSN_MACRO, 0, I1, 0, N54|IOCT|IOCTP|IOCT2|EE },
+{"swc2", "E,o(b)", 0xe8000000, 0xfc000000, RD_3|RD_C2|SM, 0, I1, 0, N54|IOCT|IOCTP|IOCT2|EE|ALX|I37 },
+{"swc2", "E,A(b)", 0, (int) M_SWC2_AB, INSN_MACRO, 0, I1, 0, N54|IOCT|IOCTP|IOCT2|EE|ALX },
{"swc3", "E,o(b)", 0xec000000, 0xfc000000, RD_3|RD_C3|SM, 0, I1, 0, I3_32|EE|ALX },
{"swc3", "E,A(b)", 0, (int) M_SWC3_AB, INSN_MACRO, 0, I1, 0, I3_32|EE|ALX },
{"swl", "t,o(b)", 0xa8000000, 0xfc000000, RD_1|RD_3|SM, 0, I1, 0, I37 },
@@ -3150,6 +3242,311 @@ const struct mips_opcode mips_builtin_opcodes[] =
{"restore", "-m", 0x7000001f, 0xfc00603f, WR_31|NODS, MOD_SP, IAMR2, 0, 0 },
{"save", "-m", 0x7000201f, 0xfc00603f, NODS, RD_31|MOD_SP, IAMR2, 0, 0 },
+/* Sony Allegrex VFPU instructions. */
+{"bvf", "?c,p", 0x49000000, 0xffe30000, CBD|RD_CC, 0, ALX, 0, 0 },
+{"bvfl", "?c,p", 0x49020000, 0xffe30000, CBL|RD_CC, 0, ALX, 0, 0 },
+{"bvt", "?c,p", 0x49010000, 0xffe30000, CBD|RD_CC, 0, ALX, 0, 0 },
+{"bvtl", "?c,p", 0x49030000, 0xffe30000, CBL|RD_CC, 0, ALX, 0, 0 },
+{"lv.s", "?m0f,?o(b)", 0xc8000000, 0xfc000000, CLD|RD_3|WR_CC, VFPU_REG, ALX, 0, 0 },
+{"lv.s", "?m0f,A(b)", 0, (int) M_LV_S_AB, INSN_MACRO, VFPU_REG, ALX, 0, 0 },
+{"lv.q", "?n3f,?o(b)", 0xd8000000, 0xfc000002, CLD|RD_3|WR_CC, VFPU_REG, ALX, 0, 0 },
+{"lv.q", "?n3f,A(b)", 0, (int) M_LV_Q_AB, INSN_MACRO, VFPU_REG, ALX, 0, 0 },
+{"ulv.q", "?n3f,A(b)", 0, (int) M_ULV_Q_AB, INSN_MACRO, VFPU_REG, ALX, 0, 0 },
+{"lvi.s", "?t0f,?y0", 0, (int) M_LVI_S, INSN_MACRO, VFPU_REG, ALX, 0, 0 },
+{"lvi.p", "?t1f,[?y0,?y1]", 0, (int) M_LVI_P, INSN_MACRO, VFPU_REG, ALX, 0, 0 },
+{"lvi.t", "?t2f,[?y0,?y1,?y2]", 0, (int) M_LVI_T, INSN_MACRO, VFPU_REG, ALX, 0, 0 },
+{"lvi.q", "?t3f,[?y0,?y1,?y2,?y3]", 0, (int) M_LVI_Q, INSN_MACRO, VFPU_REG, ALX, 0, 0 },
+{"lvhi.s", "?t0f,[?y0,?y1]", 0, (int) M_LVHI_S, INSN_MACRO, VFPU_REG, ALX, 0, 0 },
+{"lvhi.p", "?t1f,[?y0,?y1,?y2,?y3]", 0, (int) M_LVHI_P, INSN_MACRO, VFPU_REG, ALX, 0, 0 },
+{"sv.s", "?m0f,?o(b)", 0xe8000000, 0xfc000000, SM|RD_3|RD_C2, VFPU_REG, ALX, 0, 0 },
+{"sv.s", "?m0f,A(b)", 0, (int) M_SV_S_AB, INSN_MACRO, VFPU_REG, ALX, 0, 0 },
+{"sv.q", "?n3f,?o(b)", 0xf8000000, 0xfc000002, SM|RD_3|RD_C2, VFPU_REG, ALX, 0, 0 },
+{"sv.q", "?n3f,?o(b),?z", 0xf8000000, 0xfc000000, SM|RD_3|RD_C2, VFPU_REG, ALX, 0, 0 },
+{"sv.q", "?n3f,A(b)", 0, (int) M_SV_Q_AB, INSN_MACRO, VFPU_REG, ALX, 0, 0 },
+{"sv.q", "?n3f,A(b),?z", 0, (int) M_SV_Q_AB, INSN_MACRO, VFPU_REG, ALX, 0, 0 },
+{"sv.q", "?n3f,A,?z", 0, (int) M_SV_Q_AB, INSN_MACRO, VFPU_REG, ALX, 0, 0 },
+{"usv.q", "?n3f,A(b)", 0, (int) M_USV_Q_AB, INSN_MACRO, VFPU_REG, ALX, 0, 0 },
+{"vwb.q", "?n3f,?o(b)", 0xf8000002, 0xfc000002, SM|RD_3|RD_C2, VFPU_REG, ALX, 0, 0 },
+{"lvl.q", "?n3f,?o(b)", 0xd4000000, 0xfc000002, CLD|RD_3|WR_CC, VFPU_REG, ALX, 0, 0 },
+{"lvl.q", "?n3f,A(b)", 0, (int) M_LVL_Q_AB, INSN_MACRO, VFPU_REG, ALX, 0, 0 },
+{"lvr.q", "?n3f,?o(b)", 0xd4000002, 0xfc000002, CLD|RD_3|WR_CC, VFPU_REG, ALX, 0, 0 },
+{"lvr.q", "?n3f,A(b)", 0, (int) M_LVR_Q_AB, INSN_MACRO, VFPU_REG, ALX, 0, 0 },
+{"svl.q", "?n3f,?o(b)", 0xf4000000, 0xfc000002, SM|RD_3|RD_C2, VFPU_REG, ALX, 0, 0 },
+{"svl.q", "?n3f,A(b)", 0, (int) M_SVL_Q_AB, INSN_MACRO, VFPU_REG, ALX, 0, 0 },
+{"svr.q", "?n3f,?o(b)", 0xf4000002, 0xfc000002, SM|RD_3|RD_C2, VFPU_REG, ALX, 0, 0 },
+{"svr.q", "?n3f,A(b)", 0, (int) M_SVR_Q_AB, INSN_MACRO, VFPU_REG, ALX, 0, 0 },
+{"mtv", "t,?d0f", 0x48e00000, 0xffe0ff80, LC|RD_1|WR_C2, VFPU_REG, ALX, 0, 0 },
+{"mfv", "t,?d0f", 0x48600000, 0xffe0ff80, CM|WR_1|WR_CC|RD_C2, VFPU_REG, ALX, 0, 0 },
+{"mtvc", "t,?q", 0x48e00000, 0xffe0ff00, LC|RD_1|WR_C2, VFPU_REG, ALX, 0, 0 },
+{"mfvc", "t,?q", 0x48600000, 0xffe0ff00, CM|WR_1|WR_CC|RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmtvc", "?q,?s0f", 0xd0510000, 0xffff8000, WR_C2, VFPU_REG, ALX, 0, 0 },
+{"vmfvc", "?d0f,?r", 0xd0500000, 0xffff0080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vadd.q", "?d3a,?s3a,?t3a", 0x60008080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsub.q", "?d3a,?s3a,?t3a", 0x60808080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vdiv.q", "?x3f,?s3f,?t3f", 0x63808080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmul.q", "?d3a,?s3a,?t3a", 0x64008080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vdot.q", "?d0a,?s3a,?t3a", 0x64808080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vscl.q", "?d3a,?s3a,?t0f", 0x65008080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vhdp.q", "?d0a,?s3f,?t3a", 0x66008080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vcmp.q", "?f2,?s3a,?t3a", 0x6c008080, 0xff8080f0, RD_C2, VFPU_REG|VFPU_CC, ALX, 0, 0 },
+{"vcmp.q", "?f1,?s3a", 0x6c008080, 0xffff80f0, RD_C2, VFPU_REG|VFPU_CC, ALX, 0, 0 },
+{"vcmp.q", "?f0", 0x6c008080, 0xfffffff0, RD_C2, VFPU_CC, ALX, 0, 0 },
+{"vmin.q", "?d3a,?s3a,?t3a", 0x6d008080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmax.q", "?d3a,?s3a,?t3a", 0x6d808080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsgn.q", "?d3a,?s3a", 0xd04a8080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vcst.q", "?d3a,?a", 0xd0608080, 0xffe0ff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vscmp.q", "?d3a,?s3a,?t3a", 0x6e808080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsge.q", "?d3a,?s3a,?t3a", 0x6f008080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vslt.q", "?d3a,?s3a,?t3a", 0x6f808080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vi2uc.q", "?d0m,?s3w", 0xd03c8080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vi2c.q", "?d0m,?s3w", 0xd03d8080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vi2us.q", "?d1m,?s3w", 0xd03e8080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vi2s.q", "?d1m,?s3w", 0xd03f8080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmov.q", "?d3a,?s3a", 0xd0008080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vabs.q", "?d3a,?s3w", 0xd0018080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vneg.q", "?d3a,?s3w", 0xd0028080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vidt.q", "?d3a", 0xd0038080, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsat0.q", "?d3f,?s3a", 0xd0048080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsat1.q", "?d3f,?s3a", 0xd0058080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vzero.q", "?d3a", 0xd0068080, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vone.q", "?d3a", 0xd0078080, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vrcp.q", "?x3f,?s3f", 0xd0108080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vrsq.q", "?x3f,?s3f", 0xd0118080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsin.q", "?x3f,?s3f", 0xd0128080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vcos.q", "?x3f,?s3f", 0xd0138080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vexp2.q", "?x3f,?s3f", 0xd0148080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vlog2.q", "?x3f,?s3f", 0xd0158080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsqrt.q", "?x3f,?s3f", 0xd0168080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vasin.q", "?x3f,?s3f", 0xd0178080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vnrcp.q", "?x3f,?s3f", 0xd0188080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vnsin.q", "?x3f,?s3f", 0xd01a8080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vrexp2.q", "?x3f,?s3f", 0xd01c8080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vrndi.q", "?d3f", 0xd0218080, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vrndf1.q", "?d3f", 0xd0228080, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vrndf2.q", "?d3f", 0xd0238080, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vf2h.q", "?d1m,?s3a", 0xd0328080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsrt1.q", "?d3a,?s3f", 0xd0408080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsrt2.q", "?d3a,?s3f", 0xd0418080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsrt3.q", "?d3a,?s3f", 0xd0488080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsrt4.q", "?d3a,?s3f", 0xd0498080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vbfy1.q", "?d3a,?s3f", 0xd0428080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vbfy2.q", "?d3a,?s3f", 0xd0438080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vocp.q", "?d3a,?s3f", 0xd0448080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vfad.q", "?d0a,?s3a", 0xd0468080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vavg.q", "?d0a,?s3a", 0xd0478080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vf2in.q", "?d3m,?s3a,?b", 0xd2008080, 0xffe08080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vf2iz.q", "?d3m,?s3a,?b", 0xd2208080, 0xffe08080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vf2iu.q", "?d3m,?s3a,?b", 0xd2408080, 0xffe08080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vf2id.q", "?d3m,?s3a,?b", 0xd2608080, 0xffe08080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vi2f.q", "?d3a,?s3w,?b", 0xd2808080, 0xffe08080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vcmov.q", "?d3a,?s3a,?e", 0, (int) M_VCMOV_Q, INSN_MACRO, VFPU_REG, ALX, 0, 0 },
+{"vcmovt.q", "?d3a,?s3a,?e", 0xd2a08080, 0xfff88080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vcmovf.q", "?d3a,?s3a,?e", 0xd2a88080, 0xfff88080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmmul.q", "?v6f,?s6f,?t6f", 0xf0008080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vtfm4.q", "?v3f,?s6f,?t3f", 0xf1808080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vhtfm4.q", "?v3f,?s6f,?t3f", 0xf1808000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmscl.q", "?x6f,?s6f,?t0f", 0xf2008080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vqmul.q", "?v3f,?s3f,?t3f", 0xf2808080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmmov.q", "?x6f,?s6f", 0xf3808080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmidt.q", "?d6f", 0xf3838080, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmzero.q", "?d6f", 0xf3868080, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmone.q", "?d6f", 0xf3878080, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vrot.q", "?x3f,?s0f,?w", 0xf3a08080, 0xffe08080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vt4444.q", "?d1f,?s3w", 0xd0598080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vt5551.q", "?d1f,?s3w", 0xd05a8080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vt5650.q", "?d1f,?s3w", 0xd05b8080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vadd.t", "?d2a,?s2a,?t2a", 0x60008000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsub.t", "?d2a,?s2a,?t2a", 0x60808000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vdiv.t", "?x2f,?s2f,?t2f", 0x63808000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmul.t", "?d2a,?s2a,?t2a", 0x64008000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vdot.t", "?d0a,?s2a,?t2a", 0x64808000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vscl.t", "?d2a,?s2a,?t0f", 0x65008000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vhdp.t", "?d0a,?s2f,?t2a", 0x66008000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vcrs.t", "?d2a,?s2f,?t2f", 0x66808000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vcmp.t", "?f2,?s2a,?t2a", 0x6c008000, 0xff8080f0, RD_C2, VFPU_REG|VFPU_CC, ALX, 0, 0 },
+{"vcmp.t", "?f1,?s2a", 0x6c008000, 0xffff80f0, RD_C2, VFPU_REG|VFPU_CC, ALX, 0, 0 },
+{"vcmp.t", "?f0", 0x6c008000, 0xfffffff0, RD_C2, VFPU_CC, ALX, 0, 0 },
+{"vmin.t", "?d2a,?s2a,?t2a", 0x6d008000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmax.t", "?d2a,?s2a,?t2a", 0x6d808000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsgn.t", "?d2a,?s2a", 0xd04a8000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vcst.t", "?d2a,?a", 0xd0608000, 0xffe0ff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vscmp.t", "?d2a,?s2a,?t2a", 0x6e808000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsge.t", "?d2a,?s2a,?t2a", 0x6f008000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vslt.t", "?d2a,?s2a,?t2a", 0x6f808000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmov.t", "?d2a,?s2a", 0xd0008000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vabs.t", "?d2a,?s2w", 0xd0018000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vneg.t", "?d2a,?s2w", 0xd0028000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsat0.t", "?d2f,?s2a", 0xd0048000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsat1.t", "?d2f,?s2a", 0xd0058000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vzero.t", "?d2a", 0xd0068000, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vone.t", "?d2a", 0xd0078000, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vrcp.t", "?x2f,?s2f", 0xd0108000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vrsq.t", "?x2f,?s2f", 0xd0118000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsin.t", "?x2f,?s2f", 0xd0128000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vcos.t", "?x2f,?s2f", 0xd0138000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vexp2.t", "?x2f,?s2f", 0xd0148000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vlog2.t", "?x2f,?s2f", 0xd0158000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsqrt.t", "?x2f,?s2f", 0xd0168000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vasin.t", "?x2f,?s2f", 0xd0178000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vnrcp.t", "?x2f,?s2f", 0xd0188000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vnsin.t", "?x2f,?s2f", 0xd01a8000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vrexp2.t", "?x2f,?s2f", 0xd01c8000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vrndi.t", "?d2f", 0xd0218000, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vrndf1.t", "?d2f", 0xd0228000, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vrndf2.t", "?d2f", 0xd0238000, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vocp.t", "?d2a,?s2f", 0xd0448000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vfad.t", "?d0a,?s2a", 0xd0468000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vavg.t", "?d0a,?s2a", 0xd0478000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vf2in.t", "?d2m,?s2a,?b", 0xd2008000, 0xffe08080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vf2iz.t", "?d2m,?s2a,?b", 0xd2208000, 0xffe08080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vf2iu.t", "?d2m,?s2a,?b", 0xd2408000, 0xffe08080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vf2id.t", "?d2m,?s2a,?b", 0xd2608000, 0xffe08080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vi2f.t", "?d2a,?s2w,?b", 0xd2808000, 0xffe08080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vcmov.t", "?d2a,?s2a,?e", 0, (int) M_VCMOV_T, INSN_MACRO, VFPU_REG, ALX, 0, 0 },
+{"vcmovt.t", "?d2a,?s2a,?e", 0xd2a08000, 0xfff88080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vcmovf.t", "?d2a,?s2a,?e", 0xd2a88000, 0xfff88080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmmul.t", "?v5f,?s5f,?t5f", 0xf0008000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vtfm3.t", "?v2f,?s5f,?t2f", 0xf1008000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vhtfm3.t", "?v2f,?s5f,?t2f", 0xf1000080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmscl.t", "?x5f,?s5f,?t0f", 0xf2008000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmmov.t", "?x5f,?s5f", 0xf3808000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmidt.t", "?d5f", 0xf3838000, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmzero.t", "?d5f", 0xf3868000, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmone.t", "?d5f", 0xf3878000, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vrot.t", "?x2f,?s0f,?w", 0xf3a08000, 0xffe08080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vcrsp.t", "?v2f,?s2f,?t2f", 0xf2808000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vadd.p", "?d1a,?s1a,?t1a", 0x60000080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsub.p", "?d1a,?s1a,?t1a", 0x60800080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vdiv.p", "?x1f,?s1f,?t1f", 0x63800080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmul.p", "?d1a,?s1a,?t1a", 0x64000080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vdot.p", "?d0a,?s1a,?t1a", 0x64800080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vscl.p", "?d1a,?s1a,?t0f", 0x65000080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vhdp.p", "?d0a,?s1f,?t1a", 0x66000080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vdet.p", "?d0a,?s1a,?t1f", 0x67000080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vcmp.p", "?f2,?s1a,?t1a", 0x6c000080, 0xff8080f0, RD_C2, VFPU_REG|VFPU_CC, ALX, 0, 0 },
+{"vcmp.p", "?f1,?s1a", 0x6c000080, 0xffff80f0, RD_C2, VFPU_REG|VFPU_CC, ALX, 0, 0 },
+{"vcmp.p", "?f0", 0x6c000080, 0xfffffff0, RD_C2, VFPU_CC, ALX, 0, 0 },
+{"vmin.p", "?d1a,?s1a,?t1a", 0x6d000080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmax.p", "?d1a,?s1a,?t1a", 0x6d800080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsgn.p", "?d1a,?s1a", 0xd04a0080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vcst.p", "?d1a,?a", 0xd0600080, 0xffe0ff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vscmp.p", "?d1a,?s1a,?t1a", 0x6e800080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsge.p", "?d1a,?s1a,?t1a", 0x6f000080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vslt.p", "?d1a,?s1a,?t1a", 0x6f800080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vus2i.p", "?d3m,?s1f", 0xd03a0080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vs2i.p", "?d3m,?s1f", 0xd03b0080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vi2us.p", "?d0m,?s1w", 0xd03e0080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vi2s.p", "?d0m,?s1w", 0xd03f0080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vc2i.s", "?d3m,?s0f", 0xd0390000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmov.p", "?d1a,?s1a", 0xd0000080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vabs.p", "?d1a,?s1w", 0xd0010080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vneg.p", "?d1a,?s1w", 0xd0020080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vidt.p", "?d1a", 0xd0030080, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsat0.p", "?d1f,?s1a", 0xd0040080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsat1.p", "?d1f,?s1a", 0xd0050080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vzero.p", "?d1a", 0xd0060080, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vone.p", "?d1a", 0xd0070080, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vrcp.p", "?x1f,?s1f", 0xd0100080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vrsq.p", "?x1f,?s1f", 0xd0110080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsin.p", "?x1f,?s1f", 0xd0120080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vcos.p", "?x1f,?s1f", 0xd0130080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vexp2.p", "?x1f,?s1f", 0xd0140080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vlog2.p", "?x1f,?s1f", 0xd0150080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsqrt.p", "?x1f,?s1f", 0xd0160080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vasin.p", "?x1f,?s1f", 0xd0170080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vnrcp.p", "?x1f,?s1f", 0xd0180080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vnsin.p", "?x1f,?s1f", 0xd01a0080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vrexp2.p", "?x1f,?s1f", 0xd01c0080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vrndi.p", "?d1f", 0xd0210080, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vrndf1.p", "?d1f", 0xd0220080, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vrndf2.p", "?d1f", 0xd0230080, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vf2h.p", "?d0m,?s1a", 0xd0320080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vh2f.p", "?d3a,?s1f", 0xd0330080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vbfy1.p", "?d1a,?s1f", 0xd0420080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vocp.p", "?d1a,?s1f", 0xd0440080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsocp.p", "?d3f,?s1f", 0xd0450080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vfad.p", "?d0a,?s1a", 0xd0460080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vavg.p", "?d0a,?s1a", 0xd0470080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vf2in.p", "?d1m,?s1a,?b", 0xd2000080, 0xffe08080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vf2iz.p", "?d1m,?s1a,?b", 0xd2200080, 0xffe08080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vf2iu.p", "?d1m,?s1a,?b", 0xd2400080, 0xffe08080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vf2id.p", "?d1m,?s1a,?b", 0xd2600080, 0xffe08080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vi2f.p", "?d1a,?s1w,?b", 0xd2800080, 0xffe08080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vcmov.p", "?d1a,?s1a,?e", 0, (int) M_VCMOV_P, INSN_MACRO, VFPU_REG, ALX, 0, 0 },
+{"vcmovt.p", "?d1a,?s1a,?e", 0xd2a00080, 0xfff88080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vcmovf.p", "?d1a,?s1a,?e", 0xd2a80080, 0xfff88080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmmul.p", "?v4f,?s4f,?t4f", 0xf0000080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vtfm2.p", "?v1f,?s4f,?t1f", 0xf0800080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vhtfm2.p", "?v1f,?s4f,?t1f", 0xf0800000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmscl.p", "?x4f,?s4f,?t0f", 0xf2000080, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmmov.p", "?x4f,?s4f", 0xf3800080, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmidt.p", "?d4f", 0xf3830080, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmzero.p", "?d4f", 0xf3860080, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmone.p", "?d4f", 0xf3870080, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vrot.p", "?x1f,?s0f,?w", 0xf3a00080, 0xffe08080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vadd.s", "?d0a,?s0a,?t0a", 0x60000000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsub.s", "?d0a,?s0a,?t0a", 0x60800000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vdiv.s", "?x0a,?s0a,?t0a", 0x63800000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmul.s", "?d0a,?s0a,?t0a", 0x64000000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vcmp.s", "?f2,?s0a,?t0a", 0x6c000000, 0xff8080f0, RD_C2, VFPU_REG|VFPU_CC, ALX, 0, 0 },
+{"vcmp.s", "?f1,?s0a", 0x6c000000, 0xffff80f0, RD_C2, VFPU_REG|VFPU_CC, ALX, 0, 0 },
+{"vcmp.s", "?f0", 0x6c000000, 0xfffffff0, RD_C2, VFPU_CC, ALX, 0, 0 },
+{"vmin.s", "?d0a,?s0a,?t0a", 0x6d000000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmax.s", "?d0a,?s0a,?t0a", 0x6d800000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsgn.s", "?d0a,?s0a", 0xd04a0000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vcst.s", "?d0a,?a", 0xd0600000, 0xffe0ff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vscmp.s", "?d0a,?s0a,?t0a", 0x6e800000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsge.s", "?d0a,?s0a,?t0a", 0x6f000000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vslt.s", "?d0a,?s0a,?t0a", 0x6f800000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vus2i.s", "?d1m,?s0f", 0xd03a0000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vuc2ifs.s", "?d3m,?s0f", 0xd0380000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vs2i.s", "?d1m,?s0f", 0xd03b0000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vmov.s", "?d0a,?s0a", 0xd0000000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vabs.s", "?d0a,?s0w", 0xd0010000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vneg.s", "?d0a,?s0w", 0xd0020000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsat0.s", "?d0f,?s0a", 0xd0040000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsat1.s", "?d0f,?s0a", 0xd0050000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vzero.s", "?d0a", 0xd0060000, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vone.s", "?d0a", 0xd0070000, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vrcp.s", "?x0a,?s0a", 0xd0100000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vrsq.s", "?x0a,?s0a", 0xd0110000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsin.s", "?x0a,?s0a", 0xd0120000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vcos.s", "?x0a,?s0a", 0xd0130000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vexp2.s", "?x0a,?s0a", 0xd0140000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vlog2.s", "?x0a,?s0a", 0xd0150000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsqrt.s", "?x0a,?s0a", 0xd0160000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vasin.s", "?x0a,?s0a", 0xd0170000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vnrcp.s", "?x0a,?s0f", 0xd0180000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vnsin.s", "?x0a,?s0f", 0xd01a0000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vrexp2.s", "?x0a,?s0f", 0xd01c0000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vrnds.s", "?s0f", 0xd0200000, 0xffff80ff, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vrndi.s", "?d0a", 0xd0210000, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vrndf1.s", "?d0a", 0xd0220000, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vrndf2.s", "?d0a", 0xd0230000, 0xffffff80, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vh2f.s", "?d1a,?s0f", 0xd0330000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsbz.s", "?d0a,?s0a", 0xd0360000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsbn.s", "?d0a,?s0a,?t0a", 0x61000000, 0xff808080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vlgb.s", "?d0a,?s0a", 0xd0370000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vocp.s", "?d0a,?s0f", 0xd0440000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vsocp.s", "?d1f,?s0f", 0xd0450000, 0xffff8080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vf2in.s", "?d0m,?s0a,?b", 0xd2000000, 0xffe08080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vf2iz.s", "?d0m,?s0a,?b", 0xd2200000, 0xffe08080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vf2iu.s", "?d0m,?s0a,?b", 0xd2400000, 0xffe08080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vf2id.s", "?d0m,?s0a,?b", 0xd2600000, 0xffe08080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vi2f.s", "?d0a,?s0w,?b", 0xd2800000, 0xffe08080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vcmov.s", "?d0a,?s0a,?e", 0, (int) M_VCMOV_S, INSN_MACRO, VFPU_REG, ALX, 0, 0 },
+{"vcmovt.s", "?d0a,?s0a,?e", 0xd2a00000, 0xfff88080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vcmovf.s", "?d0a,?s0a,?e", 0xd2a80000, 0xfff88080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vwbn.s", "?d0a,?s0a,?i", 0xd3000000, 0xff008080, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vpfxs", "?0,?1,?2,?3", 0xdc000000, 0xff000000, RD_C2, 0, ALX, 0, 0 },
+{"vpfxt", "?0,?1,?2,?3", 0xdd000000, 0xff000000, RD_C2, 0, ALX, 0, 0 },
+{"vpfxd", "?4,?5,?6,?7", 0xde000000, 0xff000000, RD_C2, 0, ALX, 0, 0 },
+{"viim.s", "?t0a,j", 0xdf000000, 0xff800000, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vfim.s", "?t0a,?u", 0xdf800000, 0xff800000, RD_C2, VFPU_REG, ALX, 0, 0 },
+{"vflush", "", 0xffff040d, 0xffffffff, RD_C2, 0, ALX, 0, 0 },
+{"vsync", "", 0xffff0320, 0xffffffff, RD_C2, 0, ALX, 0, 0 },
+{"vsync", "i", 0xffff0000, 0xffff0000, RD_C2, 0, ALX, 0, 0 },
+
/* User Defined Instruction. */
{"udi0", "s,t,d,+1", 0x70000010, 0xfc00003f, UDI, 0, I33, 0, 0 },
{"udi0", "s,t,+2", 0x70000010, 0xfc00003f, UDI, 0, I33, 0, 0 },
--
2.56.0
More information about the Binutils
mailing list