This is the mail archive of the
binutils@sources.redhat.com
mailing list for the binutils project.
[m68k]: convert mode 5 addressing w/zero offset into mode2
- From: Peter Barada <peter at the-baradas dot com>
- To: binutils at sources dot redhat dot com
- Date: Thu, 27 May 2004 10:56:19 -0400 (EDT)
- Subject: [m68k]: convert mode 5 addressing w/zero offset into mode2
This following patch converts:
<op> 0(%Ay),%Rx
<op> %Ry,0(%Ax)
<op> 0(%Ay),0(%Ax)
into:
<op> (%Ay),%Rx
<op> %Ry,(%Ax)
<op> (%Ay),(%Ax)
To reduce the size of the instruction by the word used to hold the
offset.
The patch includes a new testcase (mode5.[sd]), and since I need to
submit a patch for the new file, I had to put it together from a diff -c3pN
of the new files, so my apologies in advance if this is an incorrect approach.
Any suggestions on a definitive procedure for generating a patch for a
newly create file in a CVS tree would be most appreciated.
--
Peter Barada
peter@the-baradas.com
gas/
2004-05-27 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.
Index: gas/config/tc-m68k.c
===================================================================
RCS file: /cvs/uberbaum/gas/config/tc-m68k.c,v
retrieving revision 1.53
diff -c -3 -p -r1.53 tc-m68k.c
*** gas/config/tc-m68k.c 27 May 2004 07:56:27 -0000 1.53
--- gas/config/tc-m68k.c 27 May 2004 14:54:34 -0000
*************** m68k_ip (instring)
*** 2261,2266 ****
--- 2261,2279 ----
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: gas/testsuite/gas/m68k/all.exp
===================================================================
RCS file: /cvs/uberbaum/gas/testsuite/gas/m68k/all.exp,v
retrieving revision 1.5
diff -c -3 -p -r1.5 all.exp
*** gas/testsuite/gas/m68k/all.exp 22 Apr 2004 10:33:16 -0000 1.5
--- gas/testsuite/gas/m68k/all.exp 27 May 2004 14:53:51 -0000
*************** if [istarget m68*-*-*] then {
*** 35,40 ****
--- 35,41 ----
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
*** /dev/null Thu Apr 11 10:25:15 2002
--- gas/testsuite/gas/m68k/mode5.d Thu May 27 10:23:32 2004
***************
*** 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@
*** /dev/null Thu Apr 11 10:25:15 2002
--- gas/testsuite/gas/m68k/mode5.s Thu May 27 10:25:09 2004
***************
*** 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)