OSDN Git Service

* config/m68k/m68k.c (output_move_const_into_data_reg,
[pf3gnuchains/gcc-fork.git] / gcc / config / m68k / m68k.c
index d4df6cf..79f3752 100644 (file)
@@ -256,69 +256,6 @@ m68k_save_reg (regno)
 /* 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;
-  HOST_WIDE_INT fsize = ((size) + 3) & -4;
-
-  /* unos stack probe */
-  if (fsize > 30000)
-    {
-      fprintf (stream, "\tmovel sp,a0\n");
-      fprintf (stream, "\taddl $-" HOST_WIDE_INT_PRINT_DEC ",a0\n",
-              2048 + fsize);
-      fprintf (stream, "\ttstb (a0)\n");
-    }
-  else
-    fprintf (stream, "\ttstb -" HOST_WIDE_INT_PRINT_DEC "(sp)\n",
-            2048 + fsize);
-
-  if (frame_pointer_needed)
-    {
-      if (TARGET_68020 || fsize < 0x8000)
-       fprintf (stream, "\tlink a6,$" HOST_WIDE_INT_PRINT_DEC "\n", -fsize);
-      else
-       fprintf (stream,
-                "\tlink a6,$0\n\tsubl $" HOST_WIDE_INT_PRINT_DEC ",sp\n",
-                fsize);
-    }
-  else if (fsize)
-    {
-      /* Adding negative number is faster on the 68040.  */
-      if (fsize + 4 < 0x8000)
-       fprintf (stream, "\tadd.w $" HOST_WIDE_INT_PRINT_DEC ",sp\n",
-                - (fsize + 4));
-      else
-       fprintf (stream, "\tadd.l $" HOST_WIDE_INT_PRINT_DEC ",sp\n",
-                - (fsize + 4));
-    }
-
-  for (regno = 16; regno < 24; regno++)
-    if (m68k_save_reg (regno))
-      mask |= 1 << (regno - 16);
-
-  if ((mask & 0xff) != 0)
-    fprintf (stream, "\tfmovem $0x%x,-(sp)\n", mask & 0xff);
-
-  mask = 0;
-  for (regno = 0; regno < 16; regno++)
-    if (m68k_save_reg (regno))
-      mask |= 1 << (15 - regno);
-
-  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);
-}
-
-#else  /* !CRDS */
-
 static void
 m68k_output_function_prologue (stream, size)
      FILE *stream;
@@ -635,7 +572,7 @@ 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 %I__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],
@@ -643,7 +580,6 @@ m68k_output_function_prologue (stream, size)
 #endif
     }
 }
-#endif   /* !CRDS  */
 \f
 /* Return true if this function's epilogue can be output as RTL.  */
 
@@ -670,108 +606,6 @@ use_return_insn ()
    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;
-  HOST_WIDE_INT fsize = ((size) + 3) & -4;
-  int big = 0;
-
-  nregs = 0;  fmask = 0;
-  for (regno = 16; regno < 24; regno++)
-    if (m68k_save_reg (regno))
-      {
-       nregs++;
-       fmask |= 1 << (23 - regno);
-      }
-
-  foffset = nregs * 12;
-  nregs = 0;  mask = 0;
-
-  for (regno = 0; regno < 16; regno++)
-    if (m68k_save_reg (regno))
-      {
-       nregs++;
-       mask |= 1 << regno;
-      }
-
-  offset = foffset + nregs * 4;
-  if (offset + fsize >= 0x8000
-      && frame_pointer_needed
-      && (mask || fmask))
-    {
-      fprintf (stream, "\tmovel $" HOST_WIDE_INT_PRINT_DEC ",a0\n", -fsize);
-      fsize = 0, big = 1;
-    }
-
-  if (exact_log2 (mask) >= 0)
-    {
-      if (big)
-       fprintf (stream, "\tmovel -" HOST_WIDE_INT_PRINT_DEC "(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 -" HOST_WIDE_INT_PRINT_DEC "(a6),%s\n",
-                offset + fsize, reg_names[exact_log2 (mask)]);
-    }
-  else if (mask)
-    {
-      if (big)
-       fprintf (stream,
-                "\tmovem -" HOST_WIDE_INT_PRINT_DEC "(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 -" HOST_WIDE_INT_PRINT_DEC "(a6),$0x%x\n",
-                offset + fsize, mask);
-    }
-
-  if (fmask)
-    {
-      if (big)
-       fprintf (stream,
-                "\tfmovem -" HOST_WIDE_INT_PRINT_DEC "(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 -" HOST_WIDE_INT_PRINT_DEC "(a6),$0x%x\n",
-                foffset + fsize, fmask);
-    }
-
-  if (frame_pointer_needed)
-    fprintf (stream, "\tunlk a6\n");
-  else if (fsize)
-    {
-      if (fsize + 4 < 0x8000)
-       fprintf (stream, "\tadd.w $" HOST_WIDE_INT_PRINT_DEC ",sp\n",
-                fsize + 4);
-      else
-       fprintf (stream, "\tadd.l $" HOST_WIDE_INT_PRINT_DEC ",sp\n",
-                fsize + 4);
-    }
-
-  if (current_function_calls_eh_return)
-    fprintf (stream, "\tadd.l a0,sp\n");
-
-  if (current_function_pops_args)
-    fprintf (stream, "\trtd $%d\n", current_function_pops_args);
-  else
-    fprintf (stream, "\trts\n");
-}
-
-#else  /* !CRDS */
-
 static void
 m68k_output_function_epilogue (stream, size)
      FILE *stream;
@@ -879,10 +713,9 @@ m68k_output_function_epilogue (stream, size)
                             reg_names[FRAME_POINTER_REGNUM],
                             reg_names[i]);
 #else
-               fprintf (stream,
-                        "\tmovel %s@(-" HOST_WIDE_INT_PRINT_DEC "),%s\n",
-                        reg_names[FRAME_POINTER_REGNUM],
-                        offset + fsize, reg_names[i]);
+               asm_fprintf (stream, "\tmovel %s@(-%wd),%s\n",
+                            reg_names[FRAME_POINTER_REGNUM],
+                            offset + fsize, reg_names[i]);
 #endif
              }
             offset = offset - 4;
@@ -1045,7 +878,6 @@ m68k_output_function_epilogue (stream, size)
   else
     fprintf (stream, "\trts\n");
 }
-#endif   /* !CRDS  */
 \f
 /* Similar to general_operand, but exclude stack_pointer_rtx.  */
 
@@ -1772,41 +1604,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";
@@ -1885,11 +1697,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)
@@ -1989,11 +1797,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";
@@ -2795,7 +2599,7 @@ floating_exact_log2 (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.
@@ -2819,7 +2623,7 @@ print_operand (file, op, letter)
 {
   if (letter == '.')
     {
-#if defined (MOTOROLA) && !defined (CRDS)
+#if defined (MOTOROLA)
       fprintf (file, ".");
 #endif
     }
@@ -3388,7 +3192,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
@@ -3691,11 +3495,23 @@ m68k_output_mi_thunk (file, thunk, delta, vcall_offset, function)
   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);
 
@@ -3720,7 +3536,7 @@ m68k_output_mi_thunk (file, thunk, delta, vcall_offset, function)
 #ifdef USE_GAS
          fmt = "bra.l %0";
 #else
-         fmt = "jbra %0,a1";
+         fmt = "jra %0,a1";
 #endif
 #endif
        }
@@ -3728,13 +3544,9 @@ m68k_output_mi_thunk (file, thunk, delta, vcall_offset, function)
   else
     {
 #if defined (MOTOROLA) && !defined (USE_GAS)
-#ifdef MOTOROLA_BSR
-      fmt = "bra %0";
-#else
       fmt = "jmp %0";
-#endif
 #else
-      fmt = "jbra %0";
+      fmt = "jra %0";
 #endif
     }