From: Jakub Jelinek Date: Tue, 10 Aug 2004 13:28:26 +0000 (+0200) Subject: re PR libgcj/3144 (java.lang.Date.compareTo() not supported) X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=45d78e7f76382d08aeec6c4237e149d2d364ed1c;p=gcc.git re PR libgcj/3144 (java.lang.Date.compareTo() not supported) 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. From-SVN: r85750 --- diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 87045e6484c..2523fc55f11 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,25 @@ +2004-08-10 Jakub Jelinek + + 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 * expr.c (expand_expr_real_1): Add back code that was not dead. diff --git a/gcc/config/i386/i386.h b/gcc/config/i386/i386.h index f998fdbf1e0..588b669825e 100644 --- a/gcc/config/i386/i386.h +++ b/gcc/config/i386/i386.h @@ -2518,6 +2518,12 @@ enum ix86_builtins #define MOVE_RATIO (optimize_size ? 3 : ix86_cost->move_ratio) +/* If a clear memory operation would take CLEAR_RATIO or more simple + move-instruction sequences, we will do a clrmem or libcall instead. */ + +#define CLEAR_RATIO (optimize_size ? 2 \ + : ix86_cost->move_ratio > 6 ? 6 : ix86_cost->move_ratio) + /* Define if shifts truncate the shift count which implies one can omit a sign-extension or zero-extension of a shift count. */ diff --git a/gcc/config/ns32k/ns32k.h b/gcc/config/ns32k/ns32k.h index 6054e843269..a5819f49478 100644 --- a/gcc/config/ns32k/ns32k.h +++ b/gcc/config/ns32k/ns32k.h @@ -1109,8 +1109,8 @@ __transfer_from_trampoline () \ #define STORE_RATIO (optimize_size ? 3 : 15) #define STORE_BY_PIECES_P(SIZE, ALIGN) \ - (move_by_pieces_ninsns (SIZE, ALIGN) < (unsigned int) STORE_RATIO) - + (move_by_pieces_ninsns (SIZE, ALIGN, STORE_MAX_PIECES + 1) \ + < (unsigned int) STORE_RATIO) /* Nonzero if access to memory by bytes is slow and undesirable. */ #define SLOW_BYTE_ACCESS 0 diff --git a/gcc/config/s390/s390.h b/gcc/config/s390/s390.h index 05b8ea932d2..3d9180578a5 100644 --- a/gcc/config/s390/s390.h +++ b/gcc/config/s390/s390.h @@ -855,6 +855,11 @@ extern struct rtx_def *s390_compare_op0, *s390_compare_op1; ( (SIZE) == 1 || (SIZE) == 2 || (SIZE) == 4 \ || (TARGET_64BIT && (SIZE) == 8) ) +/* 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. */ +#define STORE_BY_PIECES_P(SIZE, ALIGN) MOVE_BY_PIECES_P (SIZE, ALIGN) + /* Don't perform CSE on function addresses. */ #define NO_FUNCTION_CSE diff --git a/gcc/config/sh/sh.h b/gcc/config/sh/sh.h index 15c19ad0ab7..9519634c1f0 100644 --- a/gcc/config/sh/sh.h +++ b/gcc/config/sh/sh.h @@ -2368,9 +2368,13 @@ struct sh_args { #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. */ diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index a250742098c..5192bd6e0aa 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -5399,7 +5399,8 @@ used to set a chunk of memory to a constant value, or whether some other mechanism will be used. Used by @code{__builtin_memset} when storing values other than constant zero and by @code{__builtin_strcpy} when when called with a constant source string. -Defaults to @code{MOVE_BY_PIECES_P}. +Defaults to to 1 if @code{move_by_pieces_ninsns} returns less +than @code{MOVE_RATIO}. @end defmac @defmac USE_LOAD_POST_INCREMENT (@var{mode}) diff --git a/gcc/expr.c b/gcc/expr.c index 607115b01b6..7741830033e 100644 --- a/gcc/expr.c +++ b/gcc/expr.c @@ -120,6 +120,7 @@ struct store_by_pieces }; 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 *); @@ -174,21 +175,25 @@ static bool float_extend_from_mem[NUM_MACHINE_MODES][NUM_MACHINE_MODES]; 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. */ @@ -882,7 +887,7 @@ move_by_pieces (rtx to, rtx from, unsigned HOST_WIDE_INT len, 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); @@ -983,10 +988,10 @@ move_by_pieces (rtx to, rtx from, unsigned HOST_WIDE_INT len, 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) @@ -1980,7 +1985,8 @@ can_store_by_pieces (unsigned HOST_WIDE_INT len, 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; @@ -2148,7 +2154,7 @@ store_by_pieces_1 (struct store_by_pieces *data ATTRIBUTE_UNUSED, 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; @@ -2168,7 +2174,7 @@ store_by_pieces_1 (struct store_by_pieces *data ATTRIBUTE_UNUSED, 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);