forked from Imagelibrary/binutils-gdb
* mips.h: Assign 'm'/'M' codes to MIPS16e save/restore
instructions. Define MIPS16_ALL_ARGS and MIPS16_ALL_STATICS for
save/restore encoding of the args field.
* mips16-opc.c: Add MIPS16e save/restore opcodes.
* mips-dis.c (print_mips16_insn_arg): Handle printing of 'm'/'M'
codes for save/restore.
* config/tc-mips.c (mips16_ip): Add handling of 'm' and 'M' codes
for the MIPS16e save/restore instructions.
* gas/mips/mips.exp: Run new save/restore tests.
* gas/testsuite/gas/mips/mips16e-save.s: New test for generating
different styles of save/restore instructions.
* gas/testsuite/gas/mips/mips16e-save.d: New.
This commit is contained in:
@@ -1,3 +1,9 @@
|
||||
2005-11-14 David Ung <davidu@mips.com>
|
||||
|
||||
* mips16-opc.c: Add MIPS16e save/restore opcodes.
|
||||
* mips-dis.c (print_mips16_insn_arg): Handle printing of 'm'/'M'
|
||||
codes for save/restore.
|
||||
|
||||
2005-11-10 Andreas Schwab <schwab@suse.de>
|
||||
|
||||
* m68k-dis.c (print_insn_m68k): Only match FPU insns with
|
||||
|
||||
@@ -1656,6 +1656,92 @@ print_mips16_insn_arg (char type,
|
||||
}
|
||||
break;
|
||||
|
||||
case 'm':
|
||||
case 'M':
|
||||
/* MIPS16e save/restore. */
|
||||
{
|
||||
int need_comma = 0;
|
||||
int amask, args, statics;
|
||||
int nsreg, smask;
|
||||
int framesz;
|
||||
int i, j;
|
||||
|
||||
l = l & 0x7f;
|
||||
if (use_extend)
|
||||
l |= extend << 16;
|
||||
|
||||
amask = (l >> 16) & 0xf;
|
||||
if (amask == MIPS16_ALL_ARGS)
|
||||
{
|
||||
args = 4;
|
||||
statics = 0;
|
||||
}
|
||||
else if (amask == MIPS16_ALL_STATICS)
|
||||
{
|
||||
args = 0;
|
||||
statics = 4;
|
||||
}
|
||||
else
|
||||
{
|
||||
args = amask >> 2;
|
||||
statics = amask & 3;
|
||||
}
|
||||
|
||||
if (args > 0) {
|
||||
(*info->fprintf_func) (info->stream, "%s", mips_gpr_names[4]);
|
||||
if (args > 1)
|
||||
(*info->fprintf_func) (info->stream, "-%s",
|
||||
mips_gpr_names[4 + args - 1]);
|
||||
need_comma = 1;
|
||||
}
|
||||
|
||||
framesz = (((l >> 16) & 0xf0) | (l & 0x0f)) * 8;
|
||||
if (framesz == 0 && !use_extend)
|
||||
framesz = 128;
|
||||
|
||||
(*info->fprintf_func) (info->stream, "%s%d",
|
||||
need_comma ? "," : "",
|
||||
framesz);
|
||||
|
||||
if (l & 0x40) /* $ra */
|
||||
(*info->fprintf_func) (info->stream, ",%s", mips_gpr_names[31]);
|
||||
|
||||
nsreg = (l >> 24) & 0x7;
|
||||
smask = 0;
|
||||
if (l & 0x20) /* $s0 */
|
||||
smask |= 1 << 0;
|
||||
if (l & 0x10) /* $s1 */
|
||||
smask |= 1 << 1;
|
||||
if (nsreg > 0) /* $s2-$s8 */
|
||||
smask |= ((1 << nsreg) - 1) << 2;
|
||||
|
||||
/* Find first set static reg bit. */
|
||||
for (i = 0; i < 9; i++)
|
||||
{
|
||||
if (smask & (1 << i))
|
||||
{
|
||||
(*info->fprintf_func) (info->stream, ",%s",
|
||||
mips_gpr_names[i == 8 ? 30 : (16 + i)]);
|
||||
/* Skip over string of set bits. */
|
||||
for (j = i; smask & (2 << j); j++)
|
||||
continue;
|
||||
if (j > i)
|
||||
(*info->fprintf_func) (info->stream, "-%s",
|
||||
mips_gpr_names[j == 8 ? 30 : (16 + j)]);
|
||||
i = j + 1;
|
||||
}
|
||||
}
|
||||
|
||||
/* Statics $ax - $a3. */
|
||||
if (statics == 1)
|
||||
(*info->fprintf_func) (info->stream, ",%s", mips_gpr_names[7]);
|
||||
else if (statics > 0)
|
||||
(*info->fprintf_func) (info->stream, ",%s-%s",
|
||||
mips_gpr_names[7 - statics + 1],
|
||||
mips_gpr_names[7]);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
/* xgettext:c-format */
|
||||
(*info->fprintf_func)
|
||||
|
||||
@@ -226,6 +226,8 @@ const struct mips_opcode mips16_opcodes[] =
|
||||
{"jalrc", "R,x", 0xe8c0, 0xf8ff, WR_31|RD_x|TRAP, 0, 0 },
|
||||
{"jrc", "x", 0xe880, 0xf8ff, RD_x|TRAP, 0, 0 },
|
||||
{"jrc", "R", 0xe8a0, 0xffff, RD_31|TRAP, 0, 0 },
|
||||
{"restore", "M", 0x6400, 0xff80, WR_31|RD_SP|WR_SP|TRAP, 0, 0 },
|
||||
{"save", "m", 0x6480, 0xff80, RD_31|RD_SP|WR_SP|TRAP, 0, 0 },
|
||||
{"seb", "x", 0xe891, 0xf8ff, WR_x|RD_x, 0, 0 },
|
||||
{"seh", "x", 0xe8b1, 0xf8ff, WR_x|RD_x, 0, 0 },
|
||||
{"sew", "x", 0xe8d1, 0xf8ff, WR_x|RD_x, 0, I3 },
|
||||
|
||||
Reference in New Issue
Block a user