]> rtime.felk.cvut.cz Git - fpga/lx-cpu1/gcc-tumbl.git/commitdiff
Backport from mainline
authoruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 6 Aug 2012 16:28:42 +0000 (16:28 +0000)
committeruros <uros@138bc75d-0d04-0410-961f-82ee72b054a4>
Mon, 6 Aug 2012 16:28:42 +0000 (16:28 +0000)
2012-07-23  Uros Bizjak  <ubizjak@gmail.com>

* config/i386/i386-protos.h (ix86_lea_outperforms): Remove prototype.
* config/i386/i386.c (ix86_lea_outperforms): Make static.  Make
split_cost argument signed.
(ix86_use_lea_for_mov): Use INVALID_REGNUM instead of -1.
(ix86_avoid_lea_for_addr): Ditto.

2012-07-27  Uros Bizjak  <ubizjak@gmail.com>

* config/i386/i386.c (ix86_avoid_lea_for_addr): Return false if
the address has less than two components.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/branches/gcc-4_7-branch@190183 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/i386/i386-protos.h
gcc/config/i386/i386.c

index fe776c275bacbedb7f9bf411c3b31d84867bed2b..bc7c36c705d0ea37983e8cbdf91364632acacb09 100644 (file)
@@ -1,3 +1,19 @@
+2012-08-06  Uros Bizjak  <ubizjak@gmail.com>
+
+       Backport from mainline
+       2012-07-23  Uros Bizjak  <ubizjak@gmail.com>
+
+       * config/i386/i386-protos.h (ix86_lea_outperforms): Remove prototype.
+       * config/i386/i386.c (ix86_lea_outperforms): Make static.  Make
+       split_cost argument signed.
+       (ix86_use_lea_for_mov): Use INVALID_REGNUM instead of -1.
+       (ix86_avoid_lea_for_addr): Ditto.
+
+       2012-07-27  Uros Bizjak  <ubizjak@gmail.com>
+
+       * config/i386/i386.c (ix86_avoid_lea_for_addr): Return false if
+       the address has less than two components.
+
 2012-08-02  Steve Ellcey  <sellcey@mips.com>
 
        Backport from mainline
index f300a56834d853c33c91c0e3fea2419a8776ce72..14bc6729a98fc0763c1e1d584f641d5248163a11 100644 (file)
@@ -92,8 +92,6 @@ extern void ix86_fixup_binary_operands_no_copy (enum rtx_code,
 extern void ix86_expand_binary_operator (enum rtx_code,
                                         enum machine_mode, rtx[]);
 extern bool ix86_binary_operator_ok (enum rtx_code, enum machine_mode, rtx[]);
-extern bool ix86_lea_outperforms (rtx, unsigned int, unsigned int,
-                                 unsigned int, unsigned int);
 extern bool ix86_avoid_lea_for_add (rtx, rtx[]);
 extern bool ix86_use_lea_for_mov (rtx, rtx[]);
 extern bool ix86_avoid_lea_for_addr (rtx, rtx[]);
index c6e8bb26e187318c572ac9e7b6ec7cb8c12816b9..75d8832bf981b27d4d0e121a9123aeaf78266036 100644 (file)
@@ -16710,9 +16710,9 @@ distance_agu_use (unsigned int regno0, rtx insn)
    over a sequence of instructions.  Instructions sequence has
    SPLIT_COST cycles higher latency than lea latency.  */
 
-bool
+static bool
 ix86_lea_outperforms (rtx insn, unsigned int regno0, unsigned int regno1,
-                     unsigned int regno2, unsigned int split_cost)
+                     unsigned int regno2, int split_cost)
 {
   int dist_define, dist_use;
 
@@ -16825,7 +16825,7 @@ ix86_use_lea_for_mov (rtx insn, rtx operands[])
   regno0 = true_regnum (operands[0]);
   regno1 = true_regnum (operands[1]);
 
-  return ix86_lea_outperforms (insn, regno0, regno1, -1, 0);
+  return ix86_lea_outperforms (insn, regno0, regno1, INVALID_REGNUM, 0);
 }
 
 /* Return true if we need to split lea into a sequence of
@@ -16835,9 +16835,9 @@ bool
 ix86_avoid_lea_for_addr (rtx insn, rtx operands[])
 {
   unsigned int regno0 = true_regnum (operands[0]) ;
-  unsigned int regno1 = -1;
-  unsigned int regno2 = -1;
-  unsigned int split_cost = 0;
+  unsigned int regno1 = INVALID_REGNUM;
+  unsigned int regno2 = INVALID_REGNUM;
+  int split_cost = 0;
   struct ix86_address parts;
   int ok;
 
@@ -16857,6 +16857,11 @@ ix86_avoid_lea_for_addr (rtx insn, rtx operands[])
   ok = ix86_decompose_address (operands[1], &parts);
   gcc_assert (ok);
 
+  /* There should be at least two components in the address.  */
+  if ((parts.base != NULL_RTX) + (parts.index != NULL_RTX)
+      + (parts.disp != NULL_RTX) + (parts.scale > 1) < 2)
+    return false;
+
   /* We should not split into add if non legitimate pic
      operand is used as displacement. */
   if (parts.disp && flag_pic && !LEGITIMATE_PIC_OPERAND_P (parts.disp))