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, microblaze, gas, opcodes] Add support for swapb and swaph insns


Add swap byte (swapb) and swap halfword (swaph) opcodes.

swapb: swaps the contents of rA treated as 4 bytes, and place in rD,
effectively converting between endianness formats

swaph: swaps the contents of rA treated as 2 halfwords, and place in rD,
converting the 2 halfwords in the register between endianness formats.

Expand gas/testsuite/microblaze/gas/allinsn to include swapb and swaph



binutils/opcodes/Changelog

 2012-11-08  David Holsgrove  <david.holsgrove@xilinx.com>

          * microblaze-opc.h (op_code_struct): Add swapb, swaph
            Increase MAX_OPCODES.
          * microblaze-opcm.h (microblaze_instr): Likewise


binutils/gas/testsuite/Changelog

 2012-11-08  David Holsgrove  <david.holsgrove@xilinx.com>

          * gas/microblaze/allinsn.s: Add swapb, swaph
          * gas/microblaze/allinsn.d: Likewise

From 05ba351eebcaacebf9366bf418031f605fa7f9c7 Mon Sep 17 00:00:00 2001
From: Nagaraju Mekala <nagaraju.mekala@xilinx.com>
Date: Tue, 28 Feb 2012 15:23:52 +0530
Subject: [PATCH] opcodes/ * microblaze-opc.h: Add support for swapb and swaph insns

Add swap byte (swapb) and swap halfword (swaph) opcodes.

swapb: swaps the contents of rA treated as 4 bytes, and place in rD,
effectively converting between endianness formats

swaph: swaps the contents of rA treated as 2 halfwords, and place in rD,
converting the 2 halfwords in the register between endianness formats.

Expand gas/testsuite/microblaze/gas/allinsn to include swapb and swaph

Signed-off-by: Nagaraju Mekala <nagaraju.mekala@xilinx.com>
Signed-off-by: David Holsgrove <david.holsgrove@xilinx.com>
Signed-off-by: Edgar E. Iglesias <edgar.iglesias@gmail.com>
---
 gas/testsuite/gas/microblaze/allinsn.d |    6 ++++++
 gas/testsuite/gas/microblaze/allinsn.s |    8 ++++++++
 opcodes/microblaze-opc.h               |    4 +++-
 opcodes/microblaze-opcm.h              |    2 +-
 4 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/gas/testsuite/gas/microblaze/allinsn.d b/gas/testsuite/gas/microblaze/allinsn.d
index 4a03340..b454fdb 100644
--- a/gas/testsuite/gas/microblaze/allinsn.d
+++ b/gas/testsuite/gas/microblaze/allinsn.d
@@ -41,3 +41,9 @@ Disassembly of section .text:
   30:	b0000000 	imm	0
   34:	31600000 	addik	r11, r0, 0
   38:	940bc802 	mts	rshr, r11
+
+0000003c <swapb>:
+  3c:	900001e0 	swapb	r0, r0
+
+00000040 <swaph>:
+  40:	900001e2 	swaph	r0, r0
diff --git a/gas/testsuite/gas/microblaze/allinsn.s b/gas/testsuite/gas/microblaze/allinsn.s
index 437444f..ffe91ca 100644
--- a/gas/testsuite/gas/microblaze/allinsn.s
+++ b/gas/testsuite/gas/microblaze/allinsn.s
@@ -46,4 +46,12 @@ regslr:
 regshr:
     la r11,r0,r0
     mts rshr,r11
+    .text
+    .global swapb
+swapb:
+    swapb r0,r0
+    .text
+    .global swaph
+swaph:
+    swaph r0,r0
 
diff --git a/opcodes/microblaze-opc.h b/opcodes/microblaze-opc.h
index 0447fc5..404985b 100644
--- a/opcodes/microblaze-opc.h
+++ b/opcodes/microblaze-opc.h
@@ -101,7 +101,7 @@
 #define DELAY_SLOT 1
 #define NO_DELAY_SLOT 0
 
-#define MAX_OPCODES 287
+#define MAX_OPCODES 289
 
 struct op_code_struct
 {
@@ -402,6 +402,8 @@ struct op_code_struct
   {"clz",       INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900000E0, OPCODE_MASK_H34,  clz,       special_inst },
   {"mbar",      INST_TYPE_IMM5,  INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xB8020004, OPCODE_MASK_HN,   mbar,      special_inst },
   {"sleep",     INST_TYPE_NONE,  INST_PC_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0xBA020004, OPCODE_MASK_HN,   invalid_inst, special_inst }, /* translates to mbar 16.  */
+  {"swapb",     INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E0, OPCODE_MASK_H4,   swapb,     arithmetic_inst },
+  {"swaph",     INST_TYPE_RD_R1, INST_NO_OFFSET, NO_DELAY_SLOT, IMMVAL_MASK_NON_SPECIAL, 0x900001E2, OPCODE_MASK_H4,   swaph,     arithmetic_inst },
   {"", 0, 0, 0, 0, 0, 0, 0, 0},
 };
 
diff --git a/opcodes/microblaze-opcm.h b/opcodes/microblaze-opcm.h
index 1f5d85a..71de752 100644
--- a/opcodes/microblaze-opcm.h
+++ b/opcodes/microblaze-opcm.h
@@ -27,7 +27,7 @@ enum microblaze_instr
 {
   add, rsub, addc, rsubc, addk, rsubk, addkc, rsubkc, clz, cmp, cmpu,
   addi, rsubi, addic, rsubic, addik, rsubik, addikc, rsubikc, mul, 
-  mulh, mulhu, mulhsu,
+  mulh, mulhu, mulhsu,swapb,swaph,
   idiv, idivu, bsll, bsra, bsrl, get, put, nget, nput, cget, cput,
   ncget, ncput, muli, bslli, bsrai, bsrli, mului, or, and, xor,
   andn, pcmpbf, pcmpbc, pcmpeq, pcmpne, sra, src, srl, sext8, sext16, 
-- 
1.7.0.4


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