]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
* config/avr/avr.h (MOVE_MAX): Set value to 1.
authordenisc <denisc@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 17 Dec 2015 16:55:39 +0000 (16:55 +0000)
committerdenisc <denisc@138bc75d-0d04-0410-961f-82ee72b054a4>
Thu, 17 Dec 2015 16:55:39 +0000 (16:55 +0000)
        (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.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@231782 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/config/avr/avr.c
gcc/config/avr/avr.h

index 3a6aa88d8dc33be073e7667f5fb2092265f0e79a..4e5c967e62974abc700a2856238a9e4e28798cde 100644 (file)
@@ -1,3 +1,12 @@
+2015-12-17  Senthil Kumar Selvaraj  <senthil_kumar.selvaraj@atmel.com>
+
+       * 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  <tbsaunde+gcc@tbsaunde.org>
 
        * config.gcc: mark *-interix* as obsolete.
        * 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.
index 609a42b00e43d992203bc59dc9fb0634c9b6394c..9cc95dbc78245bf38812f29cf3aa89e123ba13ea 100644 (file)
@@ -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;
 
 \f
index 74399647e0a57372853d57ab8993da1ac670c2eb..9872884458a59b4888d2f713f45509cf86b5df2a 100644 (file)
@@ -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