From 998f15f3b6a3ec8963e5c9864480d5c990099bc8 Mon Sep 17 00:00:00 2001 From: Senthil Kumar Selvaraj Date: Thu, 17 Dec 2015 19:55:39 +0300 Subject: [PATCH] avr.h (MOVE_MAX): Set value to 1. * config/avr/avr.h (MOVE_MAX): Set value to 1. (MOVE_MAX_PIECES): Define. (MOVE_RATIO): Define. * config/avr/avr.c (TARGET_USE_BY_PIECES_INFRASTRUCTURE_P): Provide target hook. (avr_use_by_pieces_infrastructure_p): New function. From-SVN: r231782 --- gcc/ChangeLog | 11 ++++++++++- gcc/config/avr/avr.c | 25 +++++++++++++++++++++++++ gcc/config/avr/avr.h | 17 ++++++++++++++++- 3 files changed, 51 insertions(+), 2 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 3a6aa88d8dc..4e5c967e629 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,12 @@ +2015-12-17 Senthil Kumar Selvaraj + + * config/avr/avr.h (MOVE_MAX): Set value to 1. + (MOVE_MAX_PIECES): Define. + (MOVE_RATIO): Define. + * config/avr/avr.c (TARGET_USE_BY_PIECES_INFRASTRUCTURE_P): + Provide target hook. + (avr_use_by_pieces_infrastructure_p): New function. + 2015-12-17 Trevor Saunders * config.gcc: mark *-interix* as obsolete. @@ -349,7 +358,7 @@ * configure.ac: Remove checks for functions that exist in isl 0.13 or later. * graphite-isl-ast-to-gimple.c: Remove #ifdefs and code for isl 0.12. - * graphite-optimize-isl.c: Same. + * graphite-optimize-isl.c: Same. * graphite-poly.c: Same. * graphite-sese-to-poly.c: Same. * graphite.h: Add comment for isl 0.14. diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 609a42b00e4..9cc95dbc782 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -2431,6 +2431,27 @@ avr_print_operand (FILE *file, rtx x, int code) } +/* Implement TARGET_USE_BY_PIECES_INFRASTRUCTURE_P. */ + +/* Prefer sequence of loads/stores for moves of size upto + two - two pairs of load/store instructions are always better + than the 5 instruction sequence for a loop (1 instruction + for loop counter setup, and 4 for the body of the loop). */ + +static bool +avr_use_by_pieces_infrastructure_p (unsigned HOST_WIDE_INT size, + unsigned int align ATTRIBUTE_UNUSED, + enum by_pieces_operation op, + bool speed_p) +{ + + if (op != MOVE_BY_PIECES || (speed_p && (size > (MOVE_MAX_PIECES)))) + return default_use_by_pieces_infrastructure_p (size, align, op, speed_p); + + return size <= (MOVE_MAX_PIECES); +} + + /* Worker function for `NOTICE_UPDATE_CC'. */ /* Update the condition code in the INSN. */ @@ -13763,6 +13784,10 @@ avr_fold_builtin (tree fndecl, int n_args ATTRIBUTE_UNUSED, tree *arg, #undef TARGET_PRINT_OPERAND_PUNCT_VALID_P #define TARGET_PRINT_OPERAND_PUNCT_VALID_P avr_print_operand_punct_valid_p +#undef TARGET_USE_BY_PIECES_INFRASTRUCTURE_P +#define TARGET_USE_BY_PIECES_INFRASTRUCTURE_P \ + avr_use_by_pieces_infrastructure_p + struct gcc_target targetm = TARGET_INITIALIZER; diff --git a/gcc/config/avr/avr.h b/gcc/config/avr/avr.h index 74399647e0a..9872884458a 100644 --- a/gcc/config/avr/avr.h +++ b/gcc/config/avr/avr.h @@ -453,7 +453,22 @@ typedef struct avr_args #undef WORD_REGISTER_OPERATIONS -#define MOVE_MAX 4 +/* Can move only a single byte from memory to reg in a + single instruction. */ + +#define MOVE_MAX 1 + +/* Allow upto two bytes moves to occur using by_pieces + infrastructure */ + +#define MOVE_MAX_PIECES 2 + +/* Set MOVE_RATIO to 3 to allow memory moves upto 4 bytes to happen + by pieces when optimizing for speed, like it did when MOVE_MAX_PIECES + was 4. When optimizing for size, allow memory moves upto 2 bytes. + Also see avr_use_by_pieces_infrastructure_p. */ + +#define MOVE_RATIO(speed) ((speed) ? 3 : 2) #define TRULY_NOOP_TRUNCATION(OUTPREC, INPREC) 1