OSDN Git Service

* ggc-page.c (ggc_alloc_stat): Use __builtin_ctzl instead of a
authorsteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 16 Jan 2005 21:09:24 +0000 (21:09 +0000)
committersteven <steven@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 16 Jan 2005 21:09:24 +0000 (21:09 +0000)
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

gcc/ChangeLog
gcc/ggc-page.c

index 9bff84f..a301509 100644 (file)
@@ -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
 2005-01-16  John David Anglin  <dave.anglin@nrc-cnrc.gc.ca>
 
        PR target/16304
index e0dfb16..362bfe1 100644 (file)
@@ -1139,8 +1139,14 @@ ggc_alloc_stat (size_t size MEM_STAT_DECL)
          word = bit = 0;
          while (~entry->in_use_p[word] == 0)
            ++word;
          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;
          while ((entry->in_use_p[word] >> bit) & 1)
            ++bit;
+#endif
+
          hint = word * HOST_BITS_PER_LONG + bit;
        }
 
          hint = word * HOST_BITS_PER_LONG + bit;
        }