aboutsummaryrefslogtreecommitdiff
path: root/gcc/expr.c
diff options
context:
space:
mode:
authorRoger Sayle <roger@eyesopen.com>2002-07-13 00:13:15 +0000
committerRoger Sayle <sayle@gcc.gnu.org>2002-07-13 00:13:15 +0000
commit78762e3b6614cd30d18770bd197a2c00224f293a (patch)
tree3f26eda82c3cb91e38e890329c44fe3521873af1 /gcc/expr.c
parenta5774acd5514d2a5370e040681177303ec5d4823 (diff)
downloadgcc-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/expr.c')
-rw-r--r--gcc/expr.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/gcc/expr.c b/gcc/expr.c
index 779bf87..870a4c5 100644
--- a/gcc/expr.c
+++ b/gcc/expr.c
@@ -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
{