summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorsteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2005-01-16 21:09:24 +0000
committersteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>2005-01-16 21:09:24 +0000
commitbff490025616739605f60e4778b42d2a55afd858 (patch)
tree146a66df19f420ca576e53cd91dfd89894f09879
parentff9bb54ea5a2dc2fd9b7b82bf5a2d007acc1142c (diff)
downloadgcc-bff490025616739605f60e4778b42d2a55afd858.tar.gz
* ggc-page.c (ggc_alloc_stat): Use __builtin_ctzl instead of a
loop to look for a free slot in a page entry. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@93738 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/ggc-page.c6
2 files changed, 11 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9bff84f653c..a3015093f73 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,8 @@
+2005-01-16 Steven Bosscher <stevenb@suse.de>
+
+ * ggc-page.c (ggc_alloc_stat): Use __builtin_ctzl instead of a
+ loop to look for a free slot in a page entry.
+
2005-01-16 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR target/16304
diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c
index e0dfb1610d4..362bfe19763 100644
--- a/gcc/ggc-page.c
+++ b/gcc/ggc-page.c
@@ -1139,8 +1139,14 @@ ggc_alloc_stat (size_t size MEM_STAT_DECL)
word = bit = 0;
while (~entry->in_use_p[word] == 0)
++word;
+
+#if GCC_VERSION >= 3004
+ bit = __builtin_ctzl (~entry->in_use_p[word]);
+#else
while ((entry->in_use_p[word] >> bit) & 1)
++bit;
+#endif
+
hint = word * HOST_BITS_PER_LONG + bit;
}