OSDN Git Service

* config/m68k/m68k.c (CONST_METHOD): Add MVZ, MVS.
authorbernie <bernie@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 29 May 2004 15:17:50 +0000 (15:17 +0000)
committerbernie <bernie@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 29 May 2004 15:17:50 +0000 (15:17 +0000)
* config/m68k/m68k.c (const_method): Likewise.
* config/m68k/m68k.c (const_int_cost): Likewise.
* config/m68k/m68k.c (const_int_cost): Likewise.
* config/m68k/m68k.c (output_move_const_into_data_reg): Likewise.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@82421 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/m68k/m68k.c

index ca2b422..3573ee2 100644 (file)
@@ -1,6 +1,14 @@
 2004-05-29  Peter Barada  <peter@the-baradas.com>
 
-       * config/m68k/m68k.h(EXTRA_CONSTRAINT): add 'U' for register offset
+       * config/m68k/m68k.c (CONST_METHOD): Add MVZ, MVS.
+       * config/m68k/m68k.c (const_method): Likewise.
+       * config/m68k/m68k.c (const_int_cost): Likewise.
+       * config/m68k/m68k.c (const_int_cost): Likewise.
+       * config/m68k/m68k.c (output_move_const_into_data_reg): Likewise.
+
+2004-05-29  Peter Barada  <peter@the-baradas.com>
+
+       * config/m68k/m68k.h (EXTRA_CONSTRAINT): add 'U' for register offset
        addressing.
        * config/m68k/m68k.md: Add 'U,U' alternative to ColdFire variants of
        movsi,movhi,movqi insn patterns.
index 69a62a6..89af89e 100644 (file)
@@ -1470,7 +1470,7 @@ legitimize_pic_address (rtx orig, enum machine_mode mode ATTRIBUTE_UNUSED,
 }
 
 \f
-typedef enum { MOVL, SWAP, NEGW, NOTW, NOTB, MOVQ } CONST_METHOD;
+typedef enum { MOVL, SWAP, NEGW, NOTW, NOTB, MOVQ, MVS, MVZ } CONST_METHOD;
 
 static CONST_METHOD const_method (rtx);
 
@@ -1505,6 +1505,16 @@ const_method (rtx constant)
       if (USE_MOVQ ((u >> 16) | (u << 16)))
        return SWAP;
     }
+
+  if (TARGET_CFV4)
+    {
+      /* Try using MVZ/MVS with an immedaite value to load constants.   */
+      if (i >= 0 && i <= 65535)
+       return MVZ;
+      if (i >= -32768 && i <= 32767)
+       return MVS;
+    }
+
   /* Otherwise, use move.l */
   return MOVL;
 }
@@ -1517,6 +1527,8 @@ const_int_cost (rtx constant)
       case MOVQ :
       /* Constants between -128 and 127 are cheap due to moveq */
        return 0;
+      case MVZ:
+      case MVS:
       case NOTB :
       case NOTW :
       case NEGW :
@@ -1661,6 +1673,10 @@ output_move_const_into_data_reg (rtx *operands)
   i = INTVAL (operands[1]);
   switch (const_method (operands[1]))
     {
+    case MVZ:
+      return "mvsw %1,%0";
+    case MVS:
+      return "mvzw %1,%0";
     case MOVQ :
       return "moveq %1,%0";
     case NOTB :