OSDN Git Service

* config/m68k/m68k.c (m68k_rtx_costs): Adjust mul/div costs for
[pf3gnuchains/gcc-fork.git] / gcc / config / m68k / m68k.c
index 57ddad2..9d142c5 100644 (file)
@@ -1,5 +1,5 @@
 /* Subroutines for insn-output.c for Motorola 68000 family.
-   Copyright (C) 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001
+   Copyright (C) 1987, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2000, 2001, 2003
    Free Software Foundation, Inc.
 
 This file is part of GNU CC.
@@ -21,6 +21,8 @@ Boston, MA 02111-1307, USA.  */
 
 #include "config.h"
 #include "system.h"
+#include "coretypes.h"
+#include "tm.h"
 #include "tree.h"
 #include "rtl.h"
 #include "function.h"
@@ -43,16 +45,6 @@ Boston, MA 02111-1307, USA.  */
 /* Needed for use_return_insn.  */
 #include "flags.h"
 
-#ifdef SUPPORT_SUN_FPA
-
-/* Index into this array by (register number >> 3) to find the
-   smallest class which contains that register.  */
-enum reg_class regno_reg_class[]
-  = { DATA_REGS, ADDR_REGS, FP_REGS,
-      LO_FPA_REGS, LO_FPA_REGS, FPA_REGS, FPA_REGS };
-
-#endif /* defined SUPPORT_SUN_FPA */
-
 /* This flag is used to communicate between movhi and ASM_OUTPUT_CASE_END,
    if SGS_SWITCH_TABLE.  */
 int switch_table_difference_label_flag;
@@ -61,26 +53,34 @@ static rtx find_addr_reg PARAMS ((rtx));
 static const char *singlemove_string PARAMS ((rtx *));
 static void m68k_output_function_prologue PARAMS ((FILE *, HOST_WIDE_INT));
 static void m68k_output_function_epilogue PARAMS ((FILE *, HOST_WIDE_INT));
-static void m68k_coff_asm_named_section PARAMS ((const char *, unsigned int,
-                                                unsigned int));
+static void m68k_coff_asm_named_section PARAMS ((const char *, unsigned int));
 #ifdef CTOR_LIST_BEGIN
 static void m68k_svr3_asm_out_constructor PARAMS ((rtx, int));
 #endif
+#ifdef HPUX_ASM
+static void m68k_hp320_internal_label PARAMS ((FILE *, const char *, unsigned long));
+static void m68k_hp320_file_start PARAMS ((void));
+#endif
+static void m68k_output_mi_thunk PARAMS ((FILE *, tree, HOST_WIDE_INT,
+                                         HOST_WIDE_INT, tree));
+static int m68k_save_reg PARAMS ((unsigned int));
+static int const_int_cost PARAMS ((rtx));
+static bool m68k_rtx_costs PARAMS ((rtx, int, int, int *));
 \f
 
 /* Alignment to use for loops and jumps */
-/* Specify power of two alignment used for loops. */
+/* Specify power of two alignment used for loops.  */
 const char *m68k_align_loops_string;
-/* Specify power of two alignment used for non-loop jumps. */
+/* Specify power of two alignment used for non-loop jumps.  */
 const char *m68k_align_jumps_string;
-/* Specify power of two alignment used for functions. */
+/* Specify power of two alignment used for functions.  */
 const char *m68k_align_funcs_string;
 
-/* Specify power of two alignment used for loops. */
+/* Specify power of two alignment used for loops.  */
 int m68k_align_loops;
-/* Specify power of two alignment used for non-loop jumps. */
+/* Specify power of two alignment used for non-loop jumps.  */
 int m68k_align_jumps;
-/* Specify power of two alignment used for functions. */
+/* Specify power of two alignment used for functions.  */
 int m68k_align_funcs;
 
 /* Nonzero if the last compare/test insn had FP operands.  The
@@ -89,10 +89,54 @@ int m68k_align_funcs;
 int m68k_last_compare_had_fp_operands;
 \f
 /* Initialize the GCC target structure.  */
+
+#if INT_OP_GROUP == INT_OP_DOT_WORD
+#undef TARGET_ASM_ALIGNED_HI_OP
+#define TARGET_ASM_ALIGNED_HI_OP "\t.word\t"
+#endif
+
+#if INT_OP_GROUP == INT_OP_NO_DOT
+#undef TARGET_ASM_BYTE_OP
+#define TARGET_ASM_BYTE_OP "\tbyte\t"
+#undef TARGET_ASM_ALIGNED_HI_OP
+#define TARGET_ASM_ALIGNED_HI_OP "\tshort\t"
+#undef TARGET_ASM_ALIGNED_SI_OP
+#define TARGET_ASM_ALIGNED_SI_OP "\tlong\t"
+#endif
+
+#if INT_OP_GROUP == INT_OP_DC
+#undef TARGET_ASM_BYTE_OP
+#define TARGET_ASM_BYTE_OP "\tdc.b\t"
+#undef TARGET_ASM_ALIGNED_HI_OP
+#define TARGET_ASM_ALIGNED_HI_OP "\tdc.w\t"
+#undef TARGET_ASM_ALIGNED_SI_OP
+#define TARGET_ASM_ALIGNED_SI_OP "\tdc.l\t"
+#endif
+
+#undef TARGET_ASM_UNALIGNED_HI_OP
+#define TARGET_ASM_UNALIGNED_HI_OP TARGET_ASM_ALIGNED_HI_OP
+#undef TARGET_ASM_UNALIGNED_SI_OP
+#define TARGET_ASM_UNALIGNED_SI_OP TARGET_ASM_ALIGNED_SI_OP
+
 #undef TARGET_ASM_FUNCTION_PROLOGUE
 #define TARGET_ASM_FUNCTION_PROLOGUE m68k_output_function_prologue
 #undef TARGET_ASM_FUNCTION_EPILOGUE
 #define TARGET_ASM_FUNCTION_EPILOGUE m68k_output_function_epilogue
+#ifdef HPUX_ASM
+#undef TARGET_ASM_INTERNAL_LABEL
+#define  TARGET_ASM_INTERNAL_LABEL m68k_hp320_internal_label
+#endif
+
+#undef TARGET_ASM_OUTPUT_MI_THUNK
+#define TARGET_ASM_OUTPUT_MI_THUNK m68k_output_mi_thunk
+#undef TARGET_ASM_CAN_OUTPUT_MI_THUNK
+#define TARGET_ASM_CAN_OUTPUT_MI_THUNK default_can_output_mi_thunk_no_vcall
+
+#undef TARGET_ASM_FILE_START_APP_OFF
+#define TARGET_ASM_FILE_START_APP_OFF true
+
+#undef TARGET_RTX_COSTS
+#define TARGET_RTX_COSTS m68k_rtx_costs
 
 struct gcc_target targetm = TARGET_INITIALIZER;
 \f
@@ -146,237 +190,71 @@ override_options ()
       else
        m68k_align_funcs = i;
     }
-}
-\f
-/* This function generates the assembly code for function entry.
-   STREAM is a stdio stream to output the code to.
-   SIZE is an int: how many units of temporary storage to allocate.
-   Refer to the array `regs_ever_live' to determine which registers
-   to save; `regs_ever_live[I]' is nonzero if register number I
-   is ever used in the function.  This function is responsible for
-   knowing which registers should not be saved even if used.  */
-
-
-/* Note that the order of the bit mask for fmovem is the opposite
-   of the order for movem!  */
-
-#ifdef CRDS
-
-static void
-m68k_output_function_prologue (stream, size)
-     FILE *stream;
-     HOST_WIDE_INT size;
-{
-  register int regno;
-  register int mask = 0;
-  extern char call_used_regs[];
-  HOST_WIDE_INT fsize = ((size) + 3) & -4;
-
-  /* unos stack probe */
-  if (fsize > 30000)
-    {
-      fprintf (stream, "\tmovel sp,a0\n");
-      fprintf (stream, "\taddl $-%d,a0\n", 2048 + fsize);
-      fprintf (stream, "\ttstb (a0)\n");
-    }
-  else
-    fprintf (stream, "\ttstb -%d(sp)\n", 2048 + fsize);
 
-  if (frame_pointer_needed)
-    {
-      if (TARGET_68020 || fsize < 0x8000)
-       fprintf (stream, "\tlink a6,$%d\n", -fsize);
-      else
-       fprintf (stream, "\tlink a6,$0\n\tsubl $%d,sp\n", fsize);
-    }
-  else if (fsize)
-    {
-      /* Adding negative number is faster on the 68040.  */
-      if (fsize + 4 < 0x8000)
-         fprintf (stream, "\tadd.w #%d,sp\n", - (fsize + 4));
-      else
-         fprintf (stream, "\tadd.l #%d,sp\n", - (fsize + 4));
-    }
+  /* -fPIC uses 32-bit pc-relative displacements, which don't exist
+     until the 68020.  */
+  if (! TARGET_68020 && flag_pic == 2)
+    error("-fPIC is not currently supported on the 68000 or 68010\n");
 
-  for (regno = 16; regno < 24; regno++)
-    if (regs_ever_live[regno] && ! call_used_regs[regno])
-      mask |= 1 << (regno - 16);
+  /* ??? A historic way of turning on pic, or is this intended to
+     be an embedded thing that doesn't have the same name binding
+     significance that it does on hosted ELF systems?  */
+  if (TARGET_PCREL && flag_pic == 0)
+    flag_pic = 1;
 
-  if ((mask & 0xff) != 0)
-    fprintf (stream, "\tfmovem $0x%x,-(sp)\n", mask & 0xff);
+  /* Turn off function cse if we are doing PIC.  We always want function call
+     to be done as `bsr foo@PLTPC', so it will force the assembler to create
+     the PLT entry for `foo'. Doing function cse will cause the address of
+     `foo' to be loaded into a register, which is exactly what we want to
+     avoid when we are doing PIC on svr4 m68k.  */
+  if (flag_pic)
+    flag_no_function_cse = 1;
 
-  mask = 0;
-  for (regno = 0; regno < 16; regno++)
-    if (regs_ever_live[regno] && ! call_used_regs[regno])
-      mask |= 1 << (15 - regno);
-  if (frame_pointer_needed)
-    mask &= ~ (1 << (15-FRAME_POINTER_REGNUM));
+  SUBTARGET_OVERRIDE_OPTIONS;
 
-  if (exact_log2 (mask) >= 0)
-    fprintf (stream, "\tmovel %s,-(sp)\n", reg_names[15 - exact_log2 (mask)]);
-  else if (mask)
-    fprintf (stream, "\tmovem $0x%x,-(sp)\n", mask);
+  /* Tell the compiler which flavor of XFmode we're using.  */
+  real_format_for_mode[XFmode - QFmode] = &ieee_extended_motorola_format;
 }
-
-#else
-#if defined (DPX2) && defined (MOTOROLA)
-
-static void
-m68k_output_function_prologue (stream, size)
-     FILE *stream;
-     HOST_WIDE_INT size;
+\f
+/* Return 1 if we need to save REGNO.  */
+static int
+m68k_save_reg (regno)
+     unsigned int regno;
 {
-  register int regno;
-  register int mask = 0;
-  int num_saved_regs = 0, first = 1;
-  extern char call_used_regs[];
-  HOST_WIDE_INT fsize = ((size) + 3) & -4;
-
-  if (frame_pointer_needed)
-    {
-      /* Adding negative number is faster on the 68040.  */
-      if (fsize < 0x8000 && !TARGET_68040)
-       fprintf (stream, "\tlink %s,#%d\n",
-                reg_names[FRAME_POINTER_REGNUM], -fsize);
-      else if (TARGET_68020)
-       fprintf (stream, "\tlink %s,#%d\n",
-                reg_names[FRAME_POINTER_REGNUM], -fsize);
-      else
-       fprintf (stream, "\tlink %s,#0\n\tadd.l #%d,sp\n",
-                reg_names[FRAME_POINTER_REGNUM], -fsize);
-    }
-  else if (fsize)
-    {
-      /* Adding negative number is faster on the 68040.  */
-      if (fsize + 4 < 0x8000)
-       fprintf (stream, "\tadd.w #%d,sp\n", - (fsize + 4));
-      else
-       fprintf (stream, "\tadd.l #%d,sp\n", - (fsize + 4));
-    }
-
-  for (regno = 23; regno >= 16; regno--)
-    if (regs_ever_live[regno] && ! call_used_regs[regno])
-      {
-       if (first)
-         {
-           fprintf (stream, "\tfmovem.x %s", reg_names[regno]);
-           first = 0;
-         }
-       else
-         fprintf (stream, "/%s", reg_names[regno]);
-      }
-  if (!first)
-    fprintf (stream, ",-(sp)\n");
-
-  mask = 0;
-  for (regno = 0; regno < 16; regno++)
-    if (regs_ever_live[regno] && ! call_used_regs[regno])
-      {
-        mask |= 1 << (15 - regno);
-        num_saved_regs++;
-      }
-
-  if (frame_pointer_needed)
-    {
-      mask &= ~ (1 << (15 - FRAME_POINTER_REGNUM));
-      num_saved_regs--;
-    }
-
-  if (num_saved_regs <= 2)
-    {
-      /* Store each separately in the same order moveml uses.
-         Using two movel instructions instead of a single moveml
-         is about 15% faster for the 68020 and 68030 at no expense
-         in code size */
-
-      int i;
+  if (flag_pic && current_function_uses_pic_offset_table
+      && regno == PIC_OFFSET_TABLE_REGNUM)
+    return 1;
 
-      /* Undo the work from above. */
-      for (i = 0; i< 16; i++)
-        if (mask & (1 << i))
-          fprintf (stream, "\tmove.l %s,-(sp)\n", reg_names[15 - i]);
-    }
-  else if (mask)
+  if (current_function_calls_eh_return)
     {
-      first = 1;
-      for (regno = 0; regno < 16; regno++)
-        if (mask & (1 << regno))
-         {
-           if (first)
-             {
-               fprintf (stream, "\tmovem.l %s", reg_names[15 - regno]);
-               first = 0;
-             }
-           else
-             fprintf (stream, "/%s", reg_names[15 - regno]);
-         }
-      fprintf (stream, ",-(sp)\n");
+      unsigned int i;
+      for (i = 0; ; i++)
+       {
+         unsigned int test = EH_RETURN_DATA_REGNO (i);
+         if (test == INVALID_REGNUM)
+           break;
+         if (test == regno)
+           return 1;
+       }
     }
 
-  if (flag_pic && current_function_uses_pic_offset_table)
-    {
-      fprintf (stream, "\tmove.l #__GLOBAL_OFFSET_TABLE_, %s\n",
-              reg_names[PIC_OFFSET_TABLE_REGNUM]);
-      fprintf (stream, "\tlea.l (pc,%s.l),%s\n",
-              reg_names[PIC_OFFSET_TABLE_REGNUM],
-              reg_names[PIC_OFFSET_TABLE_REGNUM]);
-    }
+  return (regs_ever_live[regno]
+         && !call_used_regs[regno]
+         && !fixed_regs[regno]
+         && !(regno == FRAME_POINTER_REGNUM && frame_pointer_needed));
 }
 
-#else
-#if defined (NEWS) && defined (MOTOROLA)
-
-static void
-m68k_output_function_prologue (stream, size)
-     FILE *stream;
-     HOST_WIDE_INT size;
-{
-  register int regno;
-  register int mask = 0;
-  extern char call_used_regs[];
-  HOST_WIDE_INT fsize = ((size) + 3) & -4;
-
-  if (frame_pointer_needed)
-    {
-      if (fsize < 0x8000)
-       fprintf (stream, "\tlink fp,#%d\n", -fsize);
-      else if (TARGET_68020)
-       fprintf (stream, "\tlink.l fp,#%d\n", -fsize);
-      else
-       fprintf (stream, "\tlink fp,#0\n\tsub.l #%d,sp\n", fsize);
-    }
-  else if (fsize)
-    {
-      int amt = fsize + 4;
-      /* Adding negative number is faster on the 68040.  */
-      if (fsize + 4 < 0x8000)
-       asm_fprintf (stream, "\tadd.w %0I%d,%Rsp\n", - amt);
-      else
-       asm_fprintf (stream, "\tadd.l %0I%d,%Rsp\n", - amt);
-    }
-
-  for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++)
-    if (regs_ever_live[regno] && ! call_used_regs[regno])
-      mask |= 1 << (regno - 16);
-
-  if (mask != 0)
-    fprintf (stream, "\tfmovem.x #0x%x,-(sp)\n", mask & 0xff);
-
-  mask = 0;
-  for (regno = 0; regno < 16; regno++)
-    if (regs_ever_live[regno] && ! call_used_regs[regno])
-      mask |= 1 << (15 - regno);
-
-  if (frame_pointer_needed)
-    mask &= ~ (1 << (15-FRAME_POINTER_REGNUM));
+/* This function generates the assembly code for function entry.
+   STREAM is a stdio stream to output the code to.
+   SIZE is an int: how many units of temporary storage to allocate.
+   Refer to the array `regs_ever_live' to determine which registers
+   to save; `regs_ever_live[I]' is nonzero if register number I
+   is ever used in the function.  This function is responsible for
+   knowing which registers should not be saved even if used.  */
 
-  if (exact_log2 (mask) >= 0)
-    fprintf (stream, "\tmove.l %s,-(sp)\n", reg_names[15 - exact_log2 (mask)]);
-  else
-    if (mask) fprintf (stream, "\tmovem.l #0x%x,-(sp)\n", mask);
-}
 
-#else  /* !CRDS && ! (NEWS && MOTOROLA) && ! (DPX2 && MOTOROLA) */
+/* Note that the order of the bit mask for fmovem is the opposite
+   of the order for movem!  */
 
 static void
 m68k_output_function_prologue (stream, size)
@@ -386,7 +264,6 @@ m68k_output_function_prologue (stream, size)
   register int regno;
   register int mask = 0;
   int num_saved_regs = 0;
-  extern char call_used_regs[];
   HOST_WIDE_INT fsize = (size + 3) & -4;
   HOST_WIDE_INT cfa_offset = INCOMING_FRAME_SP_OFFSET;
   HOST_WIDE_INT cfa_store_offset = cfa_offset;
@@ -397,10 +274,10 @@ m68k_output_function_prologue (stream, size)
       && GET_CODE (stack_limit_rtx) == SYMBOL_REF)
     {
 #if defined (MOTOROLA)
-      asm_fprintf (stream, "\tcmp.l %0I%s+%d,%Rsp\n\ttrapcs\n",
+      asm_fprintf (stream, "\tcmp.l %I%s+%wd,%Rsp\n\ttrapcs\n",
                   XSTR (stack_limit_rtx, 0), fsize + 4);
 #else
-      asm_fprintf (stream, "\tcmpl %0I%s+%d,%Rsp\n\ttrapcs\n",
+      asm_fprintf (stream, "\tcmpl %I%s+%wd,%Rsp\n\ttrapcs\n",
                   XSTR (stack_limit_rtx, 0), fsize + 4);
 #endif
     }
@@ -411,32 +288,34 @@ m68k_output_function_prologue (stream, size)
        {
        /* on the 68040, pea + move is faster than link.w 0 */
 #ifdef MOTOROLA
-         asm_fprintf (stream, "\tpea (%s)\n\tmove.l %s,%s\n",
-              reg_names[FRAME_POINTER_REGNUM], reg_names[STACK_POINTER_REGNUM],
-              reg_names[FRAME_POINTER_REGNUM]);
+         fprintf (stream, "\tpea (%s)\n\tmove.l %s,%s\n",
+                  reg_names[FRAME_POINTER_REGNUM],
+                  reg_names[STACK_POINTER_REGNUM],
+                  reg_names[FRAME_POINTER_REGNUM]);
 #else
-         asm_fprintf (stream, "\tpea %s@\n\tmovel %s,%s\n",
-              reg_names[FRAME_POINTER_REGNUM], reg_names[STACK_POINTER_REGNUM],
-              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 < 0x8000)
        {
 #ifdef MOTOROLA
-         asm_fprintf (stream, "\tlink.w %s,%0I%d\n",
+         asm_fprintf (stream, "\tlink.w %s,%I%wd\n",
                       reg_names[FRAME_POINTER_REGNUM], -fsize);
 #else
-         asm_fprintf (stream, "\tlink %s,%0I%d\n",
+         asm_fprintf (stream, "\tlink %s,%I%wd\n",
                       reg_names[FRAME_POINTER_REGNUM], -fsize);
 #endif
        }
       else if (TARGET_68020)
        {
 #ifdef MOTOROLA
-         asm_fprintf (stream, "\tlink.l %s,%0I%d\n",
+         asm_fprintf (stream, "\tlink.l %s,%I%wd\n",
                       reg_names[FRAME_POINTER_REGNUM], -fsize);
 #else
-         asm_fprintf (stream, "\tlink %s,%0I%d\n",
+         asm_fprintf (stream, "\tlink %s,%I%wd\n",
                       reg_names[FRAME_POINTER_REGNUM], -fsize);
 #endif
        }
@@ -444,10 +323,10 @@ m68k_output_function_prologue (stream, size)
        {
       /* Adding negative number is faster on the 68040.  */
 #ifdef MOTOROLA
-         asm_fprintf (stream, "\tlink.w %s,%0I0\n\tadd.l %0I%d,%Rsp\n",
+         asm_fprintf (stream, "\tlink.w %s,%I0\n\tadd.l %I%wd,%Rsp\n",
                       reg_names[FRAME_POINTER_REGNUM], -fsize);
 #else
-         asm_fprintf (stream, "\tlink %s,%0I0\n\taddl %0I%d,%Rsp\n",
+         asm_fprintf (stream, "\tlink %s,%I0\n\taddl %I%wd,%Rsp\n",
                       reg_names[FRAME_POINTER_REGNUM], -fsize);
 #endif
        }
@@ -466,107 +345,80 @@ m68k_output_function_prologue (stream, size)
     {
       if (fsize + 4 < 0x8000)
        {
-#ifndef NO_ADDSUB_Q
          if (fsize + 4 <= 8)
            {
-             if (!TARGET_5200)
+             if (!TARGET_COLDFIRE)
                {
-                 /* asm_fprintf() cannot handle %. */
+                 /* asm_fprintf() cannot handle %.  */
 #ifdef MOTOROLA
-                 asm_fprintf (stream, "\tsubq.w %0I%d,%Rsp\n", fsize + 4);
+                 asm_fprintf (stream, "\tsubq.w %I%wd,%Rsp\n", fsize + 4);
 #else
-                 asm_fprintf (stream, "\tsubqw %0I%d,%Rsp\n", fsize + 4);
+                 asm_fprintf (stream, "\tsubqw %I%wd,%Rsp\n", fsize + 4);
 #endif
                }
              else
                {
-                 /* asm_fprintf() cannot handle %. */
+                 /* asm_fprintf() cannot handle %.  */
 #ifdef MOTOROLA
-                 asm_fprintf (stream, "\tsubq.l %0I%d,%Rsp\n", fsize + 4);
+                 asm_fprintf (stream, "\tsubq.l %I%wd,%Rsp\n", fsize + 4);
 #else
-                 asm_fprintf (stream, "\tsubql %0I%d,%Rsp\n", fsize + 4);
+                 asm_fprintf (stream, "\tsubql %I%wd,%Rsp\n", fsize + 4);
 #endif
                }
            }
          else if (fsize + 4 <= 16 && TARGET_CPU32)
            {
              /* On the CPU32 it is faster to use two subqw instructions to
-                subtract a small integer (8 < N <= 16) to a register. */
-             /* asm_fprintf() cannot handle %. */
+                subtract a small integer (8 < N <= 16) to a register.  */
+             /* asm_fprintf() cannot handle %.  */
 #ifdef MOTOROLA
-             asm_fprintf (stream, "\tsubq.w %0I8,%Rsp\n\tsubq.w %0I%d,%Rsp\n",
+             asm_fprintf (stream,
+                          "\tsubq.w %I8,%Rsp\n\tsubq.w %I%wd,%Rsp\n",
                           fsize + 4 - 8);
 #else
-             asm_fprintf (stream, "\tsubqw %0I8,%Rsp\n\tsubqw %0I%d,%Rsp\n",
+             asm_fprintf (stream, "\tsubqw %I8,%Rsp\n\tsubqw %I%wd,%Rsp\n",
                           fsize + 4 - 8);
 #endif
            }
-         else 
-#endif /* not NO_ADDSUB_Q */
-         if (TARGET_68040)
+         else if (TARGET_68040)
            {
              /* Adding negative number is faster on the 68040.  */
-             /* asm_fprintf() cannot handle %. */
+             /* asm_fprintf() cannot handle %.  */
 #ifdef MOTOROLA
-             asm_fprintf (stream, "\tadd.w %0I%d,%Rsp\n", - (fsize + 4));
+             asm_fprintf (stream, "\tadd.w %I%wd,%Rsp\n", - (fsize + 4));
 #else
-             asm_fprintf (stream, "\taddw %0I%d,%Rsp\n", - (fsize + 4));
+             asm_fprintf (stream, "\taddw %I%wd,%Rsp\n", - (fsize + 4));
 #endif
            }
          else
            {
 #ifdef MOTOROLA
-             asm_fprintf (stream, "\tlea (%d,%Rsp),%Rsp\n", - (fsize + 4));
+             asm_fprintf (stream, "\tlea (%wd,%Rsp),%Rsp\n", - (fsize + 4));
 #else
-             asm_fprintf (stream, "\tlea %Rsp@(%d),%Rsp\n", - (fsize + 4));
+             asm_fprintf (stream, "\tlea %Rsp@(%wd),%Rsp\n", - (fsize + 4));
 #endif
            }
        }
       else
        {
-       /* asm_fprintf() cannot handle %. */
+       /* asm_fprintf() cannot handle %.  */
 #ifdef MOTOROLA
-         asm_fprintf (stream, "\tadd.l %0I%d,%Rsp\n", - (fsize + 4));
+         asm_fprintf (stream, "\tadd.l %I%wd,%Rsp\n", - (fsize + 4));
 #else
-         asm_fprintf (stream, "\taddl %0I%d,%Rsp\n", - (fsize + 4));
+         asm_fprintf (stream, "\taddl %I%wd,%Rsp\n", - (fsize + 4));
 #endif
        }
       if (dwarf2out_do_frame ())
        {
-         cfa_store_offset += fsize;
+         cfa_store_offset += fsize + 4;
          cfa_offset = cfa_store_offset;
          dwarf2out_def_cfa ("", STACK_POINTER_REGNUM, cfa_offset);
        }
     }
-#ifdef SUPPORT_SUN_FPA
-  for (regno = 24; regno < 56; regno++)
-    if (regs_ever_live[regno] && ! call_used_regs[regno])
-      {
-#ifdef MOTOROLA
-       asm_fprintf (stream, "\tfpmovd %s,-(%Rsp)\n",
-                    reg_names[regno]);
-#else
-       asm_fprintf (stream, "\tfpmoved %s,%Rsp@-\n",
-                    reg_names[regno]);
-#endif
-       if (dwarf2out_do_frame ())
-         {
-           char *l = dwarf2out_cfi_label ();
-
-           cfa_store_offset += 8;
-           if (! frame_pointer_needed)
-             {
-               cfa_offset = cfa_store_offset;
-               dwarf2out_def_cfa (l, STACK_POINTER_REGNUM, cfa_offset);
-             }
-           dwarf2out_reg_save (l, regno, -cfa_store_offset);
-         }
-      }
-#endif
   if (TARGET_68881)
     {
       for (regno = 16; regno < 24; regno++)
-       if (regs_ever_live[regno] && ! call_used_regs[regno])
+       if (m68k_save_reg (regno))
          {
            mask |= 1 << (regno - 16);
            num_saved_regs++;
@@ -574,9 +426,9 @@ m68k_output_function_prologue (stream, size)
       if ((mask & 0xff) != 0)
        {
 #ifdef MOTOROLA
-         asm_fprintf (stream, "\tfmovm %0I0x%x,-(%Rsp)\n", mask & 0xff);
+         asm_fprintf (stream, "\tfmovm %I0x%x,-(%Rsp)\n", mask & 0xff);
 #else
-         asm_fprintf (stream, "\tfmovem %0I0x%x,%Rsp@-\n", mask & 0xff);
+         asm_fprintf (stream, "\tfmovem %I0x%x,%Rsp@-\n", mask & 0xff);
 #endif
          if (dwarf2out_do_frame ())
            {
@@ -599,29 +451,11 @@ m68k_output_function_prologue (stream, size)
       num_saved_regs = 0;
     }
   for (regno = 0; regno < 16; regno++)
-    if (regs_ever_live[regno] && ! call_used_regs[regno])
+    if (m68k_save_reg (regno))
       {
         mask |= 1 << (15 - regno);
         num_saved_regs++;
       }
-  if (frame_pointer_needed)
-    {
-      mask &= ~ (1 << (15 - FRAME_POINTER_REGNUM));
-      num_saved_regs--;
-    }
-  if (flag_pic && current_function_uses_pic_offset_table)
-    {
-      mask |= 1 << (15 - PIC_OFFSET_TABLE_REGNUM);
-      num_saved_regs++;
-    }
-
-#if NEED_PROBE
-#ifdef MOTOROLA
-  asm_fprintf (stream, "\ttst.l %d(%Rsp)\n", NEED_PROBE - num_saved_regs * 4);
-#else
-  asm_fprintf (stream, "\ttstl %Rsp@(%d)\n", NEED_PROBE - num_saved_regs * 4);
-#endif
-#endif
 
   /* If the stack limit is not a symbol, check it here.  
      This has the disadvantage that it may be too late...  */
@@ -650,7 +484,7 @@ m68k_output_function_prologue (stream, size)
 
       int i;
 
-      /* Undo the work from above. */
+      /* Undo the work from above.  */
       for (i = 0; i< 16; i++)
         if (mask & (1 << i))
          {
@@ -677,7 +511,7 @@ m68k_output_function_prologue (stream, size)
     }
   else if (mask)
     {
-      if (TARGET_5200)
+      if (TARGET_COLDFIRE)
        {
          /* The coldfire does not support the predecrement form of the 
             movml instruction, so we must adjust the stack pointer and
@@ -698,18 +532,18 @@ m68k_output_function_prologue (stream, size)
 
 #ifdef MOTOROLA
          asm_fprintf (stream, "\tlea (%d,%Rsp),%Rsp\n", -num_saved_regs*4);
-         asm_fprintf (stream, "\tmovm.l %0I0x%x,(%Rsp)\n", newmask);
+         asm_fprintf (stream, "\tmovm.l %I0x%x,(%Rsp)\n", newmask);
 #else
          asm_fprintf (stream, "\tlea %Rsp@(%d),%Rsp\n", -num_saved_regs*4);
-         asm_fprintf (stream, "\tmoveml %0I0x%x,%Rsp@\n", newmask);
+         asm_fprintf (stream, "\tmoveml %I0x%x,%Rsp@\n", newmask);
 #endif
        }
       else
        {
 #ifdef MOTOROLA
-         asm_fprintf (stream, "\tmovm.l %0I0x%x,-(%Rsp)\n", mask);
+         asm_fprintf (stream, "\tmovm.l %I0x%x,-(%Rsp)\n", mask);
 #else
-         asm_fprintf (stream, "\tmoveml %0I0x%x,%Rsp@-\n", mask);
+         asm_fprintf (stream, "\tmoveml %I0x%x,%Rsp@-\n", mask);
 #endif
        }
       if (dwarf2out_do_frame ())
@@ -735,430 +569,39 @@ m68k_output_function_prologue (stream, size)
       asm_fprintf (stream, "\t%Olea (%Rpc, %U_GLOBAL_OFFSET_TABLE_@GOTPC), %s\n",
                   reg_names[PIC_OFFSET_TABLE_REGNUM]);
 #else
-      asm_fprintf (stream, "\tmovel %0I__GLOBAL_OFFSET_TABLE_, %s\n",
+      asm_fprintf (stream, "\tmovel %I%U_GLOBAL_OFFSET_TABLE_, %s\n",
                   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
     }
-}
-#endif   /* ! (DPX2 && MOTOROLA)  */
-#endif   /* ! (NEWS && MOTOROLA)  */
-#endif   /* !CRDS  */
-\f
-/* Return true if this function's epilogue can be output as RTL.  */
-
-int
-use_return_insn ()
-{
-  int regno;
-
-  if (!reload_completed || frame_pointer_needed || get_frame_size () != 0)
-    return 0;
-  
-  /* Copied from output_function_epilogue ().  We should probably create a
-     separate layout routine to perform the common work.  */
-  
-  for (regno = 0 ; regno < FIRST_PSEUDO_REGISTER ; regno++)
-    if (regs_ever_live[regno] && ! call_used_regs[regno])
-      return 0;
-
-  if (flag_pic && current_function_uses_pic_offset_table)
-    return 0;
-
-  return 1;
-}
-
-/* This function generates the assembly code for function exit,
-   on machines that need it.
-
-   The function epilogue should not depend on the current stack pointer!
-   It should use the frame pointer only, if there is a frame pointer.
-   This is mandatory because of alloca; we also take advantage of it to
-   omit stack adjustments before returning.  */
-
-#ifdef CRDS
-
-static void
-m68k_output_function_epilogue (stream, size)
-     FILE *stream;
-     HOST_WIDE_INT size;
-{
-  register int regno;
-  register int mask, fmask;
-  register int nregs;
-  HOST_WIDE_INT offset, foffset, fpoffset;
-  extern char call_used_regs[];
-  HOST_WIDE_INT fsize = ((size) + 3) & -4;
-  int big = 0;
-
-  nregs = 0;  fmask = 0; fpoffset = 0;
-  for (regno = 16; regno < 24; regno++)
-    if (regs_ever_live[regno] && ! call_used_regs[regno])
-      {
-       nregs++;
-       fmask |= 1 << (23 - regno);
-      }
-
-  foffset = fpoffset + nregs * 12;
-  nregs = 0;  mask = 0;
-  if (frame_pointer_needed)
-    regs_ever_live[FRAME_POINTER_REGNUM] = 0;
-
-  for (regno = 0; regno < 16; regno++)
-    if (regs_ever_live[regno] && ! call_used_regs[regno])
-      {
-       nregs++;
-       mask |= 1 << regno;
-      }
-
-  offset = foffset + nregs * 4;
-  if (offset + fsize >= 0x8000
-      && frame_pointer_needed
-      && (mask || fmask || fpoffset))
-    {
-      fprintf (stream, "\tmovel $%d,a0\n", -fsize);
-      fsize = 0, big = 1;
-    }
-
-  if (exact_log2 (mask) >= 0)
-    {
-      if (big)
-       fprintf (stream, "\tmovel -%d(a6,a0.l),%s\n",
-                offset + fsize, reg_names[exact_log2 (mask)]);
-      else if (! frame_pointer_needed)
-       fprintf (stream, "\tmovel (sp)+,%s\n",
-                reg_names[exact_log2 (mask)]);
-      else
-       fprintf (stream, "\tmovel -%d(a6),%s\n",
-                offset + fsize, reg_names[exact_log2 (mask)]);
-    }
-  else if (mask)
-    {
-      if (big)
-       fprintf (stream, "\tmovem -%d(a6,a0.l),$0x%x\n",
-                offset + fsize, mask);
-      else if (! frame_pointer_needed)
-       fprintf (stream, "\tmovem (sp)+,$0x%x\n", mask);
-      else
-       fprintf (stream, "\tmovem -%d(a6),$0x%x\n",
-                offset + fsize, mask);
-    }
-
-  if (fmask)
-    {
-      if (big)
-       fprintf (stream, "\tfmovem -%d(a6,a0.l),$0x%x\n",
-                foffset + fsize, fmask);
-      else if (! frame_pointer_needed)
-       fprintf (stream, "\tfmovem (sp)+,$0x%x\n", fmask);
-      else
-       fprintf (stream, "\tfmovem -%d(a6),$0x%x\n",
-                foffset + fsize, fmask);
-    }
-
-  if (fpoffset != 0)
-    for (regno = 55; regno >= 24; regno--)
-      if (regs_ever_live[regno] && ! call_used_regs[regno])
-       {
-         if (big)
-           fprintf(stream, "\tfpmoved -%d(a6,a0.l), %s\n",
-                   fpoffset + fsize, reg_names[regno]);
-         else if (! frame_pointer_needed)
-           fprintf(stream, "\tfpmoved (sp)+, %s\n",
-                   reg_names[regno]);
-         else
-           fprintf(stream, "\tfpmoved -%d(a6), %s\n",
-                   fpoffset + fsize, reg_names[regno]);
-         fpoffset -= 8;
-       }
-
-  if (frame_pointer_needed)
-    fprintf (stream, "\tunlk a6\n");
-  else if (fsize)
-    {
-      if (fsize + 4 < 0x8000)
-       fprintf (stream, "\tadd.w #%d,sp\n", fsize + 4);
-      else
-       fprintf (stream, "\tadd.l #%d,sp\n", fsize + 4);
-    }
-
-  if (current_function_pops_args)
-    fprintf (stream, "\trtd $%d\n", current_function_pops_args);
-  else
-    fprintf (stream, "\trts\n");
-}
-
-#else
-#if defined (DPX2) && defined (MOTOROLA)
-
-static void
-m68k_output_function_epilogue (stream, size)
-     FILE *stream;
-     HOST_WIDE_INT size;
-{
-  register int regno;
-  register int mask, fmask;
-  register int nregs;
-  HOST_WIDE_INT offset, foffset, fpoffset, first = 1;
-  extern char call_used_regs[];
-  HOST_WIDE_INT fsize = ((size) + 3) & -4;
-  int big = 0;
-  rtx insn = get_last_insn ();
-
-  /* If the last insn was a BARRIER, we don't have to write any code.  */
-  if (GET_CODE (insn) == NOTE)
-    insn = prev_nonnote_insn (insn);
-  if (insn && GET_CODE (insn) == BARRIER)
-    {
-      /* Output just a no-op so that debuggers don't get confused
-        about which function the pc is in at this address.  */
-      fprintf (stream, "\tnop\n");
-      return;
-    }
-
-  nregs = 0;  fmask = 0; fpoffset = 0;
-  for (regno = 16; regno < 24; regno++)
-    if (regs_ever_live[regno] && ! call_used_regs[regno])
-      {
-        nregs++;
-       fmask |= 1 << (23 - regno);
-      }
-
-  foffset = fpoffset + nregs * 12;
-  nregs = 0;  mask = 0;
-  if (frame_pointer_needed)
-    regs_ever_live[FRAME_POINTER_REGNUM] = 0;
-
-  for (regno = 0; regno < 16; regno++)
-    if (regs_ever_live[regno] && ! call_used_regs[regno])
-      {
-        nregs++;
-       mask |= 1 << regno;
-      }
-
-  offset = foffset + nregs * 4;
-  if (offset + fsize >= 0x8000
-      && frame_pointer_needed
-      && (mask || fmask || fpoffset))
-    {
-      fprintf (stream, "\tmove.l #%d,a0\n", -fsize);
-      fsize = 0, big = 1;
-    }
-
-  if (nregs <= 2)
-    {
-      /* Restore each separately in the same order moveml does.
-         Using two movel instructions instead of a single moveml
-         is about 15% faster for the 68020 and 68030 at no expense
-         in code size. */
-
-      int i;
-
-      /* Undo the work from above. */
-      for (i = 0; i< 16; i++)
-        if (mask & (1 << i))
-          {
-            if (big)
-             fprintf (stream, "\tmove.l -%d(%s,a0.l),%s\n",
-                      offset + fsize,
-                      reg_names[FRAME_POINTER_REGNUM],
-                      reg_names[i]);
-            else if (! frame_pointer_needed)
-             fprintf (stream, "\tmove.l (sp)+,%s\n",
-                      reg_names[i]);
-            else
-             fprintf (stream, "\tmove.l -%d(%s),%s\n",
-                      offset + fsize,
-                      reg_names[FRAME_POINTER_REGNUM],
-                      reg_names[i]);
-            offset = offset - 4;
-          }
-    }
-  else if (mask)
-    {
-      first = 1;
-      for (regno = 0; regno < 16; regno++)
-        if (mask & (1 << regno))
-         {
-           if (first && big)
-             {
-               fprintf (stream, "\tmovem.l -%d(%s,a0.l),%s",
-                        offset + fsize,
-                        reg_names[FRAME_POINTER_REGNUM],
-                        reg_names[regno]);
-               first = 0;
-             }
-           else if (first && ! frame_pointer_needed)
-             {
-               fprintf (stream, "\tmovem.l (sp)+,%s",
-                        reg_names[regno]);
-               first = 0;
-             }
-           else if (first)
-             {
-               fprintf (stream, "\tmovem.l -%d(%s),%s",
-                        offset + fsize,
-                        reg_names[FRAME_POINTER_REGNUM],
-                        reg_names[regno]);
-               first = 0;
-             }
-           else
-             fprintf (stream, "/%s", reg_names[regno]);
-         }
-      fprintf (stream, "\n");
-    }
-
-  if (fmask)
-    {
-      first = 1;
-      for (regno = 16; regno < 24; regno++)
-        if (fmask & (1 << (23 - regno)))
-         {
-           if (first && big)
-             {
-               fprintf (stream, "\tfmovem.x -%d(%s,a0.l),%s",
-                        foffset + fsize,
-                        reg_names[FRAME_POINTER_REGNUM],
-                        reg_names[regno]);
-               first = 0;
-             }
-           else if (first && ! frame_pointer_needed)
-             {
-               fprintf (stream, "\tfmovem.x (sp)+,%s",
-                        reg_names[regno]);
-               first = 0;
-             }
-           else if (first)
-             {
-               fprintf (stream, "\tfmovem.x -%d(%s),%s",
-                        foffset + fsize,
-                        reg_names[FRAME_POINTER_REGNUM],
-                        reg_names[regno]);
-               first = 0;
-             }
-           else
-             fprintf (stream, "/%s", reg_names[regno]);
-         }
-      fprintf (stream, "\n");
-    }
-
-  if (frame_pointer_needed)
-    fprintf (stream, "\tunlk %s\n",
-            reg_names[FRAME_POINTER_REGNUM]);
-  else if (fsize)
-    {
-      if (fsize + 4 < 0x8000)
-       fprintf (stream, "\tadd.w #%d,sp\n", fsize + 4);
-      else
-       fprintf (stream, "\tadd.l #%d,sp\n", fsize + 4);
-    }
-
-  if (current_function_pops_args)
-    fprintf (stream, "\trtd #%d\n", current_function_pops_args);
-  else
-    fprintf (stream, "\trts\n");
-}
-
-#else
-#if defined (NEWS) && defined (MOTOROLA)
-
-static void
-m68k_output_function_epilogue (stream, size)
-     FILE *stream;
-     HOST_WIDE_INT size;
-{
-  register int regno;
-  register int mask, fmask;
-  register int nregs;
-  HOST_WIDE_INT offset, foffset;
-  extern char call_used_regs[];
-  HOST_WIDE_INT fsize = ((size) + 3) & -4;
-  int big = 0;
-
-  nregs = 0;  fmask = 0;
-  for (regno = 16; regno < FIRST_PSEUDO_REGISTER; regno++)
-    if (regs_ever_live[regno] && ! call_used_regs[regno])
-      {
-       nregs++;
-       fmask |= 1 << (23 - regno);
-      }
-
-  foffset = nregs * 12;
-  nregs = 0;  mask = 0;
-  if (frame_pointer_needed)
-    regs_ever_live[FRAME_POINTER_REGNUM] = 0;
-
-  for (regno = 0; regno < 16; regno++)
-    if (regs_ever_live[regno] && ! call_used_regs[regno])
-      {
-       nregs++;
-       mask |= 1 << regno;
-      }
-
-  offset = foffset + nregs * 4;
-  if (offset + fsize >= 0x8000
-      && frame_pointer_needed
-      && (mask || fmask))
-    {
-      fprintf (stream, "\tmove.l #%d,a0\n", -fsize);
-      fsize = 0, big = 1;
-    }
-
-  if (exact_log2 (mask) >= 0)
-    {
-      if (big)
-       fprintf (stream, "\tmove.l (-%d,fp,a0.l),%s\n",
-                offset + fsize, reg_names[exact_log2 (mask)]);
-      else if (! frame_pointer_needed)
-       fprintf (stream, "\tmove.l (sp)+,%s\n",
-                reg_names[exact_log2 (mask)]);
-      else
-       fprintf (stream, "\tmove.l (-%d,fp),%s\n",
-                offset + fsize, reg_names[exact_log2 (mask)]);
-    }
-  else if (mask)
-    {
-      if (big)
-       fprintf (stream, "\tmovem.l (-%d,fp,a0.l),#0x%x\n",
-                offset + fsize, mask);
-      else if (! frame_pointer_needed)
-       fprintf (stream, "\tmovem.l (sp)+,#0x%x\n", mask);
-      else
-       fprintf (stream, "\tmovem.l (-%d,fp),#0x%x\n",
-                offset + fsize, mask);
-    }
-
-  if (fmask)
-    {
-      if (big)
-       fprintf (stream, "\tfmovem.x (-%d,fp,a0.l),#0x%x\n",
-                foffset + fsize, fmask);
-      else if (! frame_pointer_needed)
-       fprintf (stream, "\tfmovem.x (sp)+,#0x%x\n", fmask);
-      else
-       fprintf (stream, "\tfmovem.x (-%d,fp),#0x%x\n",
-                foffset + fsize, fmask);
-    }
-
-  if (frame_pointer_needed)
-    fprintf (stream, "\tunlk fp\n");
-  else if (fsize)
-    {
-      if (fsize + 4 < 0x8000)
-       fprintf (stream, "\tadd.w #%d,sp\n", fsize + 4);
-      else
-       fprintf (stream, "\tadd.l #%d,sp\n", fsize + 4);
-    }
+}
+\f
+/* Return true if this function's epilogue can be output as RTL.  */
 
-  if (current_function_pops_args)
-    fprintf (stream, "\trtd #%d\n", current_function_pops_args);
-  else
-    fprintf (stream, "\trts\n");
+int
+use_return_insn ()
+{
+  int regno;
+
+  if (!reload_completed || frame_pointer_needed || get_frame_size () != 0)
+    return 0;
+  
+  for (regno = 0; regno < FIRST_PSEUDO_REGISTER; regno++)
+    if (m68k_save_reg (regno))
+      return 0;
+
+  return 1;
 }
 
-#else  /* !CRDS && ! (NEWS && MOTOROLA) && ! (DPX2 && MOTOROLA) */
+/* This function generates the assembly code for function exit,
+   on machines that need it.
+
+   The function epilogue should not depend on the current stack pointer!
+   It should use the frame pointer only, if there is a frame pointer.
+   This is mandatory because of alloca; we also take advantage of it to
+   omit stack adjustments before returning.  */
 
 static void
 m68k_output_function_epilogue (stream, size)
@@ -1168,8 +611,7 @@ m68k_output_function_epilogue (stream, size)
   register int regno;
   register int mask, fmask;
   register int nregs;
-  HOST_WIDE_INT offset, foffset, fpoffset;
-  extern char call_used_regs[];
+  HOST_WIDE_INT offset, foffset;
   HOST_WIDE_INT fsize = (size + 3) & -4;
   int big = 0;
   rtx insn = get_last_insn ();
@@ -1182,91 +624,70 @@ m68k_output_function_epilogue (stream, size)
     {
       /* Output just a no-op so that debuggers don't get confused
         about which function the pc is in at this address.  */
-      asm_fprintf (stream, "\tnop\n");
+      fprintf (stream, "\tnop\n");
       return;
     }
 
-#ifdef FUNCTION_BLOCK_PROFILER_EXIT
-  if (profile_block_flag == 2)
-    {
-      FUNCTION_BLOCK_PROFILER_EXIT (stream);
-    }
-#endif
-
 #ifdef FUNCTION_EXTRA_EPILOGUE
   FUNCTION_EXTRA_EPILOGUE (stream, size);
 #endif
-  nregs = 0;  fmask = 0; fpoffset = 0;
-#ifdef SUPPORT_SUN_FPA
-  for (regno = 24 ; regno < 56 ; regno++)
-    if (regs_ever_live[regno] && ! call_used_regs[regno])
-      nregs++;
-  fpoffset = nregs * 8;
-#endif
-  nregs = 0;
+  nregs = 0;  fmask = 0;
   if (TARGET_68881)
     {
       for (regno = 16; regno < 24; regno++)
-       if (regs_ever_live[regno] && ! call_used_regs[regno])
+       if (m68k_save_reg (regno))
          {
            nregs++;
            fmask |= 1 << (23 - regno);
          }
     }
-  foffset = fpoffset + nregs * 12;
+  foffset = nregs * 12;
   nregs = 0;  mask = 0;
-  if (frame_pointer_needed)
-    regs_ever_live[FRAME_POINTER_REGNUM] = 0;
   for (regno = 0; regno < 16; regno++)
-    if (regs_ever_live[regno] && ! call_used_regs[regno])
+    if (m68k_save_reg (regno))
       {
         nregs++;
        mask |= 1 << regno;
       }
-  if (flag_pic && current_function_uses_pic_offset_table)
-    {
-      nregs++;
-      mask |= 1 << PIC_OFFSET_TABLE_REGNUM;
-    }
   offset = foffset + nregs * 4;
   /* FIXME : leaf_function_p below is too strong.
      What we really need to know there is if there could be pending
-     stack adjustment needed at that point. */
+     stack adjustment needed at that point.  */
   restore_from_sp = ! frame_pointer_needed
             || (! current_function_calls_alloca && leaf_function_p ());
   if (offset + fsize >= 0x8000
       && ! restore_from_sp
-      && (mask || fmask || fpoffset))
+      && (mask || fmask))
     {
 #ifdef MOTOROLA
-      asm_fprintf (stream, "\t%Omove.l %0I%d,%Ra1\n", -fsize);
+      asm_fprintf (stream, "\t%Omove.l %I%wd,%Ra1\n", -fsize);
 #else
-      asm_fprintf (stream, "\tmovel %0I%d,%Ra1\n", -fsize);
+      asm_fprintf (stream, "\tmovel %I%wd,%Ra1\n", -fsize);
 #endif
       fsize = 0, big = 1;
     }
-  if (TARGET_5200 || nregs <= 2)
+  if (TARGET_COLDFIRE || nregs <= 2)
     {
       /* Restore each separately in the same order moveml does.
          Using two movel instructions instead of a single moveml
          is about 15% faster for the 68020 and 68030 at no expense
-         in code size. */
+         in code size.  */
 
       int i;
 
-      /* Undo the work from above. */
+      /* Undo the work from above.  */
       for (i = 0; i< 16; i++)
         if (mask & (1 << i))
           {
             if (big)
              {
 #ifdef MOTOROLA
-               asm_fprintf (stream, "\t%Omove.l -%d(%s,%Ra1.l),%s\n",
+               asm_fprintf (stream, "\t%Omove.l -%wd(%s,%Ra1.l),%s\n",
                             offset + fsize,
                             reg_names[FRAME_POINTER_REGNUM],
                             reg_names[i]);
 #else
-               asm_fprintf (stream, "\tmovel %s@(-%d,%Ra1:l),%s\n",
+               asm_fprintf (stream, "\tmovel %s@(-%wd,%Ra1:l),%s\n",
                             reg_names[FRAME_POINTER_REGNUM],
                             offset + fsize, reg_names[i]);
 #endif
@@ -1284,12 +705,12 @@ m68k_output_function_epilogue (stream, size)
             else
              {
 #ifdef MOTOROLA
-               asm_fprintf (stream, "\t%Omove.l -%d(%s),%s\n",
+               asm_fprintf (stream, "\t%Omove.l -%wd(%s),%s\n",
                             offset + fsize,
                             reg_names[FRAME_POINTER_REGNUM],
                             reg_names[i]);
 #else
-               asm_fprintf (stream, "\tmovel %s@(-%d),%s\n",
+               asm_fprintf (stream, "\tmovel %s@(-%wd),%s\n",
                             reg_names[FRAME_POINTER_REGNUM],
                             offset + fsize, reg_names[i]);
 #endif
@@ -1302,12 +723,12 @@ m68k_output_function_epilogue (stream, size)
       if (big)
        {
 #ifdef MOTOROLA
-         asm_fprintf (stream, "\tmovm.l -%d(%s,%Ra1.l),%0I0x%x\n",
+         asm_fprintf (stream, "\tmovm.l -%wd(%s,%Ra1.l),%I0x%x\n",
                       offset + fsize,
                       reg_names[FRAME_POINTER_REGNUM],
                       mask);
 #else
-         asm_fprintf (stream, "\tmoveml %s@(-%d,%Ra1:l),%0I0x%x\n",
+         asm_fprintf (stream, "\tmoveml %s@(-%wd,%Ra1:l),%I0x%x\n",
                       reg_names[FRAME_POINTER_REGNUM],
                       offset + fsize, mask);
 #endif
@@ -1315,20 +736,20 @@ m68k_output_function_epilogue (stream, size)
       else if (restore_from_sp)
        {
 #ifdef MOTOROLA
-         asm_fprintf (stream, "\tmovm.l (%Rsp)+,%0I0x%x\n", mask);
+         asm_fprintf (stream, "\tmovm.l (%Rsp)+,%I0x%x\n", mask);
 #else
-         asm_fprintf (stream, "\tmoveml %Rsp@+,%0I0x%x\n", mask);
+         asm_fprintf (stream, "\tmoveml %Rsp@+,%I0x%x\n", mask);
 #endif
        }
       else
        {
 #ifdef MOTOROLA
-         asm_fprintf (stream, "\tmovm.l -%d(%s),%0I0x%x\n",
+         asm_fprintf (stream, "\tmovm.l -%wd(%s),%I0x%x\n",
                       offset + fsize,
                       reg_names[FRAME_POINTER_REGNUM],
                       mask);
 #else
-         asm_fprintf (stream, "\tmoveml %s@(-%d),%0I0x%x\n",
+         asm_fprintf (stream, "\tmoveml %s@(-%wd),%I0x%x\n",
                       reg_names[FRAME_POINTER_REGNUM],
                       offset + fsize, mask);
 #endif
@@ -1339,12 +760,12 @@ m68k_output_function_epilogue (stream, size)
       if (big)
        {
 #ifdef MOTOROLA
-         asm_fprintf (stream, "\tfmovm -%d(%s,%Ra1.l),%0I0x%x\n",
+         asm_fprintf (stream, "\tfmovm -%wd(%s,%Ra1.l),%I0x%x\n",
                       foffset + fsize,
                       reg_names[FRAME_POINTER_REGNUM],
                       fmask);
 #else
-         asm_fprintf (stream, "\tfmovem %s@(-%d,%Ra1:l),%0I0x%x\n",
+         asm_fprintf (stream, "\tfmovem %s@(-%wd,%Ra1:l),%I0x%x\n",
                       reg_names[FRAME_POINTER_REGNUM],
                       foffset + fsize, fmask);
 #endif
@@ -1352,146 +773,105 @@ m68k_output_function_epilogue (stream, size)
       else if (restore_from_sp)
        {
 #ifdef MOTOROLA
-         asm_fprintf (stream, "\tfmovm (%Rsp)+,%0I0x%x\n", fmask);
+         asm_fprintf (stream, "\tfmovm (%Rsp)+,%I0x%x\n", fmask);
 #else
-         asm_fprintf (stream, "\tfmovem %Rsp@+,%0I0x%x\n", fmask);
+         asm_fprintf (stream, "\tfmovem %Rsp@+,%I0x%x\n", fmask);
 #endif
        }
       else
        {
 #ifdef MOTOROLA
-         asm_fprintf (stream, "\tfmovm -%d(%s),%0I0x%x\n",
+         asm_fprintf (stream, "\tfmovm -%wd(%s),%I0x%x\n",
                       foffset + fsize,
                       reg_names[FRAME_POINTER_REGNUM],
                       fmask);
 #else
-         asm_fprintf (stream, "\tfmovem %s@(-%d),%0I0x%x\n",
+         asm_fprintf (stream, "\tfmovem %s@(-%wd),%I0x%x\n",
                       reg_names[FRAME_POINTER_REGNUM],
                       foffset + fsize, fmask);
 #endif
        }
     }
-  if (fpoffset != 0)
-    for (regno = 55; regno >= 24; regno--)
-      if (regs_ever_live[regno] && ! call_used_regs[regno])
-        {
-         if (big)
-           {
-#ifdef MOTOROLA
-             asm_fprintf (stream, "\tfpmovd -%d(%s,%Ra1.l), %s\n",
-                          fpoffset + fsize,
-                          reg_names[FRAME_POINTER_REGNUM],
-                          reg_names[regno]);
-#else
-             asm_fprintf (stream, "\tfpmoved %s@(-%d,%Ra1:l), %s\n",
-                          reg_names[FRAME_POINTER_REGNUM],
-                          fpoffset + fsize, reg_names[regno]);
-#endif
-           }
-         else if (restore_from_sp)
-           {
-#ifdef MOTOROLA
-             asm_fprintf (stream, "\tfpmovd (%Rsp)+,%s\n",
-                          reg_names[regno]);
-#else
-             asm_fprintf (stream, "\tfpmoved %Rsp@+, %s\n",
-                          reg_names[regno]);
-#endif
-           }
-         else
-           {
-#ifdef MOTOROLA
-             asm_fprintf (stream, "\tfpmovd -%d(%s), %s\n",
-                          fpoffset + fsize,
-                          reg_names[FRAME_POINTER_REGNUM],
-                          reg_names[regno]);
-#else
-             asm_fprintf (stream, "\tfpmoved %s@(-%d), %s\n",
-                          reg_names[FRAME_POINTER_REGNUM],
-                          fpoffset + fsize, reg_names[regno]);
-#endif
-           }
-         fpoffset -= 8;
-       }
   if (frame_pointer_needed)
     fprintf (stream, "\tunlk %s\n",
             reg_names[FRAME_POINTER_REGNUM]);
   else if (fsize)
     {
-#ifndef NO_ADDSUB_Q
       if (fsize + 4 <= 8) 
        {
-         if (!TARGET_5200)
+         if (!TARGET_COLDFIRE)
            {
 #ifdef MOTOROLA
-             asm_fprintf (stream, "\taddq.w %0I%d,%Rsp\n", fsize + 4);
+             asm_fprintf (stream, "\taddq.w %I%wd,%Rsp\n", fsize + 4);
 #else
-             asm_fprintf (stream, "\taddqw %0I%d,%Rsp\n", fsize + 4);
+             asm_fprintf (stream, "\taddqw %I%wd,%Rsp\n", fsize + 4);
 #endif
            }
          else
            {
 #ifdef MOTOROLA
-             asm_fprintf (stream, "\taddq.l %0I%d,%Rsp\n", fsize + 4);
+             asm_fprintf (stream, "\taddq.l %I%wd,%Rsp\n", fsize + 4);
 #else
-             asm_fprintf (stream, "\taddql %0I%d,%Rsp\n", fsize + 4);
+             asm_fprintf (stream, "\taddql %I%wd,%Rsp\n", fsize + 4);
 #endif
            }
        }
       else if (fsize + 4 <= 16 && TARGET_CPU32)
        {
          /* On the CPU32 it is faster to use two addqw instructions to
-            add a small integer (8 < N <= 16) to a register. */
-         /* asm_fprintf() cannot handle %. */
+            add a small integer (8 < N <= 16) to a register.  */
+         /* asm_fprintf() cannot handle %.  */
 #ifdef MOTOROLA
-         asm_fprintf (stream, "\taddq.w %0I8,%Rsp\n\taddq.w %0I%d,%Rsp\n",
+         asm_fprintf (stream, "\taddq.w %I8,%Rsp\n\taddq.w %I%wd,%Rsp\n",
                       fsize + 4 - 8);
 #else
-         asm_fprintf (stream, "\taddqw %0I8,%Rsp\n\taddqw %0I%d,%Rsp\n",
+         asm_fprintf (stream, "\taddqw %I8,%Rsp\n\taddqw %I%wd,%Rsp\n",
                       fsize + 4 - 8);
 #endif
        }
-      else
-#endif /* not NO_ADDSUB_Q */
-      if (fsize + 4 < 0x8000)
+      else if (fsize + 4 < 0x8000)
        {
          if (TARGET_68040)
            { 
-             /* asm_fprintf() cannot handle %. */
+             /* asm_fprintf() cannot handle %.  */
 #ifdef MOTOROLA
-             asm_fprintf (stream, "\tadd.w %0I%d,%Rsp\n", fsize + 4);
+             asm_fprintf (stream, "\tadd.w %I%wd,%Rsp\n", fsize + 4);
 #else
-             asm_fprintf (stream, "\taddw %0I%d,%Rsp\n", fsize + 4);
+             asm_fprintf (stream, "\taddw %I%wd,%Rsp\n", fsize + 4);
 #endif
            }
          else
            {
 #ifdef MOTOROLA
-             asm_fprintf (stream, "\tlea (%d,%Rsp),%Rsp\n", fsize + 4);
+             asm_fprintf (stream, "\tlea (%wd,%Rsp),%Rsp\n", fsize + 4);
 #else
-             asm_fprintf (stream, "\tlea %Rsp@(%d),%Rsp\n", fsize + 4);
+             asm_fprintf (stream, "\tlea %Rsp@(%wd),%Rsp\n", fsize + 4);
 #endif
            }
        }
       else
        {
-       /* asm_fprintf() cannot handle %. */
+       /* asm_fprintf() cannot handle %.  */
 #ifdef MOTOROLA
-         asm_fprintf (stream, "\tadd.l %0I%d,%Rsp\n", fsize + 4);
+         asm_fprintf (stream, "\tadd.l %I%wd,%Rsp\n", fsize + 4);
 #else
-         asm_fprintf (stream, "\taddl %0I%d,%Rsp\n", fsize + 4);
+         asm_fprintf (stream, "\taddl %I%wd,%Rsp\n", fsize + 4);
 #endif
        }
     }
+  if (current_function_calls_eh_return)
+    {
+#ifdef MOTOROLA
+      asm_fprintf (stream, "\tadd.l %Ra0,%Rsp\n");
+#else
+      asm_fprintf (stream, "\taddl %Ra0,%Rsp\n");
+#endif
+    }
   if (current_function_pops_args)
-    asm_fprintf (stream, "\trtd %0I%d\n", current_function_pops_args);
+    asm_fprintf (stream, "\trtd %I%d\n", current_function_pops_args);
   else
     fprintf (stream, "\trts\n");
 }
-
-#endif   /* ! (DPX2 && MOTOROLA)  */
-#endif   /* ! (NEWS && MOTOROLA)  */
-#endif   /* !CRDS  */
 \f
 /* Similar to general_operand, but exclude stack_pointer_rtx.  */
 
@@ -1531,7 +911,7 @@ valid_dbcc_comparison_p (x, mode)
     }
 }
 
-/* Return non-zero if flags are currently in the 68881 flag register.  */
+/* Return nonzero if flags are currently in the 68881 flag register.  */
 int
 flags_in_68881 ()
 {
@@ -1636,7 +1016,7 @@ output_dbcc_and_branch (operands)
     }
 
   /* If the decrement is to be done in SImode, then we have
-     to compensate for the fact that dbcc decrements in HImode. */
+     to compensate for the fact that dbcc decrements in HImode.  */
   switch (GET_MODE (operands[0]))
     {
       case SImode:
@@ -1665,7 +1045,7 @@ output_scc_di(op, operand1, operand2, dest)
   rtx loperands[7];
   enum rtx_code op_code = GET_CODE (op);
 
-  /* This does not produce a usefull cc.  */
+  /* This does not produce a useful cc.  */
   CC_STATUS_INIT;
 
   /* The m68k cmp.l instruction requires operand1 to be a reg as used
@@ -1711,7 +1091,7 @@ output_scc_di(op, operand1, operand2, dest)
     }
   else
     {
-      if (TARGET_68020 || TARGET_5200 || ! ADDRESS_REG_P (loperands[0]))
+      if (TARGET_68020 || TARGET_COLDFIRE || ! ADDRESS_REG_P (loperands[0]))
        output_asm_insn ("tst%.l %0", loperands);
       else
        {
@@ -1728,7 +1108,7 @@ output_scc_di(op, operand1, operand2, dest)
       output_asm_insn ("jne %l4", loperands);
 #endif
 
-      if (TARGET_68020 || TARGET_5200 || ! ADDRESS_REG_P (loperands[1]))
+      if (TARGET_68020 || TARGET_COLDFIRE || ! ADDRESS_REG_P (loperands[1]))
        output_asm_insn ("tst%.l %1", loperands);
       else
        {
@@ -1745,13 +1125,13 @@ output_scc_di(op, operand1, operand2, dest)
   switch (op_code)
     {
       case EQ:
-        ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
+        (*targetm.asm_out.internal_label) (asm_out_file, "L",
                                    CODE_LABEL_NUMBER (loperands[4]));
         output_asm_insn ("seq %5", loperands);
         break;
 
       case NE:
-        ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
+        (*targetm.asm_out.internal_label) (asm_out_file, "L",
                                    CODE_LABEL_NUMBER (loperands[4]));
         output_asm_insn ("sne %5", loperands);
         break;
@@ -1763,15 +1143,15 @@ output_scc_di(op, operand1, operand2, dest)
 #else
         output_asm_insn ("shi %5\n\tjra %l6", loperands);
 #endif
-        ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
+        (*targetm.asm_out.internal_label) (asm_out_file, "L",
                                    CODE_LABEL_NUMBER (loperands[4]));
         output_asm_insn ("sgt %5", loperands);
-        ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
+        (*targetm.asm_out.internal_label) (asm_out_file, "L",
                                    CODE_LABEL_NUMBER (loperands[6]));
         break;
 
       case GTU:
-        ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
+        (*targetm.asm_out.internal_label) (asm_out_file, "L",
                                    CODE_LABEL_NUMBER (loperands[4]));
         output_asm_insn ("shi %5", loperands);
         break;
@@ -1783,15 +1163,15 @@ output_scc_di(op, operand1, operand2, dest)
 #else
         output_asm_insn ("scs %5\n\tjra %l6", loperands);
 #endif
-        ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
+        (*targetm.asm_out.internal_label) (asm_out_file, "L",
                                    CODE_LABEL_NUMBER (loperands[4]));
         output_asm_insn ("slt %5", loperands);
-        ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
+        (*targetm.asm_out.internal_label) (asm_out_file, "L",
                                    CODE_LABEL_NUMBER (loperands[6]));
         break;
 
       case LTU:
-        ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
+        (*targetm.asm_out.internal_label) (asm_out_file, "L",
                                    CODE_LABEL_NUMBER (loperands[4]));
         output_asm_insn ("scs %5", loperands);
         break;
@@ -1803,15 +1183,15 @@ output_scc_di(op, operand1, operand2, dest)
 #else
         output_asm_insn ("scc %5\n\tjra %l6", loperands);
 #endif
-        ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
+        (*targetm.asm_out.internal_label) (asm_out_file, "L",
                                    CODE_LABEL_NUMBER (loperands[4]));
         output_asm_insn ("sge %5", loperands);
-        ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
+        (*targetm.asm_out.internal_label) (asm_out_file, "L",
                                    CODE_LABEL_NUMBER (loperands[6]));
         break;
 
       case GEU:
-        ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
+        (*targetm.asm_out.internal_label) (asm_out_file, "L",
                                    CODE_LABEL_NUMBER (loperands[4]));
         output_asm_insn ("scc %5", loperands);
         break;
@@ -1823,15 +1203,15 @@ output_scc_di(op, operand1, operand2, dest)
 #else
         output_asm_insn ("sls %5\n\tjra %l6", loperands);
 #endif
-        ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
+        (*targetm.asm_out.internal_label) (asm_out_file, "L",
                                    CODE_LABEL_NUMBER (loperands[4]));
         output_asm_insn ("sle %5", loperands);
-        ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
+        (*targetm.asm_out.internal_label) (asm_out_file, "L",
                                    CODE_LABEL_NUMBER (loperands[6]));
         break;
 
       case LEU:
-        ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "L",
+        (*targetm.asm_out.internal_label) (asm_out_file, "L",
                                    CODE_LABEL_NUMBER (loperands[4]));
         output_asm_insn ("sls %5", loperands);
         break;
@@ -1916,7 +1296,7 @@ symbolic_operand (op, mode)
     }
 }
 \f
-/* Check for sign_extend or zero_extend.  Used for bit-count operands. */
+/* Check for sign_extend or zero_extend.  Used for bit-count operands.  */
 
 int
 extend_operator(x, mode)
@@ -2044,12 +1424,12 @@ const_method (constant)
   if (USE_MOVQ (i))
     return MOVQ;
 
-  /* The Coldfire doesn't have byte or word operations. */
+  /* The Coldfire doesn't have byte or word operations.  */
   /* FIXME: This may not be useful for the m68060 either */
-  if (!TARGET_5200
+  if (!TARGET_COLDFIRE
     {
       /* if -256 < N < 256 but N is not in range for a moveq
-        N^ff will be, so use moveq #N^ff, dreg; not.b dreg. */
+        N^ff will be, so use moveq #N^ff, dreg; not.b dreg.  */
       if (USE_MOVQ (i ^ 0xff))
        return NOTB;
       /* Likewise, try with not.w */
@@ -2067,7 +1447,7 @@ const_method (constant)
   return MOVL;
 }
 
-int
+static int
 const_int_cost (constant)
      rtx constant;
 {
@@ -2089,6 +1469,132 @@ const_int_cost (constant)
     }
 }
 
+static bool
+m68k_rtx_costs (x, code, outer_code, total)
+     rtx x;
+     int code, outer_code;
+     int *total;
+{
+  switch (code)
+    {
+    case CONST_INT:
+      /* Constant zero is super cheap due to clr instruction.  */
+      if (x == const0_rtx)
+       *total = 0;
+      else
+        *total = const_int_cost (x);
+      return true;
+
+    case CONST:
+    case LABEL_REF:
+    case SYMBOL_REF:
+      *total = 3;
+      return true;
+
+    case CONST_DOUBLE:
+      /* Make 0.0 cheaper than other floating constants to
+         encourage creating tstsf and tstdf insns.  */
+      if (outer_code == COMPARE
+          && (x == CONST0_RTX (SFmode) || x == CONST0_RTX (DFmode)))
+       *total = 4;
+      else
+       *total = 5;
+      return true;
+
+    /* These are vaguely right for a 68020.  */
+    /* The costs for long multiply have been adjusted to work properly
+       in synth_mult on the 68020, relative to an average of the time
+       for add and the time for shift, taking away a little more because
+       sometimes move insns are needed.  */
+    /* div?.w is relatively cheaper on 68000 counted in COSTS_N_INSNS terms.  */
+#define MULL_COST (TARGET_68060 ? 2 : TARGET_68040 ? 5 : TARGET_CFV3 ? 3 : TARGET_COLDFIRE ? 10 : 13)
+#define MULW_COST (TARGET_68060 ? 2 : TARGET_68040 ? 3 : TARGET_68020 ? 8 : \
+                       TARGET_CFV3 ? 2 : 5)
+#define DIVW_COST (TARGET_68020 ? 27 : TARGET_CF_HWDIV ? 11 : 12)
+
+    case PLUS:
+      /* An lea costs about three times as much as a simple add.  */
+      if (GET_MODE (x) == SImode
+         && GET_CODE (XEXP (x, 1)) == REG
+         && GET_CODE (XEXP (x, 0)) == MULT
+         && GET_CODE (XEXP (XEXP (x, 0), 0)) == REG
+         && GET_CODE (XEXP (XEXP (x, 0), 1)) == CONST_INT
+         && (INTVAL (XEXP (XEXP (x, 0), 1)) == 2
+             || INTVAL (XEXP (XEXP (x, 0), 1)) == 4
+             || INTVAL (XEXP (XEXP (x, 0), 1)) == 8))
+       {
+           /* lea an@(dx:l:i),am */
+           *total = COSTS_N_INSNS (TARGET_COLDFIRE ? 2 : 3);
+           return true;
+       }
+      return false;
+
+    case ASHIFT:
+    case ASHIFTRT:
+    case LSHIFTRT:
+      if (TARGET_68060)
+       {
+          *total = COSTS_N_INSNS(1);
+         return true;
+       }
+      if (! TARGET_68020 && ! TARGET_COLDFIRE)
+        {
+         if (GET_CODE (XEXP (x, 1)) == CONST_INT)
+           {
+             if (INTVAL (XEXP (x, 1)) < 16)
+               *total = COSTS_N_INSNS (2) + INTVAL (XEXP (x, 1)) / 2;
+             else
+               /* We're using clrw + swap for these cases.  */
+               *total = COSTS_N_INSNS (4) + (INTVAL (XEXP (x, 1)) - 16) / 2;
+           }
+         else
+           *total = COSTS_N_INSNS (10); /* worst case */
+         return true;
+        }
+      /* A shift by a big integer takes an extra instruction.  */
+      if (GET_CODE (XEXP (x, 1)) == CONST_INT
+         && (INTVAL (XEXP (x, 1)) == 16))
+       {
+         *total = COSTS_N_INSNS (2);    /* clrw;swap */
+         return true;
+       }
+      if (GET_CODE (XEXP (x, 1)) == CONST_INT
+         && !(INTVAL (XEXP (x, 1)) > 0
+              && INTVAL (XEXP (x, 1)) <= 8))
+       {
+         *total = COSTS_N_INSNS (TARGET_COLDFIRE ? 1 : 3);      /* lsr #i,dn */
+         return true;
+       }
+      return false;
+
+    case MULT:
+      if ((GET_CODE (XEXP (x, 0)) == ZERO_EXTEND
+          || GET_CODE (XEXP (x, 0)) == SIGN_EXTEND)
+         && GET_MODE (x) == SImode)
+        *total = COSTS_N_INSNS (MULW_COST);
+      else if (GET_MODE (x) == QImode || GET_MODE (x) == HImode)
+        *total = COSTS_N_INSNS (MULW_COST);
+      else
+        *total = COSTS_N_INSNS (MULL_COST);
+      return true;
+
+    case DIV:
+    case UDIV:
+    case MOD:
+    case UMOD:
+      if (GET_MODE (x) == QImode || GET_MODE (x) == HImode)
+        *total = COSTS_N_INSNS (DIVW_COST);    /* div.w */
+      else if (TARGET_CF_HWDIV)
+        *total = COSTS_N_INSNS (18);
+      else
+       *total = COSTS_N_INSNS (43);            /* div.l */
+      return true;
+
+    default:
+      return false;
+    }
+}
+
 const char *
 output_move_const_into_data_reg (operands)
      rtx *operands;
@@ -2099,41 +1605,21 @@ output_move_const_into_data_reg (operands)
   switch (const_method (operands[1]))
     {
     case MOVQ :
-#if defined (MOTOROLA) && !defined (CRDS)
-      return "moveq%.l %1,%0";
-#else
       return "moveq %1,%0";
-#endif
     case NOTB :
       operands[1] = GEN_INT (i ^ 0xff);
-#if defined (MOTOROLA) && !defined (CRDS)
-      return "moveq%.l %1,%0\n\tnot%.b %0";
-#else
       return "moveq %1,%0\n\tnot%.b %0";
-#endif  
     case NOTW :
       operands[1] = GEN_INT (i ^ 0xffff);
-#if defined (MOTOROLA) && !defined (CRDS)
-      return "moveq%.l %1,%0\n\tnot%.w %0";
-#else
       return "moveq %1,%0\n\tnot%.w %0";
-#endif  
     case NEGW :
-#if defined (MOTOROLA) && !defined (CRDS)
-      return "moveq%.l %#-128,%0\n\tneg%.w %0";
-#else
       return "moveq %#-128,%0\n\tneg%.w %0";
-#endif  
     case SWAP :
       {
        unsigned u = i;
 
        operands[1] = GEN_INT ((u << 16) | (u >> 16));
-#if defined (MOTOROLA) && !defined (CRDS)
-       return "moveq%.l %1,%0\n\tswap %0";
-#else
        return "moveq %1,%0\n\tswap %0";
-#endif  
       }
     case MOVL :
        return "move%.l %1,%0";
@@ -2151,7 +1637,7 @@ output_move_simode_const (operands)
          || GET_CODE (operands[0]) == MEM)
       /* clr insns on 68000 read before writing.
         This isn't so on the 68010, but we have no TARGET_68010.  */
-      && ((TARGET_68020 || TARGET_5200)
+      && ((TARGET_68020 || TARGET_COLDFIRE)
          || !(GET_CODE (operands[0]) == MEM
               && MEM_VOLATILE_P (operands[0]))))
     return "clr%.l %0";
@@ -2201,7 +1687,7 @@ output_move_himode (operands)
              || GET_CODE (operands[0]) == MEM)
          /* clr insns on 68000 read before writing.
             This isn't so on the 68010, but we have no TARGET_68010.  */
-         && ((TARGET_68020 || TARGET_5200)
+         && ((TARGET_68020 || TARGET_COLDFIRE)
              || !(GET_CODE (operands[0]) == MEM
                   && MEM_VOLATILE_P (operands[0]))))
        return "clr%.w %0";
@@ -2212,11 +1698,7 @@ output_move_himode (operands)
               && INTVAL (operands[1]) < 128
               && INTVAL (operands[1]) >= -128)
        {
-#if defined(MOTOROLA) && !defined(CRDS)
-         return "moveq%.l %1,%0";
-#else
          return "moveq %1,%0";
-#endif
        }
       else if (INTVAL (operands[1]) < 0x8000
               && INTVAL (operands[1]) >= -0x8000)
@@ -2224,7 +1706,6 @@ output_move_himode (operands)
     }
   else if (CONSTANT_P (operands[1]))
     return "move%.l %1,%0";
-#ifndef SGS_NO_LI
   /* Recognize the insn before a tablejump, one that refers
      to a table of offsets.  Such an insn will need to refer
      to a label on the insn.  So output one.  Use the label-number
@@ -2246,7 +1727,7 @@ output_move_himode (operands)
                   CODE_LABEL_NUMBER (XEXP (labelref, 0)));
 #endif /* not SGS */
 #else /* SGS_SWITCH_TABLES or not MOTOROLA */
-      ASM_OUTPUT_INTERNAL_LABEL (asm_out_file, "LI",
+      (*targetm.asm_out.internal_label) (asm_out_file, "LI",
                                 CODE_LABEL_NUMBER (XEXP (labelref, 0)));
 #ifdef SGS_SWITCH_TABLES
       /* Set flag saying we need to define the symbol
@@ -2255,7 +1736,6 @@ output_move_himode (operands)
 #endif /* SGS_SWITCH_TABLES */
 #endif /* SGS_SWITCH_TABLES or not MOTOROLA */
     }
-#endif /* SGS_NO_LI */
   return "move%.w %1,%0";
 }
 
@@ -2273,7 +1753,7 @@ output_move_qimode (operands)
       && GET_CODE (XEXP (operands[0], 0)) == PRE_DEC
       && XEXP (XEXP (operands[0], 0), 0) == stack_pointer_rtx
       && ! ADDRESS_REG_P (operands[1])
-      && ! TARGET_5200)
+      && ! TARGET_COLDFIRE)
     {
       xoperands[1] = operands[1];
       xoperands[2]
@@ -2284,11 +1764,7 @@ output_move_qimode (operands)
       if (!reg_mentioned_p (stack_pointer_rtx, operands[1]))
        {
          xoperands[3] = stack_pointer_rtx;
-#ifndef NO_ADDSUB_Q
          output_asm_insn ("subq%.l %#2,%3\n\tmove%.b %1,%2", xoperands);
-#else
-         output_asm_insn ("sub%.l %#2,%3\n\tmove%.b %1,%2", xoperands);
-#endif
        }
       else
        output_asm_insn ("move%.b %1,%-\n\tmove%.b %@,%2", xoperands);
@@ -2298,12 +1774,12 @@ output_move_qimode (operands)
   /* clr and st insns on 68000 read before writing.
      This isn't so on the 68010, but we have no TARGET_68010.  */
   if (!ADDRESS_REG_P (operands[0])
-      && ((TARGET_68020 || TARGET_5200)
+      && ((TARGET_68020 || TARGET_COLDFIRE)
          || !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0]))))
     {
       if (operands[1] == const0_rtx)
        return "clr%.b %0";
-      if ((!TARGET_5200 || DATA_REG_P (operands[0]))
+      if ((!TARGET_COLDFIRE || DATA_REG_P (operands[0]))
          && GET_CODE (operands[1]) == CONST_INT
          && (INTVAL (operands[1]) & 255) == 255)
        {
@@ -2316,11 +1792,7 @@ output_move_qimode (operands)
       && INTVAL (operands[1]) < 128
       && INTVAL (operands[1]) >= -128)
     {
-#if defined(MOTOROLA) && !defined(CRDS)
-      return "moveq%.l %1,%0";
-#else
       return "moveq %1,%0";
-#endif
     }
   if (operands[1] == const0_rtx && ADDRESS_REG_P (operands[0]))
     return "sub%.l %0,%0";
@@ -2340,7 +1812,7 @@ output_move_stricthi (operands)
   if (operands[1] == const0_rtx
       /* clr insns on 68000 read before writing.
         This isn't so on the 68010, but we have no TARGET_68010.  */
-      && ((TARGET_68020 || TARGET_5200)
+      && ((TARGET_68020 || TARGET_COLDFIRE)
          || !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0]))))
     return "clr%.w %0";
   return "move%.w %1,%0";
@@ -2353,7 +1825,7 @@ output_move_strictqi (operands)
   if (operands[1] == const0_rtx
       /* clr insns on 68000 read before writing.
          This isn't so on the 68010, but we have no TARGET_68010.  */
-      && ((TARGET_68020 || TARGET_5200)
+      && ((TARGET_68020 || TARGET_COLDFIRE)
           || !(GET_CODE (operands[0]) == MEM && MEM_VOLATILE_P (operands[0]))))
     return "clr%.b %0";
   return "move%.b %1,%0";
@@ -2366,10 +1838,6 @@ static const char *
 singlemove_string (operands)
      rtx *operands;
 {
-#ifdef SUPPORT_SUN_FPA
-  if (FPA_REG_P (operands[0]) || FPA_REG_P (operands[1]))
-    return "fpmoves %1,%0";
-#endif
   if (GET_CODE (operands[1]) == CONST_INT)
     return output_move_simode_const (operands);
   return "move%.l %1,%0";
@@ -2623,7 +2091,7 @@ compadr:
          if (addreg0 || addreg1)
            abort ();
 
-         /* Only the middle reg conflicts; simply put it last. */
+         /* Only the middle reg conflicts; simply put it last.  */
          output_asm_insn (singlemove_string (operands), operands);
          output_asm_insn (singlemove_string (latehalf), latehalf);
          output_asm_insn (singlemove_string (middlehalf), middlehalf);
@@ -2797,7 +2265,6 @@ output_addsi3 (operands)
     }
   if (GET_CODE (operands[2]) == CONST_INT)
     {
-#ifndef NO_ADDSUB_Q
       if (INTVAL (operands[2]) > 0
          && INTVAL (operands[2]) <= 8)
        return "addq%.l %2,%0";
@@ -2809,7 +2276,7 @@ output_addsi3 (operands)
        }
       /* On the CPU32 it is faster to use two addql instructions to
         add a small integer (8 < N <= 16) to a register.
-        Likewise for subql. */
+        Likewise for subql.  */
       if (TARGET_CPU32 && REG_P (operands[0]))
        {
          if (INTVAL (operands[2]) > 8
@@ -2825,7 +2292,6 @@ output_addsi3 (operands)
              return "subq%.l %#8,%0\n\tsubq%.l %2,%0";
            }
        }
-#endif
       if (ADDRESS_REG_P (operands[0])
          && INTVAL (operands[2]) >= -0x8000
          && INTVAL (operands[2]) < 0x8000)
@@ -2857,18 +2323,7 @@ notice_update_cc (exp, insn)
      rtx exp;
      rtx insn;
 {
-  /* If the cc is being set from the fpa and the expression is not an
-     explicit floating point test instruction (which has code to deal with
-     this), reinit the CC.  */
-  if (((cc_status.value1 && FPA_REG_P (cc_status.value1))
-       || (cc_status.value2 && FPA_REG_P (cc_status.value2)))
-      && !(GET_CODE (exp) == PARALLEL
-          && GET_CODE (XVECEXP (exp, 0, 0)) == SET
-          && XEXP (XVECEXP (exp, 0, 0), 0) == cc0_rtx))
-    {
-      CC_STATUS_INIT; 
-    }
-  else if (GET_CODE (exp) == SET)
+  if (GET_CODE (exp) == SET)
     {
       if (GET_CODE (SET_SRC (exp)) == CALL)
        {
@@ -2929,8 +2384,7 @@ notice_update_cc (exp, insn)
       && ADDRESS_REG_P (cc_status.value2)
       && GET_MODE (cc_status.value2) == QImode)
     CC_STATUS_INIT;
-  if (cc_status.value2 != 0
-      && !(cc_status.value1 && FPA_REG_P (cc_status.value1)))
+  if (cc_status.value2 != 0)
     switch (GET_CODE (cc_status.value2))
       {
       case PLUS: case MINUS: case MULT:
@@ -2946,7 +2400,7 @@ notice_update_cc (exp, insn)
        /* (SET r1 (ZERO_EXTEND r2)) on this machine
           ends with a move insn moving r2 in r2's mode.
           Thus, the cc's are set for r2.
-          This can set N bit spuriously. */
+          This can set N bit spuriously.  */
        cc_status.flags |= CC_NOT_NEGATIVE; 
 
       default:
@@ -2957,9 +2411,7 @@ notice_update_cc (exp, insn)
       && reg_overlap_mentioned_p (cc_status.value1, cc_status.value2))
     cc_status.value2 = 0;
   if (((cc_status.value1 && FP_REG_P (cc_status.value1))
-       || (cc_status.value2 && FP_REG_P (cc_status.value2)))
-      && !((cc_status.value1 && FPA_REG_P (cc_status.value1))
-          || (cc_status.value2 && FPA_REG_P (cc_status.value2))))
+       || (cc_status.value2 && FP_REG_P (cc_status.value2))))
     cc_status.flags = CC_IN_68881;
 }
 \f
@@ -2967,68 +2419,32 @@ const char *
 output_move_const_double (operands)
      rtx *operands;
 {
-#ifdef SUPPORT_SUN_FPA
-  if (TARGET_FPA && FPA_REG_P (operands[0]))
-    {
-      int code = standard_sun_fpa_constant_p (operands[1]);
+  int code = standard_68881_constant_p (operands[1]);
 
-      if (code != 0)
-       {
-         static char buf[40];
-
-         sprintf (buf, "fpmove%%.d %%%%%d,%%0", code & 0x1ff);
-         return buf;
-       }
-      return "fpmove%.d %1,%0";
-    }
-  else
-#endif
+  if (code != 0)
     {
-      int code = standard_68881_constant_p (operands[1]);
-
-      if (code != 0)
-       {
-         static char buf[40];
+      static char buf[40];
 
-         sprintf (buf, "fmovecr %%#0x%x,%%0", code & 0xff);
-         return buf;
-       }
-      return "fmove%.d %1,%0";
+      sprintf (buf, "fmovecr %%#0x%x,%%0", code & 0xff);
+      return buf;
     }
+  return "fmove%.d %1,%0";
 }
 
 const char *
 output_move_const_single (operands)
      rtx *operands;
 {
-#ifdef SUPPORT_SUN_FPA
-  if (TARGET_FPA)
-    {
-      int code = standard_sun_fpa_constant_p (operands[1]);
-
-      if (code != 0)
-       {
-         static char buf[40];
+  int code = standard_68881_constant_p (operands[1]);
 
-         sprintf (buf, "fpmove%%.s %%%%%d,%%0", code & 0x1ff);
-         return buf;
-       }
-      return "fpmove%.s %1,%0";
-    }
-  else
-#endif /* defined SUPPORT_SUN_FPA */
+  if (code != 0)
     {
-      int code = standard_68881_constant_p (operands[1]);
-
-      if (code != 0)
-       {
-         static char buf[40];
+      static char buf[40];
 
-         sprintf (buf, "fmovecr %%#0x%x,%%0", code & 0xff);
-         return buf;
-       }
-      return "fmove%.s %f1,%0";
+      sprintf (buf, "fmovecr %%#0x%x,%%0", code & 0xff);
+      return buf;
     }
+  return "fmove%.s %f1,%0";
 }
 
 /* Return nonzero if X, a CONST_DOUBLE, has a value that we can get
@@ -3036,7 +2452,7 @@ output_move_const_single (operands)
    The value, anded with 0xff, gives the code to use in fmovecr
    to get the desired constant.  */
 
-/* This code has been fixed for cross-compilation. */
+/* This code has been fixed for cross-compilation.  */
   
 static int inited_68881_table = 0;
 
@@ -3050,7 +2466,7 @@ static const char *const strings_68881[7] = {
   "1e16"
   };
 
-int codes_68881[7] = {
+static const int codes_68881[7] = {
   0x0f,
   0x32,
   0x33,
@@ -3063,7 +2479,7 @@ int codes_68881[7] = {
 REAL_VALUE_TYPE values_68881[7];
 
 /* Set up values_68881 array by converting the decimal values
-   strings_68881 to binary.   */
+   strings_68881 to binary.  */
 
 void
 init_68881_table ()
@@ -3090,22 +2506,11 @@ standard_68881_constant_p (x)
   REAL_VALUE_TYPE r;
   int i;
 
-#ifdef NO_ASM_FMOVECR
-  return 0;
-#endif
-
   /* fmovecr must be emulated on the 68040 and 68060, so it shouldn't be
-     used at all on those chips. */
+     used at all on those chips.  */
   if (TARGET_68040 || TARGET_68060)
     return 0;
 
-#ifndef REAL_ARITHMETIC
-#if HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT
-  if (! flag_pretend_float)
-    return 0;
-#endif
-#endif
-
   if (! inited_68881_table)
     init_68881_table ();
 
@@ -3138,196 +2543,20 @@ floating_exact_log2 (x)
      rtx x;
 {
   REAL_VALUE_TYPE r, r1;
-  int i;
-
-#ifndef REAL_ARITHMETIC
-#if HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT
-  if (! flag_pretend_float)
-    return 0;
-#endif
-#endif
+  int exp;
 
   REAL_VALUE_FROM_CONST_DOUBLE (r, x);
 
-  if (REAL_VALUES_LESS (r, dconst0))
-    return 0;
-
-  r1 = dconst1;
-  i = 0;
-  while (REAL_VALUES_LESS (r1, r))
-    {
-      r1 = REAL_VALUE_LDEXP (dconst1, i);
-      if (REAL_VALUES_EQUAL (r1, r))
-        return i;
-      i = i + 1;
-    }
-  return 0;
-}
-\f
-#ifdef SUPPORT_SUN_FPA
-/* Return nonzero if X, a CONST_DOUBLE, has a value that we can get
-   from the Sun FPA's constant RAM.
-   The value returned, anded with 0x1ff, gives the code to use in fpmove
-   to get the desired constant. */
-
-static int inited_FPA_table = 0;
-
-static const char *const strings_FPA[38] = {
-/* small rationals */
-  "0.0",
-  "1.0",
-  "0.5",
-  "-1.0",
-  "2.0",
-  "3.0",
-  "4.0",
-  "8.0",
-  "0.25",
-  "0.125",
-  "10.0",
-  "-0.5",
-/* Decimal equivalents of double precision values */
-  "2.718281828459045091", /* D_E */
-  "6.283185307179586477", /* 2 pi */
-  "3.141592653589793116", /* D_PI */
-  "1.570796326794896619", /* pi/2 */
-  "1.414213562373095145", /* D_SQRT2 */
-  "0.7071067811865475244", /* 1/sqrt(2) */
-  "-1.570796326794896619", /* -pi/2 */
-  "1.442695040888963387", /* D_LOG2ofE */
-  "3.321928024887362182", /* D_LOG2of10 */
-  "0.6931471805599452862", /* D_LOGEof2 */
-  "2.302585092994045901", /* D_LOGEof10 */
-  "0.3010299956639811980", /* D_LOG10of2 */
-  "0.4342944819032518167", /* D_LOG10ofE */
-/* Decimal equivalents of single precision values */
-  "2.718281745910644531", /* S_E */
-  "6.283185307179586477", /* 2 pi */
-  "3.141592741012573242", /* S_PI */
-  "1.570796326794896619", /* pi/2 */
-  "1.414213538169860840", /* S_SQRT2 */
-  "0.7071067811865475244", /* 1/sqrt(2) */
-  "-1.570796326794896619", /* -pi/2 */
-  "1.442695021629333496", /* S_LOG2ofE */
-  "3.321928024291992188", /* S_LOG2of10 */
-  "0.6931471824645996094", /* S_LOGEof2 */
-  "2.302585124969482442", /* S_LOGEof10 */
-  "0.3010300099849700928", /* S_LOG10of2 */
-  "0.4342944920063018799", /* S_LOG10ofE */
-};
-
-
-int codes_FPA[38] = {
-/* small rationals */
-  0x200,
-  0xe,
-  0xf,
-  0x10,
-  0x11,
-  0xb1,
-  0x12,
-  0x13,
-  0x15,
-  0x16,
-  0x17,
-  0x2e,
-/* double precision */
-  0x8,
-  0x9,
-  0xa,
-  0xb,
-  0xc,
-  0xd,
-  0x27,
-  0x28,
-  0x29,
-  0x2a,
-  0x2b,
-  0x2c,
-  0x2d,
-/* single precision */
-  0x8,
-  0x9,
-  0xa,
-  0xb,
-  0xc,
-  0xd,
-  0x27,
-  0x28,
-  0x29,
-  0x2a,
-  0x2b,
-  0x2c,
-  0x2d
-  };
-
-REAL_VALUE_TYPE values_FPA[38];
-
-/* This code has been fixed for cross-compilation. */
-
-void
-init_FPA_table ()
-{
-  enum machine_mode mode;
-  int i;
-  REAL_VALUE_TYPE r;
-
-  mode = DFmode;
-  for (i = 0; i < 38; i++)
-    {
-      if (i == 25)
-        mode = SFmode;
-      r = REAL_VALUE_ATOF (strings_FPA[i], mode);
-      values_FPA[i] = r;
-    }
-  inited_FPA_table = 1;
-}
-
-
-int
-standard_sun_fpa_constant_p (x)
-     rtx x;
-{
-  REAL_VALUE_TYPE r;
-  int i;
-
-#ifndef REAL_ARITHMETIC
-#if HOST_FLOAT_FORMAT != TARGET_FLOAT_FORMAT
-  if (! flag_pretend_float)
+  if (REAL_VALUES_LESS (r, dconst1))
     return 0;
-#endif
-#endif
-
-  if (! inited_FPA_table)
-    init_FPA_table ();
-
-  REAL_VALUE_FROM_CONST_DOUBLE (r, x);
 
-  for (i=0; i<12; i++)
-    {
-      if (REAL_VALUES_EQUAL (r, values_FPA[i]))
-        return (codes_FPA[i]);
-    }
+  exp = real_exponent (&r);
+  real_2expN (&r1, exp);
+  if (REAL_VALUES_EQUAL (r1, r))
+    return exp;
 
-  if (GET_MODE (x) == SFmode)
-    {
-      for (i=25; i<38; i++)
-        {
-          if (REAL_VALUES_EQUAL (r, values_FPA[i]))
-            return (codes_FPA[i]);
-        }
-    }
-  else
-    {
-      for (i=12; i<25; i++)
-        {
-          if (REAL_VALUES_EQUAL (r, values_FPA[i]))
-            return (codes_FPA[i]);
-        }
-    }
-  return 0x0;
+  return 0;
 }
-#endif /* define SUPPORT_SUN_FPA */
 \f
 /* A C compound statement to output to stdio stream STREAM the
    assembler syntax for an instruction operand X.  X is an RTL
@@ -3359,7 +2588,7 @@ standard_sun_fpa_constant_p (x)
    '@' for a reference to the top word on the stack:
        sp@, (sp) or (%sp) depending on the style of syntax.
    '#' for an immediate operand prefix (# in MIT and Motorola syntax
-       but & in SGS syntax, $ in CRDS/UNOS syntax).
+       but & in SGS syntax).
    '!' for the cc register (used in an `and to cc' insn).
    '$' for the letter `s' in an op code, but only on the 68040.
    '&' for the letter `d' in an op code, but only on the 68040.
@@ -3370,13 +2599,8 @@ standard_sun_fpa_constant_p (x)
    'f' for float insn (print a CONST_DOUBLE as a float rather than in hex)
    'o' for operands to go directly to output_operand_address (bypassing
        print_operand_address--used only for SYMBOL_REFs under TARGET_PCREL)
-   'w' for FPA insn (print a CONST_DOUBLE as a SunFPA constant rather
-       than directly).  Second part of 'y' below.
    'x' for float insn (print a CONST_DOUBLE as a float rather than in hex),
        or print pair of registers as rx:ry.
-   'y' for a FPA insn (print pair of registers as rx:ry).  This also outputs
-       CONST_DOUBLE's as SunFPA constant RAM registers if
-       possible, so it should not be used except for the SunFPA.
 
    */
 
@@ -3386,19 +2610,15 @@ print_operand (file, op, letter)
      rtx op;                   /* operand to print */
      int letter;               /* %<letter> or 0 */
 {
-#ifdef SUPPORT_SUN_FPA
-  int i;
-#endif
-
   if (letter == '.')
     {
-#if defined (MOTOROLA) && !defined (CRDS)
-      asm_fprintf (file, ".");
+#if defined (MOTOROLA)
+      fprintf (file, ".");
 #endif
     }
   else if (letter == '#')
     {
-      asm_fprintf (file, "%0I");
+      asm_fprintf (file, "%I");
     }
   else if (letter == '-')
     {
@@ -3456,24 +2676,12 @@ print_operand (file, op, letter)
     }
   else if (GET_CODE (op) == REG)
     {
-#ifdef SUPPORT_SUN_FPA
-      if (REGNO (op) < 16
-         && (letter == 'y' || letter == 'x')
-         && GET_MODE (op) == DFmode)
-       {
-         fprintf (file, "%s:%s", reg_names[REGNO (op)],
-                  reg_names[REGNO (op)+1]);
-       }
+      if (letter == 'R')
+       /* Print out the second register name of a register pair.
+          I.e., R (6) => 7.  */
+       fputs (reg_names[REGNO (op) + 1], file);
       else
-#endif
-       {
-         if (letter == 'R')
-           /* Print out the second register name of a register pair.
-              I.e., R (6) => 7.  */
-           fputs (reg_names[REGNO (op) + 1], file);
-         else
-           fputs (reg_names[REGNO (op)], file);
-       }
+       fputs (reg_names[REGNO (op)], file);
     }
   else if (GET_CODE (op) == MEM)
     {
@@ -3491,14 +2699,6 @@ print_operand (file, op, letter)
 #endif
        }
     }
-#ifdef SUPPORT_SUN_FPA
-  else if ((letter == 'y' || letter == 'w')
-          && GET_CODE (op) == CONST_DOUBLE
-          && (i = standard_sun_fpa_constant_p (op)))
-    {
-      fprintf (file, "%%%d", i & 0x1ff);
-    }
-#endif
   else if (GET_CODE (op) == CONST_DOUBLE && GET_MODE (op) == SFmode)
     {
       REAL_VALUE_TYPE r;
@@ -3521,7 +2721,7 @@ print_operand (file, op, letter)
     {
       /* Use `print_operand_address' instead of `output_addr_const'
         to ensure that we print relevant PIC stuff.  */
-      asm_fprintf (file, "%0I");
+      asm_fprintf (file, "%I");
       if (TARGET_PCREL
          && (GET_CODE (op) == SYMBOL_REF || GET_CODE (op) == CONST))
        print_operand_address (file, op);
@@ -3551,7 +2751,7 @@ print_operand (file, op, letter)
    macro.  See m68k/sgs.h for an example; for versions without the bug.
    Some assemblers refuse all the above solutions.  The workaround is to
    emit "K(pc,d0.l*2)" with K being a small constant known to give the
-   right behaviour.
+   right behavior.
 
    They also do not like things like "pea 1.w", so we simple leave off
    the .w on small constants. 
@@ -3835,7 +3035,7 @@ print_operand_address (file, addr)
          {
 #ifdef MOTOROLA
 #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));
 #else
            fprintf (file, "%d.w", (int) INTVAL (addr));
@@ -3981,7 +3181,7 @@ const_sint32_operand (op, mode)
 
 /* Operand predicates for implementing asymmetric pc-relative addressing
    on m68k.  The m68k supports pc-relative addressing (mode 7, register 2)
-   when used as a source operand, but not as a destintation operand.
+   when used as a source operand, but not as a destination operand.
 
    We model this by restricting the meaning of the basic predicates
    (general_operand, memory_operand, etc) to forbid the use of this
@@ -4110,7 +3310,7 @@ output_andsi3 (operands)
       && (INTVAL (operands[2]) | 0xffff) == 0xffffffff
       && (DATA_REG_P (operands[0])
          || offsettable_memref_p (operands[0]))
-      && !TARGET_5200)
+      && !TARGET_COLDFIRE)
     {
       if (GET_CODE (operands[0]) != REG)
         operands[0] = adjust_address (operands[0], HImode, 2);
@@ -4151,7 +3351,7 @@ output_iorsi3 (operands)
       && INTVAL (operands[2]) >> 16 == 0
       && (DATA_REG_P (operands[0])
          || offsettable_memref_p (operands[0]))
-      && !TARGET_5200)
+      && !TARGET_COLDFIRE)
     {
       if (GET_CODE (operands[0]) != REG)
         operands[0] = adjust_address (operands[0], HImode, 2);
@@ -4187,7 +3387,7 @@ output_xorsi3 (operands)
   if (GET_CODE (operands[2]) == CONST_INT
       && INTVAL (operands[2]) >> 16 == 0
       && (offsettable_memref_p (operands[0]) || DATA_REG_P (operands[0]))
-      && !TARGET_5200)
+      && !TARGET_COLDFIRE)
     {
       if (! DATA_REG_P (operands[0]))
        operands[0] = adjust_address (operands[0], HImode, 2);
@@ -4218,10 +3418,9 @@ output_xorsi3 (operands)
 /* Output assembly to switch to section NAME with attribute FLAGS.  */
 
 static void
-m68k_coff_asm_named_section (name, flags, align)
+m68k_coff_asm_named_section (name, flags)
      const char *name;
      unsigned int flags;
-     unsigned int align ATTRIBUTE_UNUSED;
 {
   char flagchar;
 
@@ -4248,3 +3447,97 @@ m68k_svr3_asm_out_constructor (symbol, priority)
   output_asm_insn (output_move_simode (xop), xop);
 }
 #endif
+
+#ifdef HPUX_ASM
+static void
+m68k_hp320_internal_label (stream, prefix, labelno)
+     FILE *stream;
+     const char *prefix;
+     unsigned long labelno;
+{
+  if (prefix[0] == 'L' && prefix[1] == 'I')
+    fprintf(stream, "\tset %s%ld,.+2\n", prefix, labelno);
+  else
+    fprintf (stream, "%s%ld:\n", prefix, labelno);
+}
+
+static void
+m68k_hp320_file_start ()
+{
+  /* version 1: 68010.
+             2: 68020 without FPU.
+            3: 68020 with FPU.  */
+  fprintf (asm_out_file, "\tversion %d\n",
+          TARGET_68020 ? (TARGET_68881 ? 3 : 2) : 1);
+}
+#endif
+
+static void
+m68k_output_mi_thunk (file, thunk, delta, vcall_offset, function)
+     FILE *file;
+     tree thunk ATTRIBUTE_UNUSED;
+     HOST_WIDE_INT delta;
+     HOST_WIDE_INT vcall_offset ATTRIBUTE_UNUSED;
+     tree function;
+{
+  rtx xops[1];
+  const char *fmt;
+
+  if (delta > 0 && delta <= 8)
+#ifdef MOTOROLA
+    asm_fprintf (file, "\taddq.l %I%d,4(%Rsp)\n", (int) delta);
+#else
+    asm_fprintf (file, "\taddql %I%d,%Rsp@(4)\n", (int) delta);
+#endif
+  else if (delta < 0 && delta >= -8)
+#ifdef MOTOROLA
+    asm_fprintf (file, "\tsubq.l %I%d,4(%Rsp)\n", (int) -delta);
+#else
+    asm_fprintf (file, "\tsubql %I%d,%Rsp@(4)\n", (int) -delta);
+#endif
+  else
+#ifdef MOTOROLA
+    asm_fprintf (file, "\tadd.l %I%wd,4(%Rsp)\n", delta);
+#else
+    asm_fprintf (file, "\taddl %I%wd,%Rsp@(4)\n", delta);
+#endif
+
+  xops[0] = DECL_RTL (function);
+
+  /* Logic taken from call patterns in m68k.md.  */
+  if (flag_pic)
+    {
+      if (TARGET_PCREL)
+       fmt = "bra.l %o0";
+      else
+       {
+#ifdef MOTOROLA
+#ifdef HPUX_ASM
+         fmt = "bra.l %0";
+#else
+#ifdef USE_GAS
+         fmt = "bra.l %0@PLTPC";
+#else
+         fmt = "bra %0@PLTPC";
+#endif
+#endif
+#else
+#ifdef USE_GAS
+         fmt = "bra.l %0";
+#else
+         fmt = "jra %0,a1";
+#endif
+#endif
+       }
+    }
+  else
+    {
+#if defined (MOTOROLA) && !defined (USE_GAS)
+      fmt = "jmp %0";
+#else
+      fmt = "jra %0";
+#endif
+    }
+
+  output_asm_insn (fmt, xops);
+}