Fix disassembling of TIC6X parallel instructions where the previous fetch packet...
authorAlexis Deruell <alexis.deruelle@gmail.com>
Fri, 27 Jan 2017 12:00:55 +0000 (12:00 +0000)
committerNick Clifton <nickc@redhat.com>
Fri, 27 Jan 2017 12:00:55 +0000 (12:00 +0000)
PR 21056
opcodes * tic6x-dis.c (print_insn_tic6x): Correct displaying of parallel
instructions when the previous fetch packet ends with a 32-bit
instruction.

gas * testsuite/gas/tic6x/insns16-parallel.s: New test case.
* testsuite/gas/tic6x/insns16-parallel.d: New test driver.

gas/ChangeLog
gas/testsuite/gas/tic6x/insns16-parallel.d [new file with mode: 0644]
gas/testsuite/gas/tic6x/insns16-parallel.s [new file with mode: 0644]
opcodes/ChangeLog
opcodes/tic6x-dis.c

index d21f8bc07996baddf1ef920ae04d02ed097b1867..de3b9b021a99d83236595f418e8da2022435ce24 100644 (file)
@@ -1,3 +1,9 @@
+2017-01-27  Alexis Deruell  <alexis.deruelle@gmail.com>
+
+       PR 21056
+       * testsuite/gas/tic6x/insns16-parallel.s: New test case.
+       * testsuite/gas/tic6x/insns16-parallel.d: New test driver.
+
 2017-01-25  Sebastian Huber  <sebastian.huber@embedded-brains.de>
 
        * configure.tgt (aarch64*-*-rtems*): Remove.
diff --git a/gas/testsuite/gas/tic6x/insns16-parallel.d b/gas/testsuite/gas/tic6x/insns16-parallel.d
new file mode 100644 (file)
index 0000000..56a2829
--- /dev/null
@@ -0,0 +1,43 @@
+#objdump: -dr --prefix-addresses --show-raw-insn
+#name:
+#as: -march=c64x+ -mlittle-endian
+
+.*: *file format elf32-tic6x-le
+
+
+Disassembly of section .text:
+[ \t]*\.\.\.
+[0-9a-f]+[02468ace] <[^>]*> 00008000[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> 00008000[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> 00008000[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> 00008000[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> 00008000[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> 00008000[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> 00008000[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> 00008001[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> 00008000[ \t]+\|\|[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> 00008000[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> 00008000[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> 00008000[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> 00008000[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> 00008000[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> 8c6e[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> 8c6e[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> e8002000[ \t]+<fetch packet header 0xe8002000>
+[0-9a-f]+[02468ace] <[^>]*> 00008000[ \t]+\|\|[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> 00008000[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> 00008000[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> 00008000[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> 00008000[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> 00008000[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> 00008001[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> e0000000[ \t]+<fetch packet header 0xe0000000>
+[0-9a-f]+[02468ace] <[^>]*> 00008000[ \t]+\|\|[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> 00008000[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> 00008000[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> 00008000[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> 00008000[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> 00008000[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> 00008000[ \t]+nop 5
+[0-9a-f]+[02468ace] <[^>]*> 00008000[ \t]+nop 5
+[ \t]*\.\.\.
diff --git a/gas/testsuite/gas/tic6x/insns16-parallel.s b/gas/testsuite/gas/tic6x/insns16-parallel.s
new file mode 100644 (file)
index 0000000..06897b1
--- /dev/null
@@ -0,0 +1,42 @@
+       .text
+        nop
+        .align 16
+        nop
+        .align 16
+FP0:
+       .word 0x00008000
+       .word 0x00008000
+       .word 0x00008000
+       .word 0x00008000
+       .word 0x00008000
+       .word 0x00008000
+       .word 0x00008000
+       .word 0x00008001
+FP1:
+       .word 0x00008000
+       .word 0x00008000
+       .word 0x00008000
+       .word 0x00008000
+       .word 0x00008000
+       .word 0x00008000
+       .short 0x8c6e
+       .short 0x8c6e
+       .word 0xe8002000
+FP2:
+       .word 0x00008000
+       .word 0x00008000
+       .word 0x00008000
+       .word 0x00008000
+       .word 0x00008000
+       .word 0x00008000
+       .word 0x00008001
+       .word 0xe0000000
+FP3:
+       .word 0x00008000
+       .word 0x00008000
+       .word 0x00008000
+       .word 0x00008000
+       .word 0x00008000
+       .word 0x00008000
+       .word 0x00008000
+       .word 0x00008000
index 270bcda2d9a664eb66c452cb240e885f1aa3644a..3070ad58fae0ff340e7981bdf373650827a2200f 100644 (file)
@@ -1,3 +1,10 @@
+2017-01-27  Alexis Deruell  <alexis.deruelle@gmail.com>
+
+       PR 21056
+       * tic6x-dis.c (print_insn_tic6x): Correct displaying of parallel
+       instructions when the previous fetch packet ends with a 32-bit
+       instruction.
+
 2017-01-24  Dimitar Dimitrov  <dimitar@dinux.eu>
 
         * pru-opc.c: Remove vague reference to a future GDB port.
index d94d66208c06ef3b99c68fb69780c92dd215be0d..1a6f5757ce1e1b006a0d31fbbf3940720c9bfc87 100644 (file)
@@ -510,8 +510,17 @@ print_insn_tic6x (bfd_vma addr, struct disassemble_info *info)
 
              prev_header_based
                = tic6x_check_fetch_packet_header (fp_prev, &prev_header, info);
-             if (prev_header_based && prev_header.word_compact[6])
-               p_bit = prev_header.p_bits[13];
+             if (prev_header_based)
+               {
+                 if (prev_header.word_compact[6])
+                   p_bit = prev_header.p_bits[13];
+                 else
+                   {
+                     unsigned int prev_opcode = tic6x_extract_32 (fp_prev + 24,
+                                                                  info);
+                     p_bit = (prev_opcode & 0x1) ? TRUE : FALSE;
+                   }
+               }
              else
                {
                  unsigned int prev_opcode = tic6x_extract_32 (fp_prev + 28,