gcc/
2016-09-20  Claudiu Zissulescu  <claz...@synopsys.com>

        * config/arc/arc.c (arc_init): Use multiplier whenever we have it.
        (arc_conditional_register_usage): Use a different allocation order
        when optimizing for size.
        * common/config/arc/arc-common.c (arc_option_optimization_table):
        Section anchors default on when optimizing for size.
---
 gcc/common/config/arc/arc-common.c |  1 +
 gcc/config/arc/arc.c               | 56 ++++++++++++++++++++++++++++----------
 2 files changed, 43 insertions(+), 14 deletions(-)

diff --git a/gcc/common/config/arc/arc-common.c 
b/gcc/common/config/arc/arc-common.c
index 88bfec6..82e0dd3 100644
--- a/gcc/common/config/arc/arc-common.c
+++ b/gcc/common/config/arc/arc-common.c
@@ -46,6 +46,7 @@ arc_option_init_struct (struct gcc_options *opts)
 #define OPT_LEVELS_3_PLUS_SPEED_ONLY OPT_LEVELS_3_PLUS
 static const struct default_options arc_option_optimization_table[] =
   {
+    { OPT_LEVELS_SIZE, OPT_fsection_anchors, NULL, 1 },
     { OPT_LEVELS_1_PLUS, OPT_fomit_frame_pointer, NULL, 1 },
     { OPT_LEVELS_ALL, OPT_mRcq, NULL, 1 },
     { OPT_LEVELS_ALL, OPT_mRcw, NULL, 1 },
diff --git a/gcc/config/arc/arc.c b/gcc/config/arc/arc.c
index 1c929ff..bde3c30 100644
--- a/gcc/config/arc/arc.c
+++ b/gcc/config/arc/arc.c
@@ -679,6 +679,12 @@ make_pass_arc_predicate_delay_insns (gcc::context *ctxt)
 static void
 arc_init (void)
 {
+  if (TARGET_V2)
+    {
+      /* I have the multiplier, then use it*/
+      if (TARGET_MPYW || TARGET_MULTI)
+         arc_multcost = COSTS_N_INSNS (1);
+    }
   /* Note: arc_multcost is only used in rtx_cost if speed is true.  */
   if (arc_multcost < 0)
     switch (arc_tune)
@@ -1377,20 +1383,42 @@ arc_conditional_register_usage (void)
     }
   if (TARGET_Q_CLASS)
     {
-      reg_alloc_order[2] = 12;
-      reg_alloc_order[3] = 13;
-      reg_alloc_order[4] = 14;
-      reg_alloc_order[5] = 15;
-      reg_alloc_order[6] = 1;
-      reg_alloc_order[7] = 0;
-      reg_alloc_order[8] = 4;
-      reg_alloc_order[9] = 5;
-      reg_alloc_order[10] = 6;
-      reg_alloc_order[11] = 7;
-      reg_alloc_order[12] = 8;
-      reg_alloc_order[13] = 9;
-      reg_alloc_order[14] = 10;
-      reg_alloc_order[15] = 11;
+      if (optimize_size)
+       {
+         reg_alloc_order[0] = 0;
+         reg_alloc_order[1] = 1;
+         reg_alloc_order[2] = 2;
+         reg_alloc_order[3] = 3;
+         reg_alloc_order[4] = 12;
+         reg_alloc_order[5] = 13;
+         reg_alloc_order[6] = 14;
+         reg_alloc_order[7] = 15;
+         reg_alloc_order[8] = 4;
+         reg_alloc_order[9] = 5;
+         reg_alloc_order[10] = 6;
+         reg_alloc_order[11] = 7;
+         reg_alloc_order[12] = 8;
+         reg_alloc_order[13] = 9;
+         reg_alloc_order[14] = 10;
+         reg_alloc_order[15] = 11;
+       }
+      else
+       {
+         reg_alloc_order[2] = 12;
+         reg_alloc_order[3] = 13;
+         reg_alloc_order[4] = 14;
+         reg_alloc_order[5] = 15;
+         reg_alloc_order[6] = 1;
+         reg_alloc_order[7] = 0;
+         reg_alloc_order[8] = 4;
+         reg_alloc_order[9] = 5;
+         reg_alloc_order[10] = 6;
+         reg_alloc_order[11] = 7;
+         reg_alloc_order[12] = 8;
+         reg_alloc_order[13] = 9;
+         reg_alloc_order[14] = 10;
+         reg_alloc_order[15] = 11;
+       }
     }
   if (TARGET_SIMD_SET)
     {
-- 
1.9.1

Reply via email to