Limit moxie sto/ldo offsets to 16 bits

This commit is contained in:
Anthony Green 2014-12-27 10:57:04 -05:00
parent 3b14628444
commit bffb60047d
7 changed files with 44 additions and 28 deletions

View File

@ -1,3 +1,8 @@
2014-12-27 Anthony Green <green@moxielogic.com
* config/tc-moxie.c (md_assemble): ldo/sto instructions now use a
16 bit offset instead of 32.
2014-12-25 Yaakov Selkowitz <yselkowi@redhat.com>
PR gas/17753

View File

@ -404,7 +404,7 @@ md_assemble (char *str)
iword += (a << 4);
}
break;
case MOXIE_F1_ABi4:
case MOXIE_F1_ABi2:
iword = opcode->opcode << 8;
while (ISSPACE (*op_end))
op_end++;
@ -426,13 +426,13 @@ md_assemble (char *str)
op_end++;
op_end = parse_exp_save_ilp (op_end, &arg);
offset = frag_more (4);
offset = frag_more (2);
fix_new_exp (frag_now,
(offset - frag_now->fr_literal),
4,
2,
&arg,
0,
BFD_RELOC_32);
BFD_RELOC_16);
if (*op_end != '(')
{
@ -458,7 +458,7 @@ md_assemble (char *str)
iword += (a << 4) + b;
}
break;
case MOXIE_F1_AiB4:
case MOXIE_F1_AiB2:
iword = opcode->opcode << 8;
while (ISSPACE (*op_end))
op_end++;
@ -468,13 +468,13 @@ md_assemble (char *str)
int a, b;
op_end = parse_exp_save_ilp (op_end, &arg);
offset = frag_more (4);
offset = frag_more (2);
fix_new_exp (frag_now,
(offset - frag_now->fr_literal),
4,
2,
&arg,
0,
BFD_RELOC_32);
BFD_RELOC_16);
if (*op_end != '(')
{

View File

@ -1,3 +1,8 @@
2014-12-27 Anthony Green <green@moxielogic.com>
* moxie.h (MOXIE_F1_AiB2, MOXIE_F1_ABi2): Renamed from
MOXIE_F1_AiB4 and MOXIE_F1_ABi2.
2014-12-06 Eric Botcazou <ebotcazou@adacore.com>
* visium.h: New file.

View File

@ -28,8 +28,8 @@
Some use B and an indirect A (MOXIE_F1_AiB)
Some use A and an indirect B (MOXIE_F1_ABi)
Some consume a 4 byte immediate value and use X (MOXIE_F1_4A)
Some use B and an indirect A plus 4 bytes (MOXIE_F1_AiB4)
Some use A and an indirect B plus 4 bytes (MOXIE_F1_ABi4)
Some use B and an indirect A plus 2 byte offset (MOXIE_F1_AiB2)
Some use A and an indirect B plus 2 byte offset (MOXIE_F1_ABi2)
Form 2 instructions also come in different flavors:
@ -50,8 +50,8 @@
#define MOXIE_F1_AiB 0x106
#define MOXIE_F1_ABi 0x107
#define MOXIE_F1_4A 0x108
#define MOXIE_F1_AiB4 0x109
#define MOXIE_F1_ABi4 0x10a
#define MOXIE_F1_AiB2 0x109
#define MOXIE_F1_ABi2 0x10a
#define MOXIE_F1_M 0x10b
#define MOXIE_F2_NARG 0x200

View File

@ -1,3 +1,9 @@
2014-12-27 Anthony Green <green@moxielofic.com
* moxie-opc.c (moxie_form1_opc_info): sto/ldo are now encoded with
16-bit immediat values instead of 32.
* moxie-dis.c (print_insn_moxie): Ditto.
2014-12-24 Anthony Green <green@moxielogic.com>
* moxie-opc: Define mul.x and umul.x instructions. Remove

View File

@ -140,37 +140,37 @@ print_insn_moxie (bfd_vma addr, struct disassemble_info * info)
length = 6;
}
break;
case MOXIE_F1_AiB4:
case MOXIE_F1_AiB2:
{
unsigned imm;
if ((status = info->read_memory_func (addr+2, buffer, 4, info)))
if ((status = info->read_memory_func (addr+2, buffer, 2, info)))
goto fail;
if (info->endian == BFD_ENDIAN_BIG)
imm = bfd_getb32 (buffer);
imm = bfd_getb16 (buffer);
else
imm = bfd_getl32 (buffer);
imm = bfd_getl16 (buffer);
fpr (stream, "%s\t0x%x(%s), %s", opcode->name,
imm,
reg_names[OP_A(iword)],
reg_names[OP_B(iword)]);
length = 6;
length = 4;
}
break;
case MOXIE_F1_ABi4:
case MOXIE_F1_ABi2:
{
unsigned imm;
if ((status = info->read_memory_func (addr+2, buffer, 4, info)))
if ((status = info->read_memory_func (addr+2, buffer, 2, info)))
goto fail;
if (info->endian == BFD_ENDIAN_BIG)
imm = bfd_getb32 (buffer);
imm = bfd_getb16 (buffer);
else
imm = bfd_getl32 (buffer);
imm = bfd_getl16 (buffer);
fpr (stream, "%s\t%s, 0x%x(%s)",
opcode->name,
reg_names[OP_A(iword)],
imm,
reg_names[OP_B(iword)]);
length = 6;
length = 4;
}
break;
case MOXIE_BAD:

View File

@ -64,8 +64,8 @@ const moxie_opc_info_t moxie_form1_opc_info[128] =
{ 0x09, MOXIE_F1_4A, "sta.l" },
{ 0x0a, MOXIE_F1_ABi, "ld.l" },
{ 0x0b, MOXIE_F1_AiB, "st.l" },
{ 0x0c, MOXIE_F1_ABi4, "ldo.l" },
{ 0x0d, MOXIE_F1_AiB4, "sto.l" },
{ 0x0c, MOXIE_F1_ABi2, "ldo.l" },
{ 0x0d, MOXIE_F1_AiB2, "sto.l" },
{ 0x0e, MOXIE_F1_AB, "cmp" },
{ 0x0f, MOXIE_F1_NARG, "nop" },
{ 0x10, MOXIE_F1_AB, "sex.b" },
@ -106,10 +106,10 @@ const moxie_opc_info_t moxie_form1_opc_info[128] =
{ 0x33, MOXIE_F1_AB, "mod" },
{ 0x34, MOXIE_F1_AB, "umod" },
{ 0x35, MOXIE_F1_NARG, "brk" },
{ 0x36, MOXIE_F1_ABi4, "ldo.b" },
{ 0x37, MOXIE_F1_AiB4, "sto.b" },
{ 0x38, MOXIE_F1_ABi4, "ldo.s" },
{ 0x39, MOXIE_F1_AiB4, "sto.s" },
{ 0x36, MOXIE_F1_ABi2, "ldo.b" },
{ 0x37, MOXIE_F1_AiB2, "sto.b" },
{ 0x38, MOXIE_F1_ABi2, "ldo.s" },
{ 0x39, MOXIE_F1_AiB2, "sto.s" },
{ 0x3a, MOXIE_BAD, "bad" },
{ 0x3b, MOXIE_BAD, "bad" },
{ 0x3c, MOXIE_BAD, "bad" },