MIPS16/opcodes: Reformat raw EXTEND and undecoded output
authorMaciej W. Rozycki <macro@imgtec.com>
Fri, 9 Dec 2016 22:27:00 +0000 (22:27 +0000)
committerMaciej W. Rozycki <macro@imgtec.com>
Fri, 9 Dec 2016 23:18:06 +0000 (23:18 +0000)
Use a tab rather than a space to separate `extend' and its uninterpreted
argument output, like with regular instructions.  Separate hexadecimal
halves of undecoded extended instructions output with a space instead of
presenting them concatenated.

opcodes/
* mips-dis.c (print_insn_mips16): Use a tab rather than a space
to separate `extend' and its uninterpreted argument output.
Separate hexadecimal halves of undecoded extended instructions
output.

binutils/
* testsuite/binutils-all/mips/mips16-extend-noinsn.d: New test.
* testsuite/binutils-all/mips/mips16-extend-noinsn.s: New test
source.
* testsuite/binutils-all/mips/mips.exp: Run the new test.

binutils/ChangeLog
binutils/testsuite/binutils-all/mips/mips.exp
binutils/testsuite/binutils-all/mips/mips16-extend-noinsn.d [new file with mode: 0644]
binutils/testsuite/binutils-all/mips/mips16-extend-noinsn.s [new file with mode: 0644]
opcodes/ChangeLog
opcodes/mips-dis.c

index f41e4fff428e512b1dd46284763361d43c3f9a41..9d5c119424df204121db66877f27142222074282 100644 (file)
@@ -1,3 +1,10 @@
+2016-12-09  Maciej W. Rozycki  <macro@imgtec.com>
+
+       * testsuite/binutils-all/mips/mips16-extend-noinsn.d: New test.
+       * testsuite/binutils-all/mips/mips16-extend-noinsn.s: New test
+       source.
+       * testsuite/binutils-all/mips/mips.exp: Run the new test.
+
 2016-12-08  Maciej W. Rozycki  <macro@imgtec.com>
 
        * testsuite/binutils-all/mips/mips16-pcrel.d: New test.
index 5dc872d7ef428956c20a09b3ad4fcaeebf6cf60b..f3d956f4b255a0de4bf3ba8bf795016a649ce989 100644 (file)
@@ -25,4 +25,5 @@ if [is_elf_format] {
     run_dump_test "mixed-mips16-micromips"
     run_dump_test "mips16-undecoded"
     run_dump_test "mips16-pcrel"
+    run_dump_test "mips16-extend-noinsn"
 }
diff --git a/binutils/testsuite/binutils-all/mips/mips16-extend-noinsn.d b/binutils/testsuite/binutils-all/mips/mips16-extend-noinsn.d
new file mode 100644 (file)
index 0000000..5694de6
--- /dev/null
@@ -0,0 +1,33 @@
+#PROG: objcopy
+#objdump: -d --prefix-addresses --show-raw-insn
+#name: MIPS16 unsupported EXTEND and undefined opcode disassembly
+#as: -32
+
+# Verify raw hexadecimal EXTEND and inexistent opcode disassembly.
+
+.*: +file format .*mips.*
+
+Disassembly of section \.text:
+[0-9a-f]+ <[^>]*> 6500         nop
+[0-9a-f]+ <[^>]*> f123         extend  0x123
+[0-9a-f]+ <[^>]*> f456         extend  0x456
+[0-9a-f]+ <[^>]*> f765         extend  0x765
+[0-9a-f]+ <[^>]*> 1800 0000    jal     00000000 <foo>
+[0-9a-f]+ <[^>]*> 6500         nop
+[0-9a-f]+ <[^>]*> f432         extend  0x432
+[0-9a-f]+ <[^>]*> 1c00 0000    jalx    00000000 <foo>
+[0-9a-f]+ <[^>]*> 6500         nop
+[0-9a-f]+ <[^>]*> f123 6621    0xf123 0x6621
+[0-9a-f]+ <[^>]*> f456 e935    0xf456 0xe935
+[0-9a-f]+ <[^>]*> f765 ea60    0xf765 0xea60
+[0-9a-f]+ <[^>]*> f432 ece0    0xf432 0xece0
+[0-9a-f]+ <[^>]*> f5aa e971    0xf5aa 0xe971
+[0-9a-f]+ <[^>]*> f655 ebf1    0xf655 0xebf1
+[0-9a-f]+ <[^>]*> 6621         0x6621
+[0-9a-f]+ <[^>]*> e935         0xe935
+[0-9a-f]+ <[^>]*> ea60         0xea60
+[0-9a-f]+ <[^>]*> ece0         0xece0
+[0-9a-f]+ <[^>]*> e971         0xe971
+[0-9a-f]+ <[^>]*> ebf1         0xebf1
+[0-9a-f]+ <[^>]*> 6500         nop
+       \.\.\.
diff --git a/binutils/testsuite/binutils-all/mips/mips16-extend-noinsn.s b/binutils/testsuite/binutils-all/mips/mips16-extend-noinsn.s
new file mode 100644 (file)
index 0000000..252cacf
--- /dev/null
@@ -0,0 +1,25 @@
+       .set    mips16
+foo:
+       nop
+       .half   0xf123, 0xf456
+       .half   0xf765
+       jal     bar
+       .half   0xf432
+       jalx    baz
+       .half   0xf123, 0x6621
+       .half   0xf456, 0xe935
+       .half   0xf765, 0xea60
+       .half   0xf432, 0xece0
+       .half   0xf5aa, 0xe971
+       .half   0xf655, 0xebf1
+       .half   0x6621
+       .half   0xe935
+       .half   0xea60
+       .half   0xece0
+       .half   0xe971
+       .half   0xebf1
+       nop
+
+# Force some (non-delay-slot) zero bytes, to make 'objdump' print ...
+       .align  4, 0
+       .space  16
index 1e5ca723106d0eef0898993f9f1ac5c2745b747a..0d0e18669bca6a075a9fe1c5d48de9a0f614c8fb 100644 (file)
@@ -1,3 +1,10 @@
+2016-12-09  Maciej W. Rozycki  <macro@imgtec.com>
+
+       * mips-dis.c (print_insn_mips16): Use a tab rather than a space
+       to separate `extend' and its uninterpreted argument output.
+       Separate hexadecimal halves of undecoded extended instructions
+       output.
+
 2016-12-08  Maciej W. Rozycki  <macro@imgtec.com>
 
        * mips-dis.c (print_mips16_insn_arg): Remove extraneous
index c23e369972b0c9a1a93cfc0a7566a9d1b857ef42..b3daacd1c65f1fff48ef147127d7e0b5d30f09b5 100644 (file)
@@ -2042,7 +2042,7 @@ print_insn_mips16 (bfd_vma memaddr, struct disassemble_info *info)
       status = (*info->read_memory_func) (memaddr, buffer, 2, info);
       if (status != 0)
        {
-         infprintf (is, "extend 0x%x", (unsigned int) extend);
+         infprintf (is, "extend\t0x%x", (unsigned int) extend);
          (*info->memory_error_func) (status, memaddr, info);
          return -1;
        }
@@ -2055,7 +2055,7 @@ print_insn_mips16 (bfd_vma memaddr, struct disassemble_info *info)
       /* Check for an extend opcode followed by an extend opcode.  */
       if ((insn & 0xf800) == 0xf000)
        {
-         infprintf (is, "extend 0x%x", (unsigned int) extend);
+         infprintf (is, "extend\t0x%x", (unsigned int) extend);
          info->insn_type = dis_noninsn;
          return length;
        }
@@ -2078,7 +2078,7 @@ print_insn_mips16 (bfd_vma memaddr, struct disassemble_info *info)
            {
              if (use_extend)
                {
-                 infprintf (is, "extend 0x%x", (unsigned int) extend);
+                 infprintf (is, "extend\t0x%x", (unsigned int) extend);
                  info->insn_type = dis_noninsn;
                  return length - 2;
                }
@@ -2147,7 +2147,7 @@ print_insn_mips16 (bfd_vma memaddr, struct disassemble_info *info)
 #undef GET_OP
 
   if (use_extend)
-    infprintf (is, "0x%x", extend | 0xf000);
+    infprintf (is, "0x%x ", extend | 0xf000);
   infprintf (is, "0x%x", insn);
   info->insn_type = dis_noninsn;