[PATCH] ARC incorrect encoding of ST limm, [shimm, shimm] instruction

Stacey Sheldon ssheldon@Catena.com
Thu Jun 21 07:27:00 GMT 2001


This patch fixes the following problem in the ARC target:

The assembler encodes:
   st limm, [shimm, shimm]
as:
   st shimm, [shimm, shimm]
when (limm == 2*shimm)

This appears to be an attempt at optimizing the encoding
from a 64bit --> 32bit opcode.  Doing this, however, yields
the wrong result as seen in:
   st 0x100, [0x80, 0x80]
      encoded as 101FFE80 (big endian)
which results in a store of 0x80 to address 0x100 (wrong) instead
of storing 0x100 to address 0x100 (right).

Removing this bit of code results in the the limm value remaining
limm, and being encoded correctly.

Note: This diff should be applied after the one in 2001-06/msg00555

Please let me know if there are any problems with this patch.

Stacey.


diff -p -r1.5 arc-opc.c
*** binutils/opcodes/arc-opc.c	2001/06/20 17:30:45	1.5
--- binutils/opcodes/arc-opc.c	2001/06/20 19:08:57
*************** insert_st_syntax (insn, operand, mods, r
*** 1154,1167 ****
      {
        limm += arc_limm_fixup_adjust(insn);
      }
-   if (ST_SYNTAX(OP_LIMM,OP_SHIMM,OP_SHIMM) && (shimm * 2 == limm))
-     {
-       insn &= ~C(-1);
-       limm_p = 0;
-       limm = 0;
-       insn |= C(ARC_REG_SHIMM);
-       ls_operand[LS_VALUE] = OP_SHIMM;
-     }
    if (!(ST_SYNTAX(OP_REG,OP_REG,OP_NONE)
  	|| ST_SYNTAX(OP_REG,OP_LIMM,OP_NONE)
  	|| ST_SYNTAX(OP_REG,OP_REG,OP_SHIMM)
--- 1154,1159 ----



More information about the Binutils mailing list