[ARC] Fix decoding of w6 signed short immediate.
authorClaudiu Zissulescu <claziss@gmail.com>
Mon, 23 Jul 2018 09:09:43 +0000 (11:09 +0200)
committerClaudiu Zissulescu <claziss@gmail.com>
Mon, 23 Jul 2018 09:09:43 +0000 (11:09 +0200)
gas/
  Claudiu Zissulescu  <claziss@synopsys.com>

        * testsuite/gas/arc/st.d: Fix test.

opcodes/
  Claudiu Zissulescu  <claziss@synopsys.com>

        * arc-opc.c (extract_w6): Fix extending the sign.

gas/ChangeLog
gas/testsuite/gas/arc/st.d
opcodes/ChangeLog
opcodes/arc-opc.c

index dbaa02d9e1567d8ef70a8d1e3d671454cb1c0fff..8b3624648df3427f475d18e303f7b3ed95b5b2a7 100644 (file)
@@ -1,3 +1,7 @@
+2018-07-23  Claudiu Zissulescu <claziss@synopsys.com>
+
+       * testsuite/gas/arc/st.d: Fix test.
+
 2018-07-23  Claudiu Zissulescu <claziss@synopsys.com>
 
        * config/tc-arc.c (tokenize_extinsn): Convert to lower case the
index 6fe5b88aefa1952b5540f89e5e6940864aef3cb3..269b2cf46d2c553e6e7b6d30ebcb3cd3c18b7c49 100644 (file)
@@ -13,7 +13,7 @@ Disassembly of section .text:
   10:  1a02 004c               st[hw]+.aw      r1,\[r2,2\]
   14:  1e00 7040 0000 0384     st      r1,\[0x384\]
   1c:  1a00 0003               stb     0,\[r2\]
-  20:  1af8 8e01               st      56,\[r2,-8\]
+  20:  1af8 8e01               st      -8,\[r2,-8\]
   24:  1e00 7080 0000 0000     st      r2,\[0\]
                        28: R_ARC_32_ME foo
   2c:  1a02 0060               st.di   r1,\[r2,2\]
index 9d0de43190233aa9720f6c1ca46baea72381a857..d99b85cf776cd2fd89649e02edfdfd1791439873 100644 (file)
@@ -1,3 +1,7 @@
+2018-07-23  Claudiu Zissulescu <claziss@synopsys.com>
+
+       * arc-opc.c (extract_w6): Fix extending the sign.
+
 2018-07-23  Claudiu Zissulescu <claziss@synopsys.com>
 
        * arc-tbl.h (vewt): Allow it for ARC EM family.
index 5349e13031303237711732a9c9ff0d30d7e8f49e..b87a231485934d735e30107397698e88dd0838db 100644 (file)
@@ -651,10 +651,14 @@ static long long
 extract_w6 (unsigned long long  insn,
            bfd_boolean *       invalid ATTRIBUTE_UNUSED)
 {
-  unsigned value = 0;
+  int value = 0;
 
   value |= ((insn >> 6) & 0x003f) << 0;
 
+  /* Extend the sign.  */
+  int signbit = 1 << 5;
+  value = (value ^ signbit) - signbit;
+
   return value;
 }
 
This page took 0.028089 seconds and 4 git commands to generate.