Convert mode 5 addressing with zero offset into mode 2 addressing to save a
authorNick Clifton <nickc@redhat.com>
Fri, 28 May 2004 07:55:21 +0000 (07:55 +0000)
committerNick Clifton <nickc@redhat.com>
Fri, 28 May 2004 07:55:21 +0000 (07:55 +0000)
word.

gas/ChangeLog
gas/config/tc-m68k.c
gas/testsuite/ChangeLog
gas/testsuite/gas/m68k/all.exp
gas/testsuite/gas/m68k/mode5.d [new file with mode: 0644]
gas/testsuite/gas/m68k/mode5.s [new file with mode: 0644]

index 66f396a66a61c20c98f3ba6668c3ce3e657154a3..2e5f6f27b5a771dfb07c3436074188075b389710 100644 (file)
@@ -1,3 +1,8 @@
+2004-05-28  Peter Barada <peter@the-baradas.com>
+
+       * config/gc-m68k.c(m68k_ip): Convert mode 5 addressing
+       with zero offset into mode 2 addressing to save a word.
+
 2004-05-27  H.J. Lu  <hongjiu.lu@intel.com>
 
        * config/tc-ia64.c (ar_is_in_integer_unit): Removed.
index 2a5b47975e2cdcce84998fa1df78c238fc1092f8..69be532fd6cdd08da187da71b5f8119ca37dd798 100644 (file)
@@ -2261,6 +2261,19 @@ m68k_ip (instring)
 
              nextword = get_num (&opP->disp, 90);
 
+             /* Convert mode 5 addressing with a zero offset into
+                mode 2 addressing to reduce the instruction size by a
+                word.  */
+             if (! isvar (&opP->disp)
+                 && (nextword == 0)
+                 && (opP->disp.size == SIZE_UNSPEC)
+                 && (opP->reg >= ADDR0)
+                 && (opP->reg <= ADDR7))
+               {
+                 tmpreg = 0x10 + opP->reg - ADDR; /* 2.areg */
+                 break;
+               }
+
              if (opP->reg == PC
                  && ! isvar (&opP->disp)
                  && m68k_abspcadd)
index c26d461ab6f5736685c02c41e668d9af790d13ee..76c10c9dd10d0b880e2d7608a861feed70d08767 100644 (file)
@@ -1,3 +1,10 @@
+2004-05-28  Peter Barada <peter@the-baradas.com>
+
+       * gas/m68k/mode5.s: New test file.  Checks conversion of mode 5
+       addressing with zero offset into mode 2 addressing.
+       * gas/m68k/mode5.d: New file: Expected disassmbly.
+       * gas/m68k/all.exp: Run new test.
+
 2004-05-27  H.J. Lu  <hongjiu.lu@intel.com>
 
        * gas/ia64/regs.d: Updated.
index c98179cbe9f4b846b0c8e7ae7477e594f44e2427..0eb0fd89c5b95b9d1794e3cf78252824cd7f0e40 100644 (file)
@@ -35,6 +35,7 @@ if [istarget m68*-*-*] then {
     run_dump_test link
     run_dump_test fmoveml
     run_dump_test mcf-mov3q
+    run_dump_test mode5
     run_dump_test mcf-mac
     run_dump_test mcf-emac
 
diff --git a/gas/testsuite/gas/m68k/mode5.d b/gas/testsuite/gas/m68k/mode5.d
new file mode 100644 (file)
index 0000000..71805a2
--- /dev/null
@@ -0,0 +1,12 @@
+#name: mode5
+#objdump: -d
+#as: 
+
+.*:     file format .*
+
+Disassembly of section .text:
+
+00000000 <.text>:
+   0:  2213            movel %a3@,%d1
+   2:  2882            movel %d2,%a4@
+   4:  2295            movel %a5@,%a1@
diff --git a/gas/testsuite/gas/m68k/mode5.s b/gas/testsuite/gas/m68k/mode5.s
new file mode 100644 (file)
index 0000000..6f7cd00
--- /dev/null
@@ -0,0 +1,6 @@
+
+       | Test conversion of mode 5 addressing with a zero offset into mode 2.
+       .text
+       move.l 0(%a3),%d1
+       move.l %d2,0(%a4)
+       move.l 0(%a5),0(%a1)