summaryrefslogtreecommitdiff
path: root/gcc/config/avr/avr.c
diff options
context:
space:
mode:
Diffstat (limited to 'gcc/config/avr/avr.c')
-rw-r--r--gcc/config/avr/avr.c25
1 files changed, 25 insertions, 0 deletions
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;