This is the mail archive of the binutils@sourceware.org mailing list for the binutils project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[PATCH, moxie] Limit moxie sto/ldo offsets to 16-bits.


I'm checking in the attached patch to switch ldo/sto offsets to 16 bits
from 32.  This was a long overdue backwards incompatible change to the
ISA.  The corresponding GCC change has already been committed.

>From gas...

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.


>From include/opcode...

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.

>From opcodes...

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.



diff --git a/gas/config/tc-moxie.c b/gas/config/tc-moxie.c
index 02a59b7..fdd100c 100644
--- a/gas/config/tc-moxie.c
+++ b/gas/config/tc-moxie.c
@@ -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 != '(')
 	  {
diff --git a/include/opcode/moxie.h b/include/opcode/moxie.h
index 6c5a003..f220e38 100644
--- a/include/opcode/moxie.h
+++ b/include/opcode/moxie.h
@@ -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
diff --git a/opcodes/moxie-dis.c b/opcodes/moxie-dis.c
index 90e0464..923dda1 100644
--- a/opcodes/moxie-dis.c
+++ b/opcodes/moxie-dis.c
@@ -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:
diff --git a/opcodes/moxie-opc.c b/opcodes/moxie-opc.c
index a858088..b3603c9 100644
--- a/opcodes/moxie-opc.c
+++ b/opcodes/moxie-opc.c
@@ -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" },


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]