This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
[m68k]: patch to fix m68k_output_mi_thunk() for ColdFire
- From: Peter Barada <peter at the-baradas dot com>
- To: gcc at gcc dot gnu dot org
- Date: Wed, 26 May 2004 17:39:37 -0400 (EDT)
- Subject: [m68k]: patch to fix m68k_output_mi_thunk() for ColdFire
Arrgh, I forgot to cast a HOST_WIDE_INT to an int when calling
asm_fprintf, and also messed up the !MOTOROLA syntax for accessing %sp@(4).
Here's the patch again:
GCC curently assumes in m68k_output_mi_thunk() that it can add a
constant outside of the rang that addq/subq can handle to memory. This
is legal for m68k, but not for ColdFire. This patch converts:
add.l #-404,4(%sp)
into:
move.l #-404,%d0
add.l %d0,4(%sp)
and:
add.l #-16,4(%sp)
into:
moveq.l #-16,%d0
add.l %d0,4(%sp)
--
Peter Barada
peter@the-baradas.com
gcc/
2004-05-26 Peter Barada <peter@the-baradas.com>
* config/m68k/m68k.c(m68k_output_mi_thunk): For ColdFire,
use %d0 as a scratch to perform an add to memory.
Index: gcc/config/m68k/m68k.c
===================================================================
RCS file: /cvs/uberbaum/gcc/config/m68k/m68k.c,v
retrieving revision 1.129
diff -c -3 -p -r1.129 m68k.c
*** gcc/config/m68k/m68k.c 10 Mar 2004 05:07:45 -0000 1.129
--- gcc/config/m68k/m68k.c 26 May 2004 21:37:56 -0000
*************** m68k_output_mi_thunk (FILE *file, tree t
*** 3371,3377 ****
"\tsubq.l %I%d,4(%Rsp)\n" :
"\tsubql %I%d,%Rsp@(4)\n",
(int) -delta);
! else
asm_fprintf (file, MOTOROLA ?
"\tadd.l %I%wd,4(%Rsp)\n" :
"\taddl %I%wd,%Rsp@(4)\n",
--- 3371,3394 ----
"\tsubq.l %I%d,4(%Rsp)\n" :
"\tsubql %I%d,%Rsp@(4)\n",
(int) -delta);
! else if (TARGET_COLDFIRE)
! {
! /* ColdFire can't add/sub a constant to memory unless it ins
! the range of addq/subq. So load the vlaue into %d0 and
! then add it to 4(%sp). */
! if (delta >= -128 && delta <= 127)
! asm_fprintf (file, MOTOROLA ?
! "\tmoveq.l %I%wd,%Rd0\n" :
! "\tmoveql %I%wd,%Rd0\n", (int)delta);
! else
! asm_fprintf (file, MOTOROLA ?
! "\tmove.l %I%wd,%Rd0\n" :
! "\tmovel %I%wd,%Rd0\n", (int)delta);
! asm_fprintf (file, MOTOROLA?
! "\tadd.l %Rd0,4(%Rsp)\n" :
! "\taddl %Rd0,%Rsp@(4)\n");
! }
!
asm_fprintf (file, MOTOROLA ?
"\tadd.l %I%wd,4(%Rsp)\n" :
"\taddl %I%wd,%Rsp@(4)\n",