From 6f0947e4010c96079f97d9ffe9629d5270d816f2 Mon Sep 17 00:00:00 2001 From: Steven Bosscher Date: Sun, 16 Jan 2005 21:09:24 +0000 Subject: [PATCH] ggc-page.c (ggc_alloc_stat): Use __builtin_ctzl instead of a loop to look for a free slot in a page entry. * ggc-page.c (ggc_alloc_stat): Use __builtin_ctzl instead of a loop to look for a free slot in a page entry. From-SVN: r93738 --- gcc/ChangeLog | 5 +++++ gcc/ggc-page.c | 6 ++++++ 2 files changed, 11 insertions(+) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 9bff84f653c3..a3015093f73e 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,8 @@ +2005-01-16 Steven Bosscher + + * 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 PR target/16304 diff --git a/gcc/ggc-page.c b/gcc/ggc-page.c index e0dfb1610d40..362bfe19763c 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; }