From 0e5172ebf287a857364a0e8be216e3231258bc49 Mon Sep 17 00:00:00 2001 From: Claudiu Zissulescu Date: Mon, 13 Mar 2017 13:56:22 +0100 Subject: [PATCH] [ARC] Code size modifications. gcc/ 2017-03-13 Claudiu Zissulescu * 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. From-SVN: r246091 --- gcc/ChangeLog | 8 +++++ gcc/common/config/arc/arc-common.c | 1 + gcc/config/arc/arc.c | 56 ++++++++++++++++++++++-------- 3 files changed, 51 insertions(+), 14 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 1c160a5b86c..b00a0cd6d95 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,11 @@ +2017-03-13 Claudiu Zissulescu + + * 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. + 2017-03-13 Claudiu Zissulescu * config/arc/arc.md (*tst_bitfield_tst): Fix pattern. diff --git a/gcc/common/config/arc/arc-common.c b/gcc/common/config/arc/arc-common.c index 88bfec6335b..82e0dd383c9 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 5826c40ca7f..1116b2dbc25 100644 --- a/gcc/config/arc/arc.c +++ b/gcc/config/arc/arc.c @@ -676,6 +676,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) @@ -1374,20 +1380,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) { -- 2.30.2