diff options
author | Roger Sayle <roger@eyesopen.com> | 2002-07-13 00:13:15 +0000 |
---|---|---|
committer | Roger Sayle <sayle@gcc.gnu.org> | 2002-07-13 00:13:15 +0000 |
commit | 78762e3b6614cd30d18770bd197a2c00224f293a (patch) | |
tree | 3f26eda82c3cb91e38e890329c44fe3521873af1 /gcc | |
parent | a5774acd5514d2a5370e040681177303ec5d4823 (diff) | |
download | gcc-78762e3b6614cd30d18770bd197a2c00224f293a.zip gcc-78762e3b6614cd30d18770bd197a2c00224f293a.tar.gz gcc-78762e3b6614cd30d18770bd197a2c00224f293a.tar.bz2 |
expr.c [...]: New macro defining the maximum number of move instructions to use when...
* expr.c [CLEAR_RATIO]: New macro defining the maximum number
of move instructions to use when clearing memory, c.f. MOVE_RATIO.
[CLEAR_BY_PIECES]: New macro, using CLEAR_RATIO, to determine
whether clear_by_pieces should be used to clear storage.
(clear_storage): Use CLEAR_BY_PIECES instead of MOVE_BY_PIECES.
* doc/tm.texi: Document these two new target macros.
From-SVN: r55429
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/ChangeLog | 10 | ||||
-rw-r--r-- | gcc/doc/tm.texi | 16 | ||||
-rw-r--r-- | gcc/expr.c | 21 |
3 files changed, 46 insertions, 1 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 26c7007..8117485 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,13 @@ +2002-07-12 Roger Sayle <roger@eyesopen.com> + + * expr.c [CLEAR_RATIO]: New macro defining the maximum number + of move instructions to use when clearing memory, c.f. MOVE_RATIO. + [CLEAR_BY_PIECES]: New macro, using CLEAR_RATIO, to determine + whether clear_by_pieces should be used to clear storage. + (clear_storage): Use CLEAR_BY_PIECES instead of MOVE_BY_PIECES. + + * doc/tm.texi: Document these two new target macros. + 2002-07-12 Stephane Carrez <stcarrez@nerim.fr> * config/m68hc11/m68hc11.md ("zero_extendsidi2"): Use D_REG only for diff --git a/gcc/doc/tm.texi b/gcc/doc/tm.texi index daebec7..813482e 100644 --- a/gcc/doc/tm.texi +++ b/gcc/doc/tm.texi @@ -5325,6 +5325,22 @@ than @code{MOVE_RATIO}. A C expression used by @code{move_by_pieces} to determine the largest unit a load or store used to copy memory is. Defaults to @code{MOVE_MAX}. +@findex CLEAR_RATIO +@item CLEAR_RATIO +The threshold of number of scalar move insns, @emph{below} which a sequence +of insns should be generated to clear memory instead of a string clear insn +or a library call. Increasing the value will always make code faster, but +eventually incurs high cost in increased code size. + +If you don't define this, a reasonable default is used. + +@findex CLEAR_BY_PIECES_P +@item CLEAR_BY_PIECES_P (@var{size}, @var{alignment}) +A C expression used to determine whether @code{clear_by_pieces} will be used +to clear a chunk of memory, or whether some other block clear mechanism +will be used. Defaults to 1 if @code{move_by_pieces_ninsns} returns less +than @code{CLEAR_RATIO}. + @findex USE_LOAD_POST_INCREMENT @item USE_LOAD_POST_INCREMENT (@var{mode}) A C expression used to determine whether a load postincrement is a good @@ -192,6 +192,25 @@ static bool float_extend_from_mem[NUM_MACHINE_MODES][NUM_MACHINE_MODES]; (move_by_pieces_ninsns (SIZE, ALIGN) < (unsigned int) MOVE_RATIO) #endif +/* If a clear memory operation would take CLEAR_RATIO or more simple + move-instruction sequences, we will do a clrstr or libcall instead. */ + +#ifndef CLEAR_RATIO +#if defined (HAVE_clrstrqi) || defined (HAVE_clrstrhi) || defined (HAVE_clrstrsi) || defined (HAVE_clrstrdi) || defined (HAVE_clrstrti) +#define CLEAR_RATIO 2 +#else +/* If we are optimizing for space, cut down the default clear ratio. */ +#define CLEAR_RATIO (optimize_size ? 3 : 15) +#endif +#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) +#endif + /* This array records the insn_code of insns to perform block moves. */ enum insn_code movstr_optab[NUM_MACHINE_MODES]; @@ -2633,7 +2652,7 @@ clear_storage (object, size) size = protect_from_queue (size, 0); if (GET_CODE (size) == CONST_INT - && MOVE_BY_PIECES_P (INTVAL (size), align)) + && CLEAR_BY_PIECES_P (INTVAL (size), align)) clear_by_pieces (object, INTVAL (size), align); else { |