opcodes/arc: Fix extract for some add_s instructions
authorAndrew Burgess <andrew.burgess@embecosm.com>
Tue, 14 Jun 2016 20:48:11 +0000 (21:48 +0100)
committerAndrew Burgess <andrew.burgess@embecosm.com>
Wed, 15 Jun 2016 08:01:48 +0000 (09:01 +0100)
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
gas/testsuite/gas/arc/add_s.d [new file with mode: 0644]
gas/testsuite/gas/arc/add_s.s [new file with mode: 0644]
opcodes/ChangeLog
opcodes/arc-opc.c

index df773936239b0a7fc969fa4a3b7724a15073d4bd..eba7ddf8c1471821ab49ab018db9e02575503837 100644 (file)
@@ -1,3 +1,8 @@
+2016-06-15  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * testsuite/gas/arc/add_s.d: New file.
+       * testsuite/gas/arc/add_s.s: New file.
+
 2016-06-14  Graham Markall <graham.markall@embecosm.com>
 
        * testsuite/gas/arc/nps400-6.s: Add tests of ldbit.
diff --git a/gas/testsuite/gas/arc/add_s.d b/gas/testsuite/gas/arc/add_s.d
new file mode 100644 (file)
index 0000000..31b60e4
--- /dev/null
@@ -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 (file)
index 0000000..71b60f8
--- /dev/null
@@ -0,0 +1,4 @@
+# add_s test
+
+       add_s r0,r1,r3
+       add_s r0,r0,pcl
index ecc5261206a3f3c551b35c279af78484ad8943e0..9ca0760accac3ee80af18f1b0f7bbd5d3ee16d46 100644 (file)
@@ -1,3 +1,7 @@
+2016-06-15  Andrew Burgess  <andrew.burgess@embecosm.com>
+
+       * arc-opc.c (extract_rhv1): Extract value from insn.
+
 2016-06-14  Graham Markall  <graham.markall@embecosm.com>
 
        * arc-nps400-tbl.h: Add ldbit instruction.
index 433fdcc9ab1fe1b2877182238e350aa90fbc09ca..25db8684ca3b66a941495e14ba5e880478f11abf 100644 (file)
@@ -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;
 }