OSDN Git Service

* expr.c [CLEAR_RATIO]: New macro defining the maximum number
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 13 Jul 2002 00:13:15 +0000 (00:13 +0000)
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>
Sat, 13 Jul 2002 00:13:15 +0000 (00:13 +0000)
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.

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

gcc/ChangeLog
gcc/doc/tm.texi
gcc/expr.c

index 26c7007..8117485 100644 (file)
@@ -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
index daebec7..813482e 100644 (file)
@@ -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
index 779bf87..870a4c5 100644 (file)
@@ -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
        {