Commit e6d98cb0 by Bernardo Innocenti Committed by Bernardo Innocenti

m68k.c: Use C statements instead of #ifdef's when testing for MOTOROLA versus MIT syntax.

	* config/m68k/m68k.c: Use C statements instead of #ifdef's when testing
	for MOTOROLA versus MIT syntax.  Improves readability and provides
	better compile-time error checking for both code paths.

From-SVN: r73615
parent dd168984
2003-11-14 Bernardo Innocenti <bernie@develer.com>
* config/m68k/m68k.c: Use C statements instead of #ifdef's when testing
for MOTOROLA versus MIT syntax. Improves readability and provides
better compile-time error checking for both code paths.
2003-11-14 Kelley Cook <kcook@gcc.gnu.org> 2003-11-14 Kelley Cook <kcook@gcc.gnu.org>
* config/frv/frv-protos.h: Update for C90. * config/frv/frv-protos.h: Update for C90.
......
...@@ -43,6 +43,31 @@ Boston, MA 02111-1307, USA. */ ...@@ -43,6 +43,31 @@ Boston, MA 02111-1307, USA. */
#include "debug.h" #include "debug.h"
#include "flags.h" #include "flags.h"
/* We need to have MOTOROLA always defined (either 0 or 1) because we use
if-statements and ?: on it. This way we have compile-time error checking
for both the MOTOROLA and MIT code paths. We do rely on the host compiler
to optimize away all constant tests. */
#ifdef MOTOROLA
# undef MOTOROLA
# define MOTOROLA 1 /* Use the Motorola assembly syntax. */
#else
# define MOTOROLA 0 /* Use the MIT assembly syntax. */
#endif
/* The ASM_DOT macro allows easy string pasting to handle the differences
between MOTOROLA and MIT syntaxes in asm_fprintf(), which doesn't
support the %. option. */
#if MOTOROLA
# define ASM_DOT "."
# define ASM_DOTW ".w"
# define ASM_DOTL ".l"
#else
# define ASM_DOT ""
# define ASM_DOTW ""
# define ASM_DOTL ""
#endif
/* Structure describing stack frame layout. */ /* Structure describing stack frame layout. */
struct m68k_frame struct m68k_frame
{ {
...@@ -462,15 +487,8 @@ m68k_output_function_prologue (FILE *stream, HOST_WIDE_INT size ATTRIBUTE_UNUSED ...@@ -462,15 +487,8 @@ m68k_output_function_prologue (FILE *stream, HOST_WIDE_INT size ATTRIBUTE_UNUSED
before actually allocating the space. */ before actually allocating the space. */
if (current_function_limit_stack if (current_function_limit_stack
&& GET_CODE (stack_limit_rtx) == SYMBOL_REF) && GET_CODE (stack_limit_rtx) == SYMBOL_REF)
{ asm_fprintf (stream, "\tcmp" ASM_DOT "l %I%s+%wd,%Rsp\n\ttrapcs\n",
#if defined (MOTOROLA) XSTR (stack_limit_rtx, 0), current_frame.size + 4);
asm_fprintf (stream, "\tcmp.l %I%s+%wd,%Rsp\n\ttrapcs\n",
XSTR (stack_limit_rtx, 0), current_frame.size + 4);
#else
asm_fprintf (stream, "\tcmpl %I%s+%wd,%Rsp\n\ttrapcs\n",
XSTR (stack_limit_rtx, 0), current_frame.size + 4);
#endif
}
/* On ColdFire add register save into initial stack frame setup, if possible. */ /* On ColdFire add register save into initial stack frame setup, if possible. */
fsize_with_regs = current_frame.size; fsize_with_regs = current_frame.size;
...@@ -480,51 +498,25 @@ m68k_output_function_prologue (FILE *stream, HOST_WIDE_INT size ATTRIBUTE_UNUSED ...@@ -480,51 +498,25 @@ m68k_output_function_prologue (FILE *stream, HOST_WIDE_INT size ATTRIBUTE_UNUSED
if (frame_pointer_needed) if (frame_pointer_needed)
{ {
if (current_frame.size == 0 && TARGET_68040) if (current_frame.size == 0 && TARGET_68040)
{
/* on the 68040, pea + move is faster than link.w 0 */ /* on the 68040, pea + move is faster than link.w 0 */
#ifdef MOTOROLA fprintf (stream, MOTOROLA ?
fprintf (stream, "\tpea (%s)\n\tmove.l %s,%s\n", "\tpea (%s)\n\tmove.l %s,%s\n" :
reg_names[FRAME_POINTER_REGNUM], "\tpea %s@\n\tmovel %s,%s\n",
reg_names[STACK_POINTER_REGNUM], reg_names[FRAME_POINTER_REGNUM],
reg_names[FRAME_POINTER_REGNUM]); reg_names[STACK_POINTER_REGNUM],
#else reg_names[FRAME_POINTER_REGNUM]);
fprintf (stream, "\tpea %s@\n\tmovel %s,%s\n",
reg_names[FRAME_POINTER_REGNUM],
reg_names[STACK_POINTER_REGNUM],
reg_names[FRAME_POINTER_REGNUM]);
#endif
}
else if (fsize_with_regs < 0x8000) else if (fsize_with_regs < 0x8000)
{ asm_fprintf (stream, "\tlink" ASM_DOTW " %s,%I%wd\n",
#ifdef MOTOROLA reg_names[FRAME_POINTER_REGNUM], -fsize_with_regs);
asm_fprintf (stream, "\tlink.w %s,%I%wd\n",
reg_names[FRAME_POINTER_REGNUM], -fsize_with_regs);
#else
asm_fprintf (stream, "\tlink %s,%I%wd\n",
reg_names[FRAME_POINTER_REGNUM], -fsize_with_regs);
#endif
}
else if (TARGET_68020) else if (TARGET_68020)
{ asm_fprintf (stream, "\tlink" ASM_DOTL " %s,%I%wd\n",
#ifdef MOTOROLA reg_names[FRAME_POINTER_REGNUM], -fsize_with_regs);
asm_fprintf (stream, "\tlink.l %s,%I%wd\n",
reg_names[FRAME_POINTER_REGNUM], -fsize_with_regs);
#else
asm_fprintf (stream, "\tlink %s,%I%wd\n",
reg_names[FRAME_POINTER_REGNUM], -fsize_with_regs);
#endif
}
else else
{ /* Adding negative number is faster on the 68040. */
/* Adding negative number is faster on the 68040. */ asm_fprintf (stream, "\tlink" ASM_DOTW " %s,%I0\n"
#ifdef MOTOROLA "\tadd" ASM_DOT "l %I%wd,%Rsp\n",
asm_fprintf (stream, "\tlink.w %s,%I0\n\tadd.l %I%wd,%Rsp\n", reg_names[FRAME_POINTER_REGNUM], -fsize_with_regs);
reg_names[FRAME_POINTER_REGNUM], -fsize_with_regs);
#else
asm_fprintf (stream, "\tlink %s,%I0\n\taddl %I%wd,%Rsp\n",
reg_names[FRAME_POINTER_REGNUM], -fsize_with_regs);
#endif
}
if (dwarf2out_do_frame ()) if (dwarf2out_do_frame ())
{ {
char *l; char *l;
...@@ -542,61 +534,32 @@ m68k_output_function_prologue (FILE *stream, HOST_WIDE_INT size ATTRIBUTE_UNUSED ...@@ -542,61 +534,32 @@ m68k_output_function_prologue (FILE *stream, HOST_WIDE_INT size ATTRIBUTE_UNUSED
if (fsize_with_regs <= 8) if (fsize_with_regs <= 8)
{ {
if (!TARGET_COLDFIRE) if (!TARGET_COLDFIRE)
{ asm_fprintf (stream, "\tsubq" ASM_DOT "w %I%wd,%Rsp\n",
#ifdef MOTOROLA fsize_with_regs);
asm_fprintf (stream, "\tsubq.w %I%wd,%Rsp\n", fsize_with_regs);
#else
asm_fprintf (stream, "\tsubqw %I%wd,%Rsp\n", fsize_with_regs);
#endif
}
else else
{ asm_fprintf (stream, "\tsubq" ASM_DOT "l %I%wd,%Rsp\n",
#ifdef MOTOROLA fsize_with_regs);
asm_fprintf (stream, "\tsubq.l %I%wd,%Rsp\n", fsize_with_regs);
#else
asm_fprintf (stream, "\tsubql %I%wd,%Rsp\n", fsize_with_regs);
#endif
}
} }
else if (fsize_with_regs <= 16 && TARGET_CPU32) else if (fsize_with_regs <= 16 && TARGET_CPU32)
{ /* On the CPU32 it is faster to use two subqw instructions to
/* On the CPU32 it is faster to use two subqw instructions to subtract a small integer (8 < N <= 16) to a register. */
subtract a small integer (8 < N <= 16) to a register. */ asm_fprintf (stream,
#ifdef MOTOROLA "\tsubq" ASM_DOT "w %I8,%Rsp\n"
asm_fprintf (stream, "\tsubq" ASM_DOT "w %I%wd,%Rsp\n",
"\tsubq.w %I8,%Rsp\n\tsubq.w %I%wd,%Rsp\n", fsize_with_regs - 8);
fsize_with_regs - 8);
#else
asm_fprintf (stream, "\tsubqw %I8,%Rsp\n\tsubqw %I%wd,%Rsp\n",
fsize_with_regs - 8);
#endif
}
else if (TARGET_68040) else if (TARGET_68040)
{ /* Adding negative number is faster on the 68040. */
/* Adding negative number is faster on the 68040. */ asm_fprintf (stream, "\tadd" ASM_DOT "w %I%wd,%Rsp\n",
#ifdef MOTOROLA -fsize_with_regs);
asm_fprintf (stream, "\tadd.w %I%wd,%Rsp\n", -fsize_with_regs);
#else
asm_fprintf (stream, "\taddw %I%wd,%Rsp\n", -fsize_with_regs);
#endif
}
else else
{ asm_fprintf (stream, MOTOROLA ?
#ifdef MOTOROLA "\tlea (%wd,%Rsp),%Rsp\n" :
asm_fprintf (stream, "\tlea (%wd,%Rsp),%Rsp\n", -fsize_with_regs); "\tlea %Rsp@(%wd),%Rsp\n",
#else -fsize_with_regs);
asm_fprintf (stream, "\tlea %Rsp@(%wd),%Rsp\n", -fsize_with_regs);
#endif
}
} }
else /* fsize_with_regs >= 0x8000 */ else /* fsize_with_regs >= 0x8000 */
{ asm_fprintf (stream, "\tadd" ASM_DOT "l %I%wd,%Rsp\n", -fsize_with_regs);
#ifdef MOTOROLA
asm_fprintf (stream, "\tadd.l %I%wd,%Rsp\n", -fsize_with_regs);
#else
asm_fprintf (stream, "\taddl %I%wd,%Rsp\n", -fsize_with_regs);
#endif
}
if (dwarf2out_do_frame ()) if (dwarf2out_do_frame ())
{ {
cfa_offset += current_frame.size + 4; cfa_offset += current_frame.size + 4;
...@@ -606,11 +569,11 @@ m68k_output_function_prologue (FILE *stream, HOST_WIDE_INT size ATTRIBUTE_UNUSED ...@@ -606,11 +569,11 @@ m68k_output_function_prologue (FILE *stream, HOST_WIDE_INT size ATTRIBUTE_UNUSED
if (current_frame.fpu_mask) if (current_frame.fpu_mask)
{ {
#ifdef MOTOROLA asm_fprintf (stream, MOTOROLA ?
asm_fprintf (stream, "\tfmovm %I0x%x,-(%Rsp)\n", current_frame.fpu_mask); "\tfmovm %I0x%x,-(%Rsp)\n" :
#else "\tfmovem %I0x%x,%Rsp@-\n",
asm_fprintf (stream, "\tfmovem %I0x%x,%Rsp@-\n", current_frame.fpu_mask); current_frame.fpu_mask);
#endif
if (dwarf2out_do_frame ()) if (dwarf2out_do_frame ())
{ {
char *l = (char *) dwarf2out_cfi_label (); char *l = (char *) dwarf2out_cfi_label ();
...@@ -630,15 +593,8 @@ m68k_output_function_prologue (FILE *stream, HOST_WIDE_INT size ATTRIBUTE_UNUSED ...@@ -630,15 +593,8 @@ m68k_output_function_prologue (FILE *stream, HOST_WIDE_INT size ATTRIBUTE_UNUSED
if (current_function_limit_stack) if (current_function_limit_stack)
{ {
if (REG_P (stack_limit_rtx)) if (REG_P (stack_limit_rtx))
{ asm_fprintf (stream, "\tcmp" ASM_DOT "l %s,%Rsp\n\ttrapcs\n",
#if defined (MOTOROLA) reg_names[REGNO (stack_limit_rtx)]);
asm_fprintf (stream, "\tcmp.l %s,%Rsp\n\ttrapcs\n",
reg_names[REGNO (stack_limit_rtx)]);
#else
asm_fprintf (stream, "\tcmpl %s,%Rsp\n\ttrapcs\n",
reg_names[REGNO (stack_limit_rtx)]);
#endif
}
else if (GET_CODE (stack_limit_rtx) != SYMBOL_REF) else if (GET_CODE (stack_limit_rtx) != SYMBOL_REF)
warning ("stack limit expression is not supported"); warning ("stack limit expression is not supported");
} }
...@@ -655,12 +611,9 @@ m68k_output_function_prologue (FILE *stream, HOST_WIDE_INT size ATTRIBUTE_UNUSED ...@@ -655,12 +611,9 @@ m68k_output_function_prologue (FILE *stream, HOST_WIDE_INT size ATTRIBUTE_UNUSED
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
if (current_frame.reg_rev_mask & (1 << i)) if (current_frame.reg_rev_mask & (1 << i))
{ {
asm_fprintf (stream, asm_fprintf (stream, MOTOROLA ?
#ifdef MOTOROLA "\t%Omove.l %s,-(%Rsp)\n" :
"\t%Omove.l %s,-(%Rsp)\n", "\tmovel %s,%Rsp@-\n",
#else
"\tmovel %s,%Rsp@-\n",
#endif
reg_names[15 - i]); reg_names[15 - i]);
if (dwarf2out_do_frame ()) if (dwarf2out_do_frame ())
{ {
...@@ -676,27 +629,21 @@ m68k_output_function_prologue (FILE *stream, HOST_WIDE_INT size ATTRIBUTE_UNUSED ...@@ -676,27 +629,21 @@ m68k_output_function_prologue (FILE *stream, HOST_WIDE_INT size ATTRIBUTE_UNUSED
else if (current_frame.reg_rev_mask) else if (current_frame.reg_rev_mask)
{ {
if (TARGET_COLDFIRE) if (TARGET_COLDFIRE)
{ /* The ColdFire does not support the predecrement form of the
/* The ColdFire does not support the predecrement form of the MOVEM instruction, so we must adjust the stack pointer and
MOVEM instruction, so we must adjust the stack pointer and then use the plain address register indirect mode.
then use the plain address register indirect mode. The required register save space was combined earlier with
The required register save space was combined earlier with the fsize_with_regs amount. */
the fsize_with_regs amount. */
asm_fprintf (stream, MOTOROLA ?
#ifdef MOTOROLA "\tmovm.l %I0x%x,(%Rsp)\n" :
asm_fprintf (stream, "\tmovm.l %I0x%x,(%Rsp)\n", current_frame.reg_mask); "\tmoveml %I0x%x,%Rsp@\n",
#else current_frame.reg_mask);
asm_fprintf (stream, "\tmoveml %I0x%x,%Rsp@\n", current_frame.reg_mask);
#endif
}
else else
{ asm_fprintf (stream, MOTOROLA ?
#ifdef MOTOROLA "\tmovm.l %I0x%x,-(%Rsp)\n" :
asm_fprintf (stream, "\tmovm.l %I0x%x,-(%Rsp)\n", current_frame.reg_rev_mask); "\tmoveml %I0x%x,%Rsp@-\n",
#else current_frame.reg_rev_mask);
asm_fprintf (stream, "\tmoveml %I0x%x,%Rsp@-\n", current_frame.reg_rev_mask);
#endif
}
if (dwarf2out_do_frame ()) if (dwarf2out_do_frame ())
{ {
char *l = (char *) dwarf2out_cfi_label (); char *l = (char *) dwarf2out_cfi_label ();
...@@ -723,16 +670,17 @@ m68k_output_function_prologue (FILE *stream, HOST_WIDE_INT size ATTRIBUTE_UNUSED ...@@ -723,16 +670,17 @@ m68k_output_function_prologue (FILE *stream, HOST_WIDE_INT size ATTRIBUTE_UNUSED
} }
else else
{ {
#ifdef MOTOROLA if (MOTOROLA)
asm_fprintf (stream, "\t%Olea (%Rpc, %U_GLOBAL_OFFSET_TABLE_@GOTPC), %s\n", asm_fprintf (stream, "\t%Olea (%Rpc, %U_GLOBAL_OFFSET_TABLE_@GOTPC), %s\n",
reg_names[PIC_OFFSET_TABLE_REGNUM]); reg_names[PIC_OFFSET_TABLE_REGNUM]);
#else else
asm_fprintf (stream, "\tmovel %I%U_GLOBAL_OFFSET_TABLE_, %s\n", {
reg_names[PIC_OFFSET_TABLE_REGNUM]); asm_fprintf (stream, "\tmovel %I%U_GLOBAL_OFFSET_TABLE_, %s\n",
asm_fprintf (stream, "\tlea %Rpc@(0,%s:l),%s\n", reg_names[PIC_OFFSET_TABLE_REGNUM]);
reg_names[PIC_OFFSET_TABLE_REGNUM], asm_fprintf (stream, "\tlea %Rpc@(0,%s:l),%s\n",
reg_names[PIC_OFFSET_TABLE_REGNUM]); reg_names[PIC_OFFSET_TABLE_REGNUM],
#endif reg_names[PIC_OFFSET_TABLE_REGNUM]);
}
} }
} }
} }
...@@ -811,24 +759,9 @@ m68k_output_function_epilogue (FILE *stream, HOST_WIDE_INT size ATTRIBUTE_UNUSED ...@@ -811,24 +759,9 @@ m68k_output_function_epilogue (FILE *stream, HOST_WIDE_INT size ATTRIBUTE_UNUSED
/* Because the ColdFire doesn't support moveml with /* Because the ColdFire doesn't support moveml with
complex address modes we make an extra correction here. */ complex address modes we make an extra correction here. */
if (TARGET_COLDFIRE) if (TARGET_COLDFIRE)
{ fsize += current_frame.offset;
#ifdef MOTOROLA
asm_fprintf (stream, "\t%Omove.l %I%d,%Ra1\n",
-fsize - current_frame.offset);
#else
asm_fprintf (stream, "\tmovel %I%d,%Ra1\n",
-fsize - current_frame.offset);
#endif
}
else
{
#ifdef MOTOROLA
asm_fprintf (stream, "\t%Omove.l %I%wd,%Ra1\n", -fsize);
#else
asm_fprintf (stream, "\tmovel %I%wd,%Ra1\n", -fsize);
#endif
}
asm_fprintf (stream, "\t%Omove" ASM_DOT "l %I%wd,%Ra1\n", -fsize);
fsize = 0, big = true; fsize = 0, big = true;
} }
if (current_frame.reg_no <= 2) if (current_frame.reg_no <= 2)
...@@ -846,41 +779,34 @@ m68k_output_function_epilogue (FILE *stream, HOST_WIDE_INT size ATTRIBUTE_UNUSED ...@@ -846,41 +779,34 @@ m68k_output_function_epilogue (FILE *stream, HOST_WIDE_INT size ATTRIBUTE_UNUSED
{ {
if (big) if (big)
{ {
#ifdef MOTOROLA if (MOTOROLA)
asm_fprintf (stream, "\t%Omove.l -%wd(%s,%Ra1.l),%s\n", asm_fprintf (stream, "\t%Omove.l -%wd(%s,%Ra1.l),%s\n",
offset, offset,
reg_names[FRAME_POINTER_REGNUM], reg_names[FRAME_POINTER_REGNUM],
reg_names[i]); reg_names[i]);
#else else
asm_fprintf (stream, "\tmovel %s@(-%wd,%Ra1:l),%s\n", asm_fprintf (stream, "\tmovel %s@(-%wd,%Ra1:l),%s\n",
reg_names[FRAME_POINTER_REGNUM], reg_names[FRAME_POINTER_REGNUM],
offset, offset,
reg_names[i]); reg_names[i]);
#endif
} }
else if (restore_from_sp) else if (restore_from_sp)
{ asm_fprintf (stream, MOTOROLA ?
#ifdef MOTOROLA "\t%Omove.l (%Rsp)+,%s\n" :
asm_fprintf (stream, "\t%Omove.l (%Rsp)+,%s\n", "\tmovel %Rsp@+,%s\n",
reg_names[i]); reg_names[i]);
#else
asm_fprintf (stream, "\tmovel %Rsp@+,%s\n",
reg_names[i]);
#endif
}
else else
{ {
#ifdef MOTOROLA if (MOTOROLA)
asm_fprintf (stream, "\t%Omove.l -%wd(%s),%s\n", asm_fprintf (stream, "\t%Omove.l -%wd(%s),%s\n",
offset, offset,
reg_names[FRAME_POINTER_REGNUM], reg_names[FRAME_POINTER_REGNUM],
reg_names[i]); reg_names[i]);
#else else
asm_fprintf (stream, "\tmovel %s@(-%wd),%s\n", asm_fprintf (stream, "\tmovel %s@(-%wd),%s\n",
reg_names[FRAME_POINTER_REGNUM], reg_names[FRAME_POINTER_REGNUM],
offset, offset,
reg_names[i]); reg_names[i]);
#endif
} }
offset -= 4; offset -= 4;
} }
...@@ -892,76 +818,66 @@ m68k_output_function_epilogue (FILE *stream, HOST_WIDE_INT size ATTRIBUTE_UNUSED ...@@ -892,76 +818,66 @@ m68k_output_function_epilogue (FILE *stream, HOST_WIDE_INT size ATTRIBUTE_UNUSED
{ {
if (big) if (big)
{ {
#ifdef MOTOROLA asm_fprintf (stream, "\tadd" ASM_DOT "l %s,%Ra1\n",
asm_fprintf (stream, "\tadd.l %s,%Ra1\n", reg_names[FRAME_POINTER_REGNUM]); reg_names[FRAME_POINTER_REGNUM]);
asm_fprintf (stream, "\tmovm.l (%Ra1),%I0x%x\n", current_frame.reg_mask); asm_fprintf (stream, MOTOROLA ?
#else "\tmovm.l (%Ra1),%I0x%x\n" :
asm_fprintf (stream, "\taddl %s,%Ra1\n", reg_names[FRAME_POINTER_REGNUM]); "\tmoveml %Ra1@,%I0x%x\n",
asm_fprintf (stream, "\tmoveml %Ra1@,%I0x%x\n", current_frame.reg_mask); current_frame.reg_mask);
#endif
} }
else if (restore_from_sp) else if (restore_from_sp)
{ asm_fprintf (stream, MOTOROLA ?
#ifdef MOTOROLA "\tmovm.l (%Rsp),%I0x%x\n" :
asm_fprintf (stream, "\tmovm.l (%Rsp),%I0x%x\n", current_frame.reg_mask); "\tmoveml %Rsp@,%I0x%x\n",
#else current_frame.reg_mask);
asm_fprintf (stream, "\tmoveml %Rsp@,%I0x%x\n", current_frame.reg_mask);
#endif
}
else else
{ {
#ifdef MOTOROLA if (MOTOROLA)
asm_fprintf (stream, "\tmovm.l -%wd(%s),%I0x%x\n", asm_fprintf (stream, "\tmovm.l -%wd(%s),%I0x%x\n",
current_frame.offset + fsize, current_frame.offset + fsize,
reg_names[FRAME_POINTER_REGNUM], reg_names[FRAME_POINTER_REGNUM],
current_frame.reg_mask); current_frame.reg_mask);
#else else
asm_fprintf (stream, "\tmoveml %s@(-%wd),%I0x%x\n", asm_fprintf (stream, "\tmoveml %s@(-%wd),%I0x%x\n",
reg_names[FRAME_POINTER_REGNUM], reg_names[FRAME_POINTER_REGNUM],
current_frame.offset + fsize, current_frame.offset + fsize,
current_frame.reg_mask); current_frame.reg_mask);
#endif
} }
} }
else /* !TARGET_COLDFIRE */ else /* !TARGET_COLDFIRE */
{ {
if (big) if (big)
{ {
#ifdef MOTOROLA if (MOTOROLA)
asm_fprintf (stream, "\tmovm.l -%wd(%s,%Ra1.l),%I0x%x\n", asm_fprintf (stream, "\tmovm.l -%wd(%s,%Ra1.l),%I0x%x\n",
current_frame.offset + fsize, current_frame.offset + fsize,
reg_names[FRAME_POINTER_REGNUM], reg_names[FRAME_POINTER_REGNUM],
current_frame.reg_mask); current_frame.reg_mask);
#else else
asm_fprintf (stream, "\tmoveml %s@(-%wd,%Ra1:l),%I0x%x\n", asm_fprintf (stream, "\tmoveml %s@(-%wd,%Ra1:l),%I0x%x\n",
reg_names[FRAME_POINTER_REGNUM], reg_names[FRAME_POINTER_REGNUM],
current_frame.offset + fsize, current_frame.offset + fsize,
current_frame.reg_mask); current_frame.reg_mask);
#endif
} }
else if (restore_from_sp) else if (restore_from_sp)
{ {
#ifdef MOTOROLA asm_fprintf (stream, MOTOROLA ?
asm_fprintf (stream, "\tmovm.l (%Rsp)+,%I0x%x\n", "\tmovm.l (%Rsp)+,%I0x%x\n" :
current_frame.reg_mask); "\tmoveml %Rsp@+,%I0x%x\n",
#else
asm_fprintf (stream, "\tmoveml %Rsp@+,%I0x%x\n",
current_frame.reg_mask); current_frame.reg_mask);
#endif
} }
else else
{ {
#ifdef MOTOROLA if (MOTOROLA)
asm_fprintf (stream, "\tmovm.l -%wd(%s),%I0x%x\n", asm_fprintf (stream, "\tmovm.l -%wd(%s),%I0x%x\n",
current_frame.offset + fsize, current_frame.offset + fsize,
reg_names[FRAME_POINTER_REGNUM], reg_names[FRAME_POINTER_REGNUM],
current_frame.reg_mask); current_frame.reg_mask);
#else else
asm_fprintf (stream, "\tmoveml %s@(-%wd),%I0x%x\n", asm_fprintf (stream, "\tmoveml %s@(-%wd),%I0x%x\n",
reg_names[FRAME_POINTER_REGNUM], reg_names[FRAME_POINTER_REGNUM],
current_frame.offset + fsize, current_frame.offset + fsize,
current_frame.reg_mask); current_frame.reg_mask);
#endif
} }
} }
} }
...@@ -969,41 +885,38 @@ m68k_output_function_epilogue (FILE *stream, HOST_WIDE_INT size ATTRIBUTE_UNUSED ...@@ -969,41 +885,38 @@ m68k_output_function_epilogue (FILE *stream, HOST_WIDE_INT size ATTRIBUTE_UNUSED
{ {
if (big) if (big)
{ {
#ifdef MOTOROLA if (MOTOROLA)
asm_fprintf (stream, "\tfmovm -%wd(%s,%Ra1.l),%I0x%x\n", asm_fprintf (stream, "\tfmovm -%wd(%s,%Ra1.l),%I0x%x\n",
current_frame.foffset + fsize, current_frame.foffset + fsize,
reg_names[FRAME_POINTER_REGNUM], reg_names[FRAME_POINTER_REGNUM],
current_frame.fpu_rev_mask); current_frame.fpu_rev_mask);
#else else
asm_fprintf (stream, "\tfmovem %s@(-%wd,%Ra1:l),%I0x%x\n", asm_fprintf (stream, "\tfmovem %s@(-%wd,%Ra1:l),%I0x%x\n",
reg_names[FRAME_POINTER_REGNUM], reg_names[FRAME_POINTER_REGNUM],
current_frame.foffset + fsize, current_frame.foffset + fsize,
current_frame.fpu_rev_mask); current_frame.fpu_rev_mask);
#endif
} }
else if (restore_from_sp) else if (restore_from_sp)
{ {
#ifdef MOTOROLA if (MOTOROLA)
asm_fprintf (stream, "\tfmovm (%Rsp)+,%I0x%x\n", asm_fprintf (stream, "\tfmovm (%Rsp)+,%I0x%x\n",
current_frame.fpu_rev_mask); current_frame.fpu_rev_mask);
#else else
asm_fprintf (stream, "\tfmovem %Rsp@+,%I0x%x\n", asm_fprintf (stream, "\tfmovem %Rsp@+,%I0x%x\n",
current_frame.fpu_rev_mask); current_frame.fpu_rev_mask);
#endif
} }
else else
{ {
#ifdef MOTOROLA if (MOTOROLA)
asm_fprintf (stream, "\tfmovm -%wd(%s),%I0x%x\n", asm_fprintf (stream, "\tfmovm -%wd(%s),%I0x%x\n",
current_frame.foffset + fsize, current_frame.foffset + fsize,
reg_names[FRAME_POINTER_REGNUM], reg_names[FRAME_POINTER_REGNUM],
current_frame.fpu_rev_mask); current_frame.fpu_rev_mask);
#else else
asm_fprintf (stream, "\tfmovem %s@(-%wd),%I0x%x\n", asm_fprintf (stream, "\tfmovem %s@(-%wd),%I0x%x\n",
reg_names[FRAME_POINTER_REGNUM], reg_names[FRAME_POINTER_REGNUM],
current_frame.foffset + fsize, current_frame.foffset + fsize,
current_frame.fpu_rev_mask); current_frame.fpu_rev_mask);
#endif
} }
} }
if (frame_pointer_needed) if (frame_pointer_needed)
...@@ -1014,70 +927,36 @@ m68k_output_function_epilogue (FILE *stream, HOST_WIDE_INT size ATTRIBUTE_UNUSED ...@@ -1014,70 +927,36 @@ m68k_output_function_epilogue (FILE *stream, HOST_WIDE_INT size ATTRIBUTE_UNUSED
if (fsize_with_regs <= 8) if (fsize_with_regs <= 8)
{ {
if (!TARGET_COLDFIRE) if (!TARGET_COLDFIRE)
{ asm_fprintf (stream, "\taddq" ASM_DOT "w %I%wd,%Rsp\n",
#ifdef MOTOROLA fsize_with_regs);
asm_fprintf (stream, "\taddq.w %I%wd,%Rsp\n", fsize_with_regs); else
#else asm_fprintf (stream, "\taddq" ASM_DOT "l %I%wd,%Rsp\n",
asm_fprintf (stream, "\taddqw %I%wd,%Rsp\n", fsize_with_regs); fsize_with_regs);
#endif
}
else /* TARGET_COLDFIRE */
{
#ifdef MOTOROLA
asm_fprintf (stream, "\taddq.l %I%wd,%Rsp\n", fsize_with_regs);
#else
asm_fprintf (stream, "\taddql %I%wd,%Rsp\n", fsize_with_regs);
#endif
}
} }
else if (fsize_with_regs <= 16 && TARGET_CPU32) else if (fsize_with_regs <= 16 && TARGET_CPU32)
{ {
/* On the CPU32 it is faster to use two addqw instructions to /* On the CPU32 it is faster to use two addqw instructions to
add a small integer (8 < N <= 16) to a register. */ add a small integer (8 < N <= 16) to a register. */
#ifdef MOTOROLA asm_fprintf (stream, "\taddq" ASM_DOT "w %I8,%Rsp\n"
asm_fprintf (stream, "\taddq.w %I8,%Rsp\n\taddq.w %I%wd,%Rsp\n", "\taddq" ASM_DOT "w %I%wd,%Rsp\n",
fsize_with_regs - 8); fsize_with_regs - 8);
#else
asm_fprintf (stream, "\taddqw %I8,%Rsp\n\taddqw %I%wd,%Rsp\n",
fsize_with_regs - 8);
#endif
} }
else if (fsize_with_regs < 0x8000) else if (fsize_with_regs < 0x8000)
{ {
if (TARGET_68040) if (TARGET_68040)
{ asm_fprintf (stream, "\tadd" ASM_DOT "w %I%wd,%Rsp\n",
#ifdef MOTOROLA fsize_with_regs);
asm_fprintf (stream, "\tadd.w %I%wd,%Rsp\n", fsize_with_regs);
#else
asm_fprintf (stream, "\taddw %I%wd,%Rsp\n", fsize_with_regs);
#endif
}
else else
{ asm_fprintf (stream, MOTOROLA ?
#ifdef MOTOROLA "\tlea (%wd,%Rsp),%Rsp\n" :
asm_fprintf (stream, "\tlea (%wd,%Rsp),%Rsp\n", fsize_with_regs); "\tlea %Rsp@(%wd),%Rsp\n",
#else fsize_with_regs);
asm_fprintf (stream, "\tlea %Rsp@(%wd),%Rsp\n", fsize_with_regs);
#endif
}
} }
else else
{ asm_fprintf (stream, "\tadd" ASM_DOT "l %I%wd,%Rsp\n", fsize_with_regs);
#ifdef MOTOROLA
asm_fprintf (stream, "\tadd.l %I%wd,%Rsp\n", fsize_with_regs);
#else
asm_fprintf (stream, "\taddl %I%wd,%Rsp\n", fsize_with_regs);
#endif
}
} }
if (current_function_calls_eh_return) if (current_function_calls_eh_return)
{ asm_fprintf (stream, "\tadd" ASM_DOT"l %Ra0,%Rsp\n");
#ifdef MOTOROLA
asm_fprintf (stream, "\tadd.l %Ra0,%Rsp\n");
#else
asm_fprintf (stream, "\taddl %Ra0,%Rsp\n");
#endif
}
if (m68k_interrupt_function_p (current_function_decl)) if (m68k_interrupt_function_p (current_function_decl))
fprintf (stream, "\trte\n"); fprintf (stream, "\trte\n");
else if (current_function_pops_args) else if (current_function_pops_args)
...@@ -1173,84 +1052,74 @@ output_dbcc_and_branch (rtx *operands) ...@@ -1173,84 +1052,74 @@ output_dbcc_and_branch (rtx *operands)
switch (GET_CODE (operands[3])) switch (GET_CODE (operands[3]))
{ {
case EQ: case EQ:
#ifdef MOTOROLA output_asm_insn (MOTOROLA ?
output_asm_insn ("dbeq %0,%l1\n\tjbeq %l2", operands); "dbeq %0,%l1\n\tjbeq %l2" :
#else "dbeq %0,%l1\n\tjeq %l2",
output_asm_insn ("dbeq %0,%l1\n\tjeq %l2", operands); operands);
#endif break;
break;
case NE: case NE:
#ifdef MOTOROLA output_asm_insn (MOTOROLA ?
output_asm_insn ("dbne %0,%l1\n\tjbne %l2", operands); "dbne %0,%l1\n\tjbne %l2" :
#else "dbne %0,%l1\n\tjne %l2",
output_asm_insn ("dbne %0,%l1\n\tjne %l2", operands); operands);
#endif break;
break;
case GT: case GT:
#ifdef MOTOROLA output_asm_insn (MOTOROLA ?
output_asm_insn ("dbgt %0,%l1\n\tjbgt %l2", operands); "dbgt %0,%l1\n\tjbgt %l2" :
#else "dbgt %0,%l1\n\tjgt %l2",
output_asm_insn ("dbgt %0,%l1\n\tjgt %l2", operands); operands);
#endif break;
break;
case GTU: case GTU:
#ifdef MOTOROLA output_asm_insn (MOTOROLA ?
output_asm_insn ("dbhi %0,%l1\n\tjbhi %l2", operands); "dbhi %0,%l1\n\tjbhi %l2" :
#else "dbhi %0,%l1\n\tjhi %l2",
output_asm_insn ("dbhi %0,%l1\n\tjhi %l2", operands); operands);
#endif break;
break;
case LT: case LT:
#ifdef MOTOROLA output_asm_insn (MOTOROLA ?
output_asm_insn ("dblt %0,%l1\n\tjblt %l2", operands); "dblt %0,%l1\n\tjblt %l2" :
#else "dblt %0,%l1\n\tjlt %l2",
output_asm_insn ("dblt %0,%l1\n\tjlt %l2", operands); operands);
#endif break;
break;
case LTU: case LTU:
#ifdef MOTOROLA output_asm_insn (MOTOROLA ?
output_asm_insn ("dbcs %0,%l1\n\tjbcs %l2", operands); "dbcs %0,%l1\n\tjbcs %l2" :
#else "dbcs %0,%l1\n\tjcs %l2",
output_asm_insn ("dbcs %0,%l1\n\tjcs %l2", operands); operands);
#endif break;
break;
case GE: case GE:
#ifdef MOTOROLA output_asm_insn (MOTOROLA ?
output_asm_insn ("dbge %0,%l1\n\tjbge %l2", operands); "dbge %0,%l1\n\tjbge %l2" :
#else "dbge %0,%l1\n\tjge %l2",
output_asm_insn ("dbge %0,%l1\n\tjge %l2", operands); operands);
#endif break;
break;
case GEU: case GEU:
#ifdef MOTOROLA output_asm_insn (MOTOROLA ?
output_asm_insn ("dbcc %0,%l1\n\tjbcc %l2", operands); "dbcc %0,%l1\n\tjbcc %l2" :
#else "dbcc %0,%l1\n\tjcc %l2",
output_asm_insn ("dbcc %0,%l1\n\tjcc %l2", operands); operands);
#endif break;
break;
case LE: case LE:
#ifdef MOTOROLA output_asm_insn (MOTOROLA ?
output_asm_insn ("dble %0,%l1\n\tjble %l2", operands); "dble %0,%l1\n\tjble %l2" :
#else "dble %0,%l1\n\tjle %l2",
output_asm_insn ("dble %0,%l1\n\tjle %l2", operands); operands);
#endif break;
break;
case LEU: case LEU:
#ifdef MOTOROLA output_asm_insn (MOTOROLA ?
output_asm_insn ("dbls %0,%l1\n\tjbls %l2", operands); "dbls %0,%l1\n\tjbls %l2" :
#else "dbls %0,%l1\n\tjls %l2",
output_asm_insn ("dbls %0,%l1\n\tjls %l2", operands); operands);
#endif break;
break;
default: default:
abort (); abort ();
...@@ -1261,11 +1130,10 @@ output_dbcc_and_branch (rtx *operands) ...@@ -1261,11 +1130,10 @@ output_dbcc_and_branch (rtx *operands)
switch (GET_MODE (operands[0])) switch (GET_MODE (operands[0]))
{ {
case SImode: case SImode:
#ifdef MOTOROLA output_asm_insn (MOTOROLA ?
output_asm_insn ("clr%.w %0\n\tsubq%.l %#1,%0\n\tjbpl %l1", operands); "clr%.w %0\n\tsubq%.l %#1,%0\n\tjbpl %l1" :
#else "clr%.w %0\n\tsubq%.l %#1,%0\n\tjpl %l1",
output_asm_insn ("clr%.w %0\n\tsubq%.l %#1,%0\n\tjpl %l1", operands); operands);
#endif
break; break;
case HImode: case HImode:
...@@ -1312,18 +1180,17 @@ output_scc_di(rtx op, rtx operand1, rtx operand2, rtx dest) ...@@ -1312,18 +1180,17 @@ output_scc_di(rtx op, rtx operand1, rtx operand2, rtx dest)
loperands[4] = gen_label_rtx(); loperands[4] = gen_label_rtx();
if (operand2 != const0_rtx) if (operand2 != const0_rtx)
{ {
#ifdef MOTOROLA if (MOTOROLA)
#ifdef SGS_CMP_ORDER #ifdef SGS_CMP_ORDER
output_asm_insn ("cmp%.l %0,%2\n\tjbne %l4\n\tcmp%.l %1,%3", loperands); output_asm_insn ("cmp%.l %0,%2\n\tjbne %l4\n\tcmp%.l %1,%3", loperands);
#else #else
output_asm_insn ("cmp%.l %2,%0\n\tjbne %l4\n\tcmp%.l %3,%1", loperands); output_asm_insn ("cmp%.l %2,%0\n\tjbne %l4\n\tcmp%.l %3,%1", loperands);
#endif #endif
#else else
#ifdef SGS_CMP_ORDER #ifdef SGS_CMP_ORDER
output_asm_insn ("cmp%.l %0,%2\n\tjne %l4\n\tcmp%.l %1,%3", loperands); output_asm_insn ("cmp%.l %0,%2\n\tjne %l4\n\tcmp%.l %1,%3", loperands);
#else #else
output_asm_insn ("cmp%.l %2,%0\n\tjne %l4\n\tcmp%.l %3,%1", loperands); output_asm_insn ("cmp%.l %2,%0\n\tjne %l4\n\tcmp%.l %3,%1", loperands);
#endif
#endif #endif
} }
else else
...@@ -1339,11 +1206,7 @@ output_scc_di(rtx op, rtx operand1, rtx operand2, rtx dest) ...@@ -1339,11 +1206,7 @@ output_scc_di(rtx op, rtx operand1, rtx operand2, rtx dest)
#endif #endif
} }
#ifdef MOTOROLA output_asm_insn (MOTOROLA ? "jbne %l4" : "jne %l4", loperands);
output_asm_insn ("jbne %l4", loperands);
#else
output_asm_insn ("jne %l4", loperands);
#endif
if (TARGET_68020 || TARGET_COLDFIRE || ! ADDRESS_REG_P (loperands[1])) if (TARGET_68020 || TARGET_COLDFIRE || ! ADDRESS_REG_P (loperands[1]))
output_asm_insn ("tst%.l %1", loperands); output_asm_insn ("tst%.l %1", loperands);
...@@ -1375,11 +1238,10 @@ output_scc_di(rtx op, rtx operand1, rtx operand2, rtx dest) ...@@ -1375,11 +1238,10 @@ output_scc_di(rtx op, rtx operand1, rtx operand2, rtx dest)
case GT: case GT:
loperands[6] = gen_label_rtx(); loperands[6] = gen_label_rtx();
#ifdef MOTOROLA output_asm_insn (MOTOROLA ?
output_asm_insn ("shi %5\n\tjbra %l6", loperands); "shi %5\n\tjbra %l6" :
#else "shi %5\n\tjra %l6",
output_asm_insn ("shi %5\n\tjra %l6", loperands); loperands);
#endif
(*targetm.asm_out.internal_label) (asm_out_file, "L", (*targetm.asm_out.internal_label) (asm_out_file, "L",
CODE_LABEL_NUMBER (loperands[4])); CODE_LABEL_NUMBER (loperands[4]));
output_asm_insn ("sgt %5", loperands); output_asm_insn ("sgt %5", loperands);
...@@ -1395,11 +1257,10 @@ output_scc_di(rtx op, rtx operand1, rtx operand2, rtx dest) ...@@ -1395,11 +1257,10 @@ output_scc_di(rtx op, rtx operand1, rtx operand2, rtx dest)
case LT: case LT:
loperands[6] = gen_label_rtx(); loperands[6] = gen_label_rtx();
#ifdef MOTOROLA output_asm_insn (MOTOROLA ?
output_asm_insn ("scs %5\n\tjbra %l6", loperands); "scs %5\n\tjbra %l6" :
#else "scs %5\n\tjra %l6",
output_asm_insn ("scs %5\n\tjra %l6", loperands); loperands);
#endif
(*targetm.asm_out.internal_label) (asm_out_file, "L", (*targetm.asm_out.internal_label) (asm_out_file, "L",
CODE_LABEL_NUMBER (loperands[4])); CODE_LABEL_NUMBER (loperands[4]));
output_asm_insn ("slt %5", loperands); output_asm_insn ("slt %5", loperands);
...@@ -1415,11 +1276,10 @@ output_scc_di(rtx op, rtx operand1, rtx operand2, rtx dest) ...@@ -1415,11 +1276,10 @@ output_scc_di(rtx op, rtx operand1, rtx operand2, rtx dest)
case GE: case GE:
loperands[6] = gen_label_rtx(); loperands[6] = gen_label_rtx();
#ifdef MOTOROLA output_asm_insn (MOTOROLA ?
output_asm_insn ("scc %5\n\tjbra %l6", loperands); "scc %5\n\tjbra %l6" :
#else "scc %5\n\tjra %l6",
output_asm_insn ("scc %5\n\tjra %l6", loperands); loperands);
#endif
(*targetm.asm_out.internal_label) (asm_out_file, "L", (*targetm.asm_out.internal_label) (asm_out_file, "L",
CODE_LABEL_NUMBER (loperands[4])); CODE_LABEL_NUMBER (loperands[4]));
output_asm_insn ("sge %5", loperands); output_asm_insn ("sge %5", loperands);
...@@ -1435,11 +1295,10 @@ output_scc_di(rtx op, rtx operand1, rtx operand2, rtx dest) ...@@ -1435,11 +1295,10 @@ output_scc_di(rtx op, rtx operand1, rtx operand2, rtx dest)
case LE: case LE:
loperands[6] = gen_label_rtx(); loperands[6] = gen_label_rtx();
#ifdef MOTOROLA output_asm_insn (MOTOROLA ?
output_asm_insn ("sls %5\n\tjbra %l6", loperands); "sls %5\n\tjbra %l6" :
#else "sls %5\n\tjra %l6",
output_asm_insn ("sls %5\n\tjra %l6", loperands); loperands);
#endif
(*targetm.asm_out.internal_label) (asm_out_file, "L", (*targetm.asm_out.internal_label) (asm_out_file, "L",
CODE_LABEL_NUMBER (loperands[4])); CODE_LABEL_NUMBER (loperands[4]));
output_asm_insn ("sle %5", loperands); output_asm_insn ("sle %5", loperands);
...@@ -1937,7 +1796,7 @@ output_move_himode (rtx *operands) ...@@ -1937,7 +1796,7 @@ output_move_himode (rtx *operands)
&& GET_CODE (XEXP (XEXP (operands[1], 0), 0)) != PLUS) && GET_CODE (XEXP (XEXP (operands[1], 0), 0)) != PLUS)
{ {
rtx labelref = XEXP (XEXP (operands[1], 0), 1); rtx labelref = XEXP (XEXP (operands[1], 0), 1);
#if defined (MOTOROLA) && !defined (SGS_SWITCH_TABLES) #if MOTOROLA && !defined (SGS_SWITCH_TABLES)
#ifdef SGS #ifdef SGS
asm_fprintf (asm_out_file, "\tset %LLI%d,.+2\n", asm_fprintf (asm_out_file, "\tset %LLI%d,.+2\n",
CODE_LABEL_NUMBER (XEXP (labelref, 0))); CODE_LABEL_NUMBER (XEXP (labelref, 0)));
...@@ -2461,17 +2320,22 @@ output_addsi3 (rtx *operands) ...@@ -2461,17 +2320,22 @@ output_addsi3 (rtx *operands)
return "lea 0(%1,%2.l),%0"; return "lea 0(%1,%2.l),%0";
else else
return "lea %c2(%1),%0"; return "lea %c2(%1),%0";
#elif defined(MOTOROLA) #else /* !SGS */
if (GET_CODE (operands[2]) == REG) if (MOTOROLA)
return "lea (%1,%2.l),%0"; {
else if (GET_CODE (operands[2]) == REG)
return "lea (%c2,%1),%0"; return "lea (%1,%2.l),%0";
#else /* not MOTOROLA (MIT syntax) */ else
if (GET_CODE (operands[2]) == REG) return "lea (%c2,%1),%0";
return "lea %1@(0,%2:l),%0"; }
else else /* !MOTOROLA (MIT syntax) */
return "lea %1@(%c2),%0"; {
#endif /* not MOTOROLA */ if (GET_CODE (operands[2]) == REG)
return "lea %1@(0,%2:l),%0";
else
return "lea %1@(%c2),%0";
}
#endif /* !SGS */
} }
if (GET_CODE (operands[2]) == CONST_INT) if (GET_CODE (operands[2]) == CONST_INT)
{ {
...@@ -2509,11 +2373,7 @@ output_addsi3 (rtx *operands) ...@@ -2509,11 +2373,7 @@ output_addsi3 (rtx *operands)
if (TARGET_68040) if (TARGET_68040)
return "add%.w %2,%0"; return "add%.w %2,%0";
else else
#ifdef MOTOROLA return MOTOROLA ? "lea (%c2,%0),%0" : "lea %0@(%c2),%0";
return "lea (%c2,%0),%0";
#else
return "lea %0@(%c2),%0";
#endif
} }
} }
return "add%.l %2,%0"; return "add%.l %2,%0";
...@@ -2818,60 +2678,31 @@ print_operand (FILE *file, rtx op, int letter) ...@@ -2818,60 +2678,31 @@ print_operand (FILE *file, rtx op, int letter)
{ {
if (letter == '.') if (letter == '.')
{ {
#if defined (MOTOROLA) if (MOTOROLA)
fprintf (file, "."); fprintf (file, ".");
#endif
} }
else if (letter == '#') else if (letter == '#')
{ asm_fprintf (file, "%I");
asm_fprintf (file, "%I");
}
else if (letter == '-') else if (letter == '-')
{ asm_fprintf (file, MOTOROLA ? "-(%Rsp)" : "%Rsp@-");
#ifdef MOTOROLA
asm_fprintf (file, "-(%Rsp)");
#else
asm_fprintf (file, "%Rsp@-");
#endif
}
else if (letter == '+') else if (letter == '+')
{ asm_fprintf (file, MOTOROLA ? "(%Rsp)+" : "%Rsp@+");
#ifdef MOTOROLA
asm_fprintf (file, "(%Rsp)+");
#else
asm_fprintf (file, "%Rsp@+");
#endif
}
else if (letter == '@') else if (letter == '@')
{ asm_fprintf (file, MOTOROLA ? "(%Rsp)" : "%Rsp@");
#ifdef MOTOROLA
asm_fprintf (file, "(%Rsp)");
#else
asm_fprintf (file, "%Rsp@");
#endif
}
else if (letter == '!') else if (letter == '!')
{ asm_fprintf (file, "%Rfpcr");
asm_fprintf (file, "%Rfpcr");
}
else if (letter == '$') else if (letter == '$')
{ {
if (TARGET_68040_ONLY) if (TARGET_68040_ONLY)
{ fprintf (file, "s");
fprintf (file, "s");
}
} }
else if (letter == '&') else if (letter == '&')
{ {
if (TARGET_68040_ONLY) if (TARGET_68040_ONLY)
{ fprintf (file, "d");
fprintf (file, "d");
}
} }
else if (letter == '/') else if (letter == '/')
{ asm_fprintf (file, "%R");
asm_fprintf (file, "%R");
}
else if (letter == 'o') else if (letter == 'o')
{ {
/* This is only for direct addresses with TARGET_PCREL */ /* This is only for direct addresses with TARGET_PCREL */
...@@ -2897,13 +2728,7 @@ print_operand (FILE *file, rtx op, int letter) ...@@ -2897,13 +2728,7 @@ print_operand (FILE *file, rtx op, int letter)
&& !(GET_CODE (XEXP (op, 0)) == CONST_INT && !(GET_CODE (XEXP (op, 0)) == CONST_INT
&& INTVAL (XEXP (op, 0)) < 0x8000 && INTVAL (XEXP (op, 0)) < 0x8000
&& INTVAL (XEXP (op, 0)) >= -0x8000)) && INTVAL (XEXP (op, 0)) >= -0x8000))
{ fprintf (file, MOTOROLA ? ".l" : ":l");
#ifdef MOTOROLA
fprintf (file, ".l");
#else
fprintf (file, ":l");
#endif
}
} }
else if (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == SFmode) else if (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == SFmode)
{ {
...@@ -2968,18 +2793,18 @@ print_operand (FILE *file, rtx op, int letter) ...@@ -2968,18 +2793,18 @@ print_operand (FILE *file, rtx op, int letter)
-fPIC code the offset is output in long mode (eg movel a5@(_foo:l), a0) */ -fPIC code the offset is output in long mode (eg movel a5@(_foo:l), a0) */
#ifndef ASM_OUTPUT_CASE_FETCH #ifndef ASM_OUTPUT_CASE_FETCH
#ifdef MOTOROLA # if MOTOROLA
#ifdef SGS # ifdef SGS
#define ASM_OUTPUT_CASE_FETCH(file, labelno, regname)\ # define ASM_OUTPUT_CASE_FETCH(file, labelno, regname)\
asm_fprintf (file, "%LLD%d(%Rpc,%s.", labelno, regname) asm_fprintf (file, "%LLD%d(%Rpc,%s.", labelno, regname)
#else # else /* !SGS */
#define ASM_OUTPUT_CASE_FETCH(file, labelno, regname)\ # define ASM_OUTPUT_CASE_FETCH(file, labelno, regname)\
asm_fprintf (file, "%LL%d-%LLI%d.b(%Rpc,%s.", labelno, labelno, regname) asm_fprintf (file, "%LL%d-%LLI%d.b(%Rpc,%s.", labelno, labelno, regname)
#endif # endif /* !SGS */
#else # else /* !MOTOROLA */
#define ASM_OUTPUT_CASE_FETCH(file, labelno, regname)\ # define ASM_OUTPUT_CASE_FETCH(file, labelno, regname)\
asm_fprintf (file, "%Rpc@(%LL%d-%LLI%d-2:b,%s:", labelno, labelno, regname) asm_fprintf (file, "%Rpc@(%LL%d-%LLI%d-2:b,%s:", labelno, labelno, regname)
#endif # endif /* !MOTOROLA */
#endif /* ASM_OUTPUT_CASE_FETCH */ #endif /* ASM_OUTPUT_CASE_FETCH */
void void
...@@ -2991,25 +2816,15 @@ print_operand_address (FILE *file, rtx addr) ...@@ -2991,25 +2816,15 @@ print_operand_address (FILE *file, rtx addr)
switch (GET_CODE (addr)) switch (GET_CODE (addr))
{ {
case REG: case REG:
#ifdef MOTOROLA fprintf (file, MOTOROLA ? "(%s)" : "%s@", reg_names[REGNO (addr)]);
fprintf (file, "(%s)", reg_names[REGNO (addr)]);
#else
fprintf (file, "%s@", reg_names[REGNO (addr)]);
#endif
break; break;
case PRE_DEC: case PRE_DEC:
#ifdef MOTOROLA fprintf (file, MOTOROLA ? "-(%s)" : "%s@-",
fprintf (file, "-(%s)", reg_names[REGNO (XEXP (addr, 0))]); reg_names[REGNO (XEXP (addr, 0))]);
#else
fprintf (file, "%s@-", reg_names[REGNO (XEXP (addr, 0))]);
#endif
break; break;
case POST_INC: case POST_INC:
#ifdef MOTOROLA fprintf (file, MOTOROLA ? "(%s)+" : "%s@+",
fprintf (file, "(%s)+", reg_names[REGNO (XEXP (addr, 0))]); reg_names[REGNO (XEXP (addr, 0))]);
#else
fprintf (file, "%s@+", reg_names[REGNO (XEXP (addr, 0))]);
#endif
break; break;
case PLUS: case PLUS:
reg1 = reg2 = ireg = breg = offset = 0; reg1 = reg2 = ireg = breg = offset = 0;
...@@ -3129,13 +2944,7 @@ print_operand_address (FILE *file, rtx addr) ...@@ -3129,13 +2944,7 @@ print_operand_address (FILE *file, rtx addr)
fprintf (file, "l"); fprintf (file, "l");
} }
if (scale != 1) if (scale != 1)
{ fprintf (file, MOTOROLA ? "*%d" : ":%d", scale);
#ifdef MOTOROLA
fprintf (file, "*%d", scale);
#else
fprintf (file, ":%d", scale);
#endif
}
putc (')', file); putc (')', file);
break; break;
} }
...@@ -3159,66 +2968,55 @@ print_operand_address (FILE *file, rtx addr) ...@@ -3159,66 +2968,55 @@ print_operand_address (FILE *file, rtx addr)
{ {
abort (); abort ();
} }
#ifdef MOTOROLA if (MOTOROLA)
if (addr != 0)
{ {
output_addr_const (file, addr); if (addr != 0)
if (flag_pic && (breg == pic_offset_table_rtx))
{ {
fprintf (file, "@GOT"); output_addr_const (file, addr);
if (flag_pic == 1) if (flag_pic && (breg == pic_offset_table_rtx))
fprintf (file, ".w"); {
fprintf (file, "@GOT");
if (flag_pic == 1)
fprintf (file, ".w");
}
} }
fprintf (file, "(%s", reg_names[REGNO (breg)]);
if (ireg != 0)
putc (',', file);
} }
fprintf (file, "(%s", reg_names[REGNO (breg)]); else /* !MOTOROLA */
if (ireg != 0)
{
putc (',', file);
}
#else
fprintf (file, "%s@(", reg_names[REGNO (breg)]);
if (addr != 0)
{
output_addr_const (file, addr);
if ((flag_pic == 1) && (breg == pic_offset_table_rtx))
fprintf (file, ":w");
if ((flag_pic == 2) && (breg == pic_offset_table_rtx))
fprintf (file, ":l");
}
if (addr != 0 && ireg != 0)
{ {
putc (',', file); fprintf (file, "%s@(", reg_names[REGNO (breg)]);
} if (addr != 0)
#endif {
output_addr_const (file, addr);
if (breg == pic_offset_table_rtx)
switch (flag_pic)
{
case 1:
fprintf (file, ":w"); break;
case 2:
fprintf (file, ":l"); break;
default:
break;
}
if (ireg != 0)
putc (',', file);
}
} /* !MOTOROLA */
if (ireg != 0 && GET_CODE (ireg) == MULT) if (ireg != 0 && GET_CODE (ireg) == MULT)
{ {
scale = INTVAL (XEXP (ireg, 1)); scale = INTVAL (XEXP (ireg, 1));
ireg = XEXP (ireg, 0); ireg = XEXP (ireg, 0);
} }
if (ireg != 0 && GET_CODE (ireg) == SIGN_EXTEND) if (ireg != 0 && GET_CODE (ireg) == SIGN_EXTEND)
{ fprintf (file, MOTOROLA ? "%s.w" : "%s:w",
#ifdef MOTOROLA reg_names[REGNO (XEXP (ireg, 0))]);
fprintf (file, "%s.w", reg_names[REGNO (XEXP (ireg, 0))]);
#else
fprintf (file, "%s:w", reg_names[REGNO (XEXP (ireg, 0))]);
#endif
}
else if (ireg != 0) else if (ireg != 0)
{ fprintf (file, MOTOROLA ? "%s.l" : "%s:l",
#ifdef MOTOROLA reg_names[REGNO (ireg)]);
fprintf (file, "%s.l", reg_names[REGNO (ireg)]);
#else
fprintf (file, "%s:l", reg_names[REGNO (ireg)]);
#endif
}
if (scale != 1) if (scale != 1)
{ fprintf (file, MOTOROLA ? "*%d" : ":%d", scale);
#ifdef MOTOROLA
fprintf (file, "*%d", scale);
#else
fprintf (file, ":%d", scale);
#endif
}
putc (')', file); putc (')', file);
break; break;
} }
...@@ -3237,16 +3035,15 @@ print_operand_address (FILE *file, rtx addr) ...@@ -3237,16 +3035,15 @@ print_operand_address (FILE *file, rtx addr)
&& INTVAL (addr) < 0x8000 && INTVAL (addr) < 0x8000
&& INTVAL (addr) >= -0x8000) && INTVAL (addr) >= -0x8000)
{ {
#ifdef MOTOROLA if (MOTOROLA)
#ifdef SGS #ifdef SGS
/* Many SGS assemblers croak on size specifiers for constants. */ /* Many SGS assemblers croak on size specifiers for constants. */
fprintf (file, "%d", (int) INTVAL (addr)); fprintf (file, "%d", (int) INTVAL (addr));
#else
fprintf (file, "%d.w", (int) INTVAL (addr));
#endif
#else #else
fprintf (file, "%d:w", (int) INTVAL (addr)); fprintf (file, "%d.w", (int) INTVAL (addr));
#endif #endif
else /* !MOTOROLA */
fprintf (file, "%d:w", (int) INTVAL (addr));
} }
else if (GET_CODE (addr) == CONST_INT) else if (GET_CODE (addr) == CONST_INT)
{ {
...@@ -3332,7 +3129,6 @@ strict_low_part_peephole_ok (enum machine_mode mode, rtx first_insn, ...@@ -3332,7 +3129,6 @@ strict_low_part_peephole_ok (enum machine_mode mode, rtx first_insn,
} }
p = prev_nonnote_insn (p); p = prev_nonnote_insn (p);
} }
return false; return false;
...@@ -3653,23 +3449,20 @@ m68k_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED, ...@@ -3653,23 +3449,20 @@ m68k_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED,
const char *fmt; const char *fmt;
if (delta > 0 && delta <= 8) if (delta > 0 && delta <= 8)
#ifdef MOTOROLA asm_fprintf (file, MOTOROLA ?
asm_fprintf (file, "\taddq.l %I%d,4(%Rsp)\n", (int) delta); "\taddq.l %I%d,4(%Rsp)\n" :
#else "\taddql %I%d,%Rsp@(4)\n",
asm_fprintf (file, "\taddql %I%d,%Rsp@(4)\n", (int) delta); (int) delta);
#endif
else if (delta < 0 && delta >= -8) else if (delta < 0 && delta >= -8)
#ifdef MOTOROLA asm_fprintf (file, MOTOROLA ?
asm_fprintf (file, "\tsubq.l %I%d,4(%Rsp)\n", (int) -delta); "\tsubq.l %I%d,4(%Rsp)\n" :
#else "\tsubql %I%d,%Rsp@(4)\n",
asm_fprintf (file, "\tsubql %I%d,%Rsp@(4)\n", (int) -delta); (int) -delta);
#endif
else else
#ifdef MOTOROLA asm_fprintf (file, MOTOROLA ?
asm_fprintf (file, "\tadd.l %I%wd,4(%Rsp)\n", delta); "\tadd.l %I%wd,4(%Rsp)\n" :
#else "\taddl %I%wd,%Rsp@(4)\n",
asm_fprintf (file, "\taddl %I%wd,%Rsp@(4)\n", delta); delta);
#endif
xops[0] = DECL_RTL (function); xops[0] = DECL_RTL (function);
...@@ -3680,22 +3473,19 @@ m68k_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED, ...@@ -3680,22 +3473,19 @@ m68k_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED,
fmt = "bra.l %o0"; fmt = "bra.l %o0";
else if ((flag_pic == 1) || TARGET_68020) else if ((flag_pic == 1) || TARGET_68020)
{ {
#ifdef MOTOROLA if (MOTOROLA)
#ifdef HPUX_ASM #ifdef HPUX_ASM
fmt = "bra.l %0"; fmt = "bra.l %0";
#else #elif defined(USE_GAS)
#ifdef USE_GAS fmt = "bra.l %0@PLTPC";
fmt = "bra.l %0@PLTPC";
#else #else
fmt = "bra %0@PLTPC"; fmt = "bra %0@PLTPC";
#endif #endif
#endif else /* !MOTOROLA */
#else
#ifdef USE_GAS #ifdef USE_GAS
fmt = "bra.l %0"; fmt = "bra.l %0";
#else #else
fmt = "jra %0,a1"; fmt = "jra %0,a1";
#endif
#endif #endif
} }
else if (optimize_size || TARGET_ID_SHARED_LIBRARY) else if (optimize_size || TARGET_ID_SHARED_LIBRARY)
...@@ -3705,7 +3495,7 @@ m68k_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED, ...@@ -3705,7 +3495,7 @@ m68k_output_mi_thunk (FILE *file, tree thunk ATTRIBUTE_UNUSED,
} }
else else
{ {
#if defined (MOTOROLA) && !defined (USE_GAS) #if MOTOROLA && !defined (USE_GAS)
fmt = "jmp %0"; fmt = "jmp %0";
#else #else
fmt = "jra %0"; fmt = "jra %0";
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment