2013-01-09 Steve Ellcey <sellcey@mips.com>
[binutils-gdb.git] / opcodes / v850-dis.c
index cf0d3860d3688bc4ab6777501689bc0c5c078150..5f9d87b8f8668ce5beb7a2ed7443e39ecf966acb 100644 (file)
@@ -1,6 +1,6 @@
 /* Disassemble V850 instructions.
-   Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2005, 2007, 2010
-   Free Software Foundation, Inc.
+   Copyright 1996, 1997, 1998, 2000, 2001, 2002, 2003, 2005, 2007, 2010,
+   2012  Free Software Foundation, Inc.
 
    This file is part of the GNU opcodes library.
 
@@ -20,9 +20,8 @@
    MA 02110-1301, USA.  */
 
 
-#include <stdio.h>
-
 #include "sysdep.h"
+#include <stdio.h>
 #include "opcode/v850.h"
 #include "dis-asm.h"
 #include "opintl.h"
@@ -310,9 +309,11 @@ disassemble (bfd_vma memaddr, struct disassemble_info *info, int bytes_read, uns
                   We may need to output a trailing ']' if the last operand
                   in an instruction is the register for a memory address.
 
-                  The exception (and there's always an exception) is the
+                  The exception (and there's always an exception) are the
                   "jmp" insn which needs square brackets around it's only
-                  register argument.  */
+                  register argument, and the clr1/not1/set1/tst1 insns
+                  which [...] around their second register argument.  */
+
              prefix = "";
              if (operand->flags & V850_OPERAND_BANG)
                {
@@ -335,6 +336,16 @@ disassemble (bfd_vma memaddr, struct disassemble_info *info, int bytes_read, uns
                  info->fprintf_func (info->stream, "%s[", prefix);
                  square = TRUE;
                }
+             else if (opnum == 2
+                      && (   op->opcode == 0x00e407e0 /* clr1 */
+                          || op->opcode == 0x00e207e0 /* not1 */
+                          || op->opcode == 0x00e007e0 /* set1 */
+                          || op->opcode == 0x00e607e0 /* tst1 */
+                          ))
+               {
+                 info->fprintf_func (info->stream, ", %s[", prefix);
+                 square = TRUE;
+               }               
              else if (opnum > 1)
                info->fprintf_func (info->stream, ", %s", prefix);
 
@@ -407,7 +418,7 @@ disassemble (bfd_vma memaddr, struct disassemble_info *info, int bytes_read, uns
                                  else
                                    shown_one = 1;
 
-                                 info->fprintf_func (info->stream, v850_reg_names[first]);
+                                 info->fprintf_func (info->stream, "%s", v850_reg_names[first]);
 
                                  for (bit++; bit < 32; bit++)
                                    if ((mask & (1 << bit)) == 0)