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] NIOS2: Add rdprs instruction


I do not have commit access.  If someone approves this patch, please
commit it also.

2013-03-09  Sebastian Huber <sebastian.huber@embedded-brains.de>
	* opcode/nios2.h (OP_RDPRS): New define.
	(OP_MATCH_RDPRS): Likewise.

2013-03-09  Sebastian Huber <sebastian.huber@embedded-brains.de>

	* nios2-opc.c (nios2_builtin_opcodes): Add entry for rdprs.

2013-03-09  Sebastian Huber <sebastian.huber@embedded-brains.de>

	* gas/nios2/nios2.exp: Run rdprs.
	* gas/nios2/rdprs.d: New file.
	* gas/nios2/rdprs.s: Likewise.
---
 gas/testsuite/gas/nios2/nios2.exp |    1 +
 gas/testsuite/gas/nios2/rdprs.d   |   10 ++++++++++
 gas/testsuite/gas/nios2/rdprs.s   |    5 +++++
 include/opcode/nios2.h            |    2 ++
 opcodes/nios2-opc.c               |    2 ++
 5 files changed, 20 insertions(+)
 create mode 100644 gas/testsuite/gas/nios2/rdprs.d
 create mode 100644 gas/testsuite/gas/nios2/rdprs.s

diff --git a/gas/testsuite/gas/nios2/nios2.exp b/gas/testsuite/gas/nios2/nios2.exp
index 13be1c1..173db00 100644
--- a/gas/testsuite/gas/nios2/nios2.exp
+++ b/gas/testsuite/gas/nios2/nios2.exp
@@ -53,6 +53,7 @@ if { [istarget nios2-*-*] } then {
     run_dump_test "ret"
     run_dump_test "rotate"
     run_dump_test "registers"
+    run_dump_test "rdprs"
     
     run_dump_test "stw"
     run_dump_test "sth"
diff --git a/gas/testsuite/gas/nios2/rdprs.d b/gas/testsuite/gas/nios2/rdprs.d
new file mode 100644
index 0000000..2cce2f6
--- /dev/null
+++ b/gas/testsuite/gas/nios2/rdprs.d
@@ -0,0 +1,10 @@
+#objdump: -dr --prefix-addresses
+#name: NIOS2 rdprs
+
+# Test the rdprs instruction
+
+.*: +file format elf32-littlenios2
+
+Disassembly of section .text:
+0+0000 <[^>]*> rdprs	r2,sp,123
+0+0004 <[^>]*> rdprs	r2,sp,-123
diff --git a/gas/testsuite/gas/nios2/rdprs.s b/gas/testsuite/gas/nios2/rdprs.s
new file mode 100644
index 0000000..1e4a514
--- /dev/null
+++ b/gas/testsuite/gas/nios2/rdprs.s
@@ -0,0 +1,5 @@
+# Source file used to test the rdprs instruction
+
+foo:
+	rdprs r2, sp, 123
+	rdprs r2, sp, -123
diff --git a/include/opcode/nios2.h b/include/opcode/nios2.h
index 85e7023..83773d5 100644
--- a/include/opcode/nios2.h
+++ b/include/opcode/nios2.h
@@ -289,6 +289,7 @@ struct nios2_reg
 #define OP_OPX 58
 #define OP_ORHI 52
 #define OP_ORI 20
+#define OP_RDPRS 56
 #define OP_STB 5
 #define OP_STBIO 37
 #define OP_STC 29
@@ -386,6 +387,7 @@ struct nios2_reg
 #define OP_MATCH_OPX		OP_OPX
 #define OP_MATCH_ORHI		OP_ORHI
 #define OP_MATCH_ORI		OP_ORI
+#define OP_MATCH_RDPRS		OP_RDPRS
 #define OP_MATCH_STB		OP_STB
 #define OP_MATCH_STBIO		OP_STBIO
 #define OP_MATCH_STC		OP_STC
diff --git a/opcodes/nios2-opc.c b/opcodes/nios2-opc.c
index ff24652..3c51343 100644
--- a/opcodes/nios2-opc.c
+++ b/opcodes/nios2-opc.c
@@ -343,6 +343,8 @@ const struct nios2_opcode nios2_builtin_opcodes[] =
    OP_MATCH_ORHI, OP_MASK_IOP, 0, unsigned_immed16_overflow},
   {"ori", "t,s,u", "t,s,u,E", 3,
    OP_MATCH_ORI, OP_MASK_IOP, NIOS2_INSN_ORI, unsigned_immed16_overflow},
+  {"rdprs", "t,s,i", "t,s,i,E", 3,
+   OP_MATCH_RDPRS, OP_MASK_IOP, 0, unsigned_immed16_overflow},
   {"rdctl", "d,c", "d,c,E", 2,
    OP_MATCH_RDCTL, OP_MASK_RDCTL, 0, no_overflow},
   {"ret", "", "E", 0,
-- 
1.7.10.4


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