]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
i386.c (ix86_register_move_cost): Increase cost for secondary_memory_needed pairs.
authorRichard Henderson <rth@gcc.gnu.org>
Wed, 9 Oct 2002 17:52:44 +0000 (10:52 -0700)
committerRichard Henderson <rth@gcc.gnu.org>
Wed, 9 Oct 2002 17:52:44 +0000 (10:52 -0700)
        * config/i386/i386.c (ix86_register_move_cost): Increase cost
        for secondary_memory_needed pairs.

From-SVN: r57988

gcc/ChangeLog
gcc/config/i386/i386.c

index 7c5d0a4382ab237b94eee77de673a16c612dd131..096414a296c6671448846caecb8fd2d4613d5382 100644 (file)
@@ -1,3 +1,9 @@
+2002-10-02  Richard Henderson  <rth@redhat.com>
+
+       PR opt/7124
+       * config/i386/i386.c (ix86_register_move_cost): Increase cost
+       for secondary_memory_needed pairs.
+
 Wed Oct  9 19:09:13 CEST 2002  Jan Hubicka  <jh@suse.cz>
 
        PR opt/7912
@@ -23,7 +29,7 @@ Wed Oct  9 19:09:13 CEST 2002  Jan Hubicka  <jh@suse.cz>
        (CRTSTUFF_T_CFLAGS): Define.
 
 2002-09-25  Eric Botcazou  <ebotcazou@libertysurf.fr>
-            Volker Reichelt <reichelt@igpm.rwth-aachen.de>
+           Volker Reichelt <reichelt@igpm.rwth-aachen.de>
 
        PR c/7411
        * expr.c (expand_expr) [PLUS]: Simplify after the operands
@@ -142,8 +148,8 @@ Thu Oct  3 21:35:36 CEST 2002  Jan Hubicka  <jh@suse.cz>
        * toplev.c (rest_of_compilation): Dump loops before clobbering
        the structure.
 
-        * expr.c (force_operand): Use expand_simple_* to handle more
-        cases.
+       * expr.c (force_operand): Use expand_simple_* to handle more
+       cases.
 
        * i386.c (q_regs_operand): Use ANY_QI_REG_P.
 
@@ -160,9 +166,9 @@ Thu Oct  3 21:35:36 CEST 2002  Jan Hubicka  <jh@suse.cz>
        * rtl.h (reg_or_subregno): Declare
        * unroll.c (find_splittable_givs): Handle subregs.
 
-        Richard Sandiford  <rsandifo@redhat.com>:
+       Richard Sandiford  <rsandifo@redhat.com>:
 
-        * expr.c (force_operand): Fix reversed move.
+       * expr.c (force_operand): Fix reversed move.
 
        Andreas Jaeger  <aj@suse.de>:
 
index 8c9df73c7efa4fcd7313873b122022570a94992d..5e487156b1cbd27cd409b8a3ef687225d855d38a 100644 (file)
@@ -12362,17 +12362,33 @@ ix86_register_move_cost (mode, class1, class2)
      enum reg_class class1, class2;
 {
   /* In case we require secondary memory, compute cost of the store followed
-     by load.  In case of copying from general_purpose_register we may emit
-     multiple stores followed by single load causing memory size mismatch
-     stall.  Count this as arbitarily high cost of 20.  */
+     by load.  In order to avoid bad register allocation choices, we need 
+     for this to be *at least* as high as the symmetric MEMORY_MOVE_COST.  */
+
   if (ix86_secondary_memory_needed (class1, class2, mode, 0))
     {
-      int add_cost = 0;
+      int cost = 1;
+
+      cost += MAX (MEMORY_MOVE_COST (mode, class1, 0),
+                  MEMORY_MOVE_COST (mode, class1, 1));
+      cost += MAX (MEMORY_MOVE_COST (mode, class2, 0),
+                  MEMORY_MOVE_COST (mode, class2, 1));
+      
+      /* In case of copying from general_purpose_register we may emit multiple
+         stores followed by single load causing memory size mismatch stall.
+         Count this as arbitarily high cost of 20.  */
       if (CLASS_MAX_NREGS (class1, mode) > CLASS_MAX_NREGS (class2, mode))
-         add_cost = 20;
-      return (MEMORY_MOVE_COST (mode, class1, 0)
-             + MEMORY_MOVE_COST (mode, class2, 1) + add_cost);
+       cost += 20;
+
+      /* In the case of FP/MMX moves, the registers actually overlap, and we
+        have to switch modes in order to treat them differently.  */
+      if ((MMX_CLASS_P (class1) && MAYBE_FLOAT_CLASS_P (class2))
+          || (MMX_CLASS_P (class2) && MAYBE_FLOAT_CLASS_P (class1)))
+       cost += 20;
+
+      return cost;
     }
+
   /* Moves between SSE/MMX and integer unit are expensive.  */
   if (MMX_CLASS_P (class1) != MMX_CLASS_P (class2)
       || SSE_CLASS_P (class1) != SSE_CLASS_P (class2))