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] opcodes/arc: Fix extract for some add_s instructions


The extract function used for some arc_s instructions was not
implemented, and instead always returned 0.  Fixed in this commit.

opcodes/ChangeLog:

	* arc-opc.c (extract_rhv1): Extract value from insn.

gas/ChangeLog:

	* testsuite/gas/arc/add_s.d: New file.
	* testsuite/gas/arc/add_s.s: New file.
---
 gas/ChangeLog                 | 5 +++++
 gas/testsuite/gas/arc/add_s.d | 8 ++++++++
 gas/testsuite/gas/arc/add_s.s | 4 ++++
 opcodes/ChangeLog             | 4 ++++
 opcodes/arc-opc.c             | 2 +-
 5 files changed, 22 insertions(+), 1 deletion(-)
 create mode 100644 gas/testsuite/gas/arc/add_s.d
 create mode 100644 gas/testsuite/gas/arc/add_s.s

diff --git a/gas/testsuite/gas/arc/add_s.d b/gas/testsuite/gas/arc/add_s.d
new file mode 100644
index 0000000..31b60e4
--- /dev/null
+++ b/gas/testsuite/gas/arc/add_s.d
@@ -0,0 +1,8 @@
+#as: -mcpu=arc700
+#objdump: -dr --prefix-addresses --show-raw-insn
+
+.*: +file format .*arc.*
+
+Disassembly of section .text:
+0x[0-9a-f]+ 6178                	add_s	r0,r1,r3
+0x[0-9a-f]+ 70e7                	add_s	r0,r0,pcl
diff --git a/gas/testsuite/gas/arc/add_s.s b/gas/testsuite/gas/arc/add_s.s
new file mode 100644
index 0000000..71b60f8
--- /dev/null
+++ b/gas/testsuite/gas/arc/add_s.s
@@ -0,0 +1,4 @@
+# add_s test
+
+	add_s r0,r1,r3
+	add_s r0,r0,pcl
diff --git a/opcodes/arc-opc.c b/opcodes/arc-opc.c
index 433fdcc..25db868 100644
--- a/opcodes/arc-opc.c
+++ b/opcodes/arc-opc.c
@@ -130,7 +130,7 @@ static int
 extract_rhv1 (unsigned insn ATTRIBUTE_UNUSED,
 	      bfd_boolean * invalid ATTRIBUTE_UNUSED)
 {
-  int value = 0;
+  int value = ((insn & 0x7) << 3) | ((insn >> 5) & 0x7);
 
   return value;
 }
-- 
2.5.1


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