+2004-08-10 Jakub Jelinek <jakub@redhat.com>
+
+ PR target/3144
+ * expr.c (move_by_pieces_ninsns): Add max_size argument.
+ (MOVE_BY_PIECES_P): Pass MOVE_MAX_PIECES + 1 to it.
+ (CLEAR_BY_PIECES_P): Pass STORE_MAX_PIECES + 1 to it.
+ (STORE_BY_PIECES_P): Define similarly to CLEAR_BY_PIECES_P,
+ but using MOVE_RATIO.
+ (move_by_pieces): Pass max_size to move_by_pieces_ninsns.
+ (can_store_by_pieces): Change max_size type to unsigned int.
+ (store_by_pieces_1): Likewise. Pass max_size to
+ move_by_pieces_ninsns.
+ * config/s390/s390.h (STORE_BY_PIECES_P): Define.
+ * config/sh/sh.c (MOVE_BY_PIECES_P): Pass MOVE_MAX_PIECES + 1
+ to move_by_pieces_ninsns.
+ (STORE_BY_PIECES_P): Define.
+ * config/ns32k/ns32k.h (STORE_BY_PIECES_P): Pass STORE_MAX_PIECES + 1
+ to move_by_pieces_ninsns.
+ * doc/tm.texi (STORE_BY_PIECES_P): Document changed default.
+
+ * config/i386/i386.h (CLEAR_RATIO): Define.
+
2004-08-09 Paolo Bonzini <bonzini@gnu.org>
* expr.c (expand_expr_real_1): Add back code that was not dead.
#define USE_STORE_PRE_DECREMENT(mode) ((mode == SImode || mode == DImode) \
? 0 : TARGET_SH1)
-#define MOVE_BY_PIECES_P(SIZE, ALIGN) (move_by_pieces_ninsns (SIZE, ALIGN) \
- < (TARGET_SMALLCODE ? 2 : \
- ((ALIGN >= 32) ? 16 : 2)))
+#define MOVE_BY_PIECES_P(SIZE, ALIGN) \
+ (move_by_pieces_ninsns (SIZE, ALIGN, MOVE_MAX_PIECES + 1) \
+ < (TARGET_SMALLCODE ? 2 : ((ALIGN >= 32) ? 16 : 2)))
+
+#define STORE_BY_PIECES_P(SIZE, ALIGN) \
+ (move_by_pieces_ninsns (SIZE, ALIGN, STORE_MAX_PIECES + 1) \
+ < (TARGET_SMALLCODE ? 2 : ((ALIGN >= 32) ? 16 : 2)))
/* Macros to check register numbers against specific register classes. */
};
static unsigned HOST_WIDE_INT move_by_pieces_ninsns (unsigned HOST_WIDE_INT,
+ unsigned int,
unsigned int);
static void move_by_pieces_1 (rtx (*) (rtx, ...), enum machine_mode,
struct move_by_pieces *);
to perform a structure copy. */
#ifndef MOVE_BY_PIECES_P
#define MOVE_BY_PIECES_P(SIZE, ALIGN) \
- (move_by_pieces_ninsns (SIZE, ALIGN) < (unsigned int) MOVE_RATIO)
+ (move_by_pieces_ninsns (SIZE, ALIGN, MOVE_MAX_PIECES + 1) \
+ < (unsigned int) MOVE_RATIO)
#endif
/* This macro is used to determine whether clear_by_pieces should be
called to clear storage. */
#ifndef CLEAR_BY_PIECES_P
#define CLEAR_BY_PIECES_P(SIZE, ALIGN) \
- (move_by_pieces_ninsns (SIZE, ALIGN) < (unsigned int) CLEAR_RATIO)
+ (move_by_pieces_ninsns (SIZE, ALIGN, STORE_MAX_PIECES + 1) \
+ < (unsigned int) CLEAR_RATIO)
#endif
/* This macro is used to determine whether store_by_pieces should be
called to "memset" storage with byte values other than zero, or
to "memcpy" storage when the source is a constant string. */
#ifndef STORE_BY_PIECES_P
-#define STORE_BY_PIECES_P(SIZE, ALIGN) MOVE_BY_PIECES_P (SIZE, ALIGN)
+#define STORE_BY_PIECES_P(SIZE, ALIGN) \
+ (move_by_pieces_ninsns (SIZE, ALIGN, STORE_MAX_PIECES + 1) \
+ < (unsigned int) MOVE_RATIO)
#endif
/* This array records the insn_code of insns to perform block moves. */
copy addresses to registers (to make displacements shorter)
and use post-increment if available. */
if (!(data.autinc_from && data.autinc_to)
- && move_by_pieces_ninsns (len, align) > 2)
+ && move_by_pieces_ninsns (len, align, max_size) > 2)
{
/* Find the mode of the largest move... */
for (tmode = GET_CLASS_NARROWEST_MODE (MODE_INT);
ALIGN (in bits) is maximum alignment we can assume. */
static unsigned HOST_WIDE_INT
-move_by_pieces_ninsns (unsigned HOST_WIDE_INT l, unsigned int align)
+move_by_pieces_ninsns (unsigned HOST_WIDE_INT l, unsigned int align,
+ unsigned int max_size)
{
unsigned HOST_WIDE_INT n_insns = 0;
- unsigned HOST_WIDE_INT max_size = MOVE_MAX + 1;
if (! SLOW_UNALIGNED_ACCESS (word_mode, align)
|| align > MOVE_MAX * BITS_PER_UNIT || align >= BIGGEST_ALIGNMENT)
rtx (*constfun) (void *, HOST_WIDE_INT, enum machine_mode),
void *constfundata, unsigned int align)
{
- unsigned HOST_WIDE_INT max_size, l;
+ unsigned HOST_WIDE_INT l;
+ unsigned int max_size;
HOST_WIDE_INT offset = 0;
enum machine_mode mode, tmode;
enum insn_code icode;
unsigned int align ATTRIBUTE_UNUSED)
{
rtx to_addr = XEXP (data->to, 0);
- unsigned HOST_WIDE_INT max_size = STORE_MAX_PIECES + 1;
+ unsigned int max_size = STORE_MAX_PIECES + 1;
enum machine_mode mode = VOIDmode, tmode;
enum insn_code icode;
copy addresses to registers (to make displacements shorter)
and use post-increment if available. */
if (!data->autinc_to
- && move_by_pieces_ninsns (data->len, align) > 2)
+ && move_by_pieces_ninsns (data->len, align, max_size) > 2)
{
/* Determine the main mode we'll be using. */
for (tmode = GET_CLASS_NARROWEST_MODE (MODE_INT);