Remove Intel syntax comments on movsx and movzx
[deliverable/binutils-gdb.git] / opcodes / ns32k-dis.c
index 5e6f0964b7aa626796f64dab47cfbdc2483ce48d..d505edd774267d4c3f93200917a9296792bd4b31 100644 (file)
@@ -1,5 +1,5 @@
 /* Print National Semiconductor 32000 instructions.
-   Copyright (C) 1986-2019 Free Software Foundation, Inc.
+   Copyright (C) 1986-2020 Free Software Foundation, Inc.
 
    This file is part of the GNU opcodes library.
 
@@ -327,8 +327,8 @@ bit_copy (bfd_byte *buffer, int offset, int count, char *to)
 static int
 sign_extend (unsigned int value, unsigned int bits)
 {
-  unsigned int sign = 1u << bits;
-  return ((value & (sign - 1)) ^ sign) - sign;
+  unsigned int sign = 1u << (bits - 1);
+  return ((value & (sign + sign - 1)) ^ sign) - sign;
 }
 
 static void
@@ -347,9 +347,7 @@ flip_bytes (char *ptr, int count)
 }
 \f
 /* Given a character C, does it represent a general addressing mode?  */
-#define Is_gen(c) \
-  ((c) == 'F' || (c) == 'L' || (c) == 'B' \
-   || (c) == 'W' || (c) == 'D' || (c) == 'A' || (c) == 'I' || (c) == 'Z')
+#define Is_gen(c) (strchr ("FLBWDAIZf", (c)) != NULL)
 
 /* Adressing modes.  */
 #define Adrmod_index_byte        0x1c
@@ -808,9 +806,10 @@ print_insn_ns32k (bfd_vma memaddr, disassemble_info *info)
         if we are using scaled indexed addressing mode, since the index
         bytes occur right after the basic instruction, not as part
         of the addressing extension.  */
-      if (Is_gen(d[1]))
+      if (Is_gen (d[1]))
        {
-         int addr_mode = bit_extract (buffer, ioffset - 5, 5);
+         int bitoff = d[1] == 'f' ? 10 : 5;
+         int addr_mode = bit_extract (buffer, ioffset - bitoff, 5);
 
          if (Adrmod_is_index (addr_mode))
            {
@@ -819,7 +818,7 @@ print_insn_ns32k (bfd_vma memaddr, disassemble_info *info)
            }
        }
 
-      if (d[2] && Is_gen(d[3]))
+      if (d[2] && Is_gen (d[3]))
        {
          int addr_mode = bit_extract (buffer, ioffset - 10, 5);
 
This page took 0.024754 seconds and 4 git commands to generate.