Update MOVE_RATIO cost for IA MCU
authorH.J. Lu <hongjiu.lu@intel.com>
Mon, 24 Aug 2015 15:24:44 +0000 (15:24 +0000)
committerH.J. Lu <hjl@gcc.gnu.org>
Mon, 24 Aug 2015 15:24:44 +0000 (08:24 -0700)
This patch updates MOVE_RATIO cost for IA MCU from 6 to 9 so that we
can unroll the loop completely for DOM with -mtune=iamcu.

gcc/

PR target/67329
* config/i386/i386.c (iamcu_cost): Set MOVE_RATIO cost to 9.

gcc/testsuite/

PR target/67329
* gcc.target/i386/pr67329.c: New test.

From-SVN: r227132

gcc/ChangeLog
gcc/config/i386/i386.c
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.target/i386/pr67329.c [new file with mode: 0644]

index 33c91dca02379f85539cc0e8f8da679027e6b723..1bac36655a970e88e5d14c3286bac8dabcb5fb2a 100644 (file)
@@ -1,3 +1,8 @@
+2015-08-24  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR target/67329
+       * config/i386/i386.c (iamcu_cost): Set MOVE_RATIO cost to 9.
+
 2015-08-24  Renlin Li  <renlin.li@arm.com>
 
        * config/arm/arm-protos.h (arm_valid_symbolic_address_p): Declare.
index 05fa5e10ebf5bc6f3ba5ad3ee9e5616a556e2d4d..070605fb4fcacf2e1d8892a072e47fb430452431 100644 (file)
@@ -436,7 +436,7 @@ struct processor_costs iamcu_cost = {
   COSTS_N_INSNS (3),                   /* cost of movsx */
   COSTS_N_INSNS (2),                   /* cost of movzx */
   8,                                   /* "large" insn */
-  6,                                   /* MOVE_RATIO */
+  9,                                   /* MOVE_RATIO */
   6,                                /* cost for loading QImode using movzbl */
   {2, 4, 2},                           /* cost of loading integer registers
                                           in QImode, HImode and SImode.
index 77c8c23db7f74cc029f9dbcca64cf332dff8378a..9161ce4b3b7bdc7f70f7641ce5d6cac471987619 100644 (file)
@@ -1,3 +1,8 @@
+2015-08-24  H.J. Lu  <hongjiu.lu@intel.com>
+
+       PR target/67329
+       * gcc.target/i386/pr67329.c: New test.
+
 2015-08-24  Nathan Sidwell  <nathan@acm.org>
 
        * gcc/testsuite/gcc.dg/pr49551.c: Needs -fdata-sections.
diff --git a/gcc/testsuite/gcc.target/i386/pr67329.c b/gcc/testsuite/gcc.target/i386/pr67329.c
new file mode 100644 (file)
index 0000000..a29dd5b
--- /dev/null
@@ -0,0 +1,20 @@
+/* { dg-do compile { target ia32 } } */
+/* { dg-options "-O3 -fno-tree-fre -fno-tree-pre -fdump-tree-optimized -mtune=iamcu" } */
+
+int
+foo ()
+{
+  const int a[8] = { 0, 1, 2, 3, 4, 5, 6, 7 };
+  int i, sum;
+
+  sum = 0;
+  for (i = 0; i < sizeof (a) / sizeof (*a); i++)
+    sum += a[i];
+
+  return sum;
+}
+
+/* After late unrolling the above loop completely DOM should be
+   able to optimize this to return 28.  */
+
+/* { dg-final { scan-tree-dump "return 28;" "optimized" } } */