From: "Joseph S. Myers" <joseph@codesourcery.com>
To: Nick Clifton <nickc@redhat.com>
Cc: Richard Henderson <rth@redhat.com>, gcc-patches@gcc.gnu.org
Subject: Re: RFA: Add support for Renesas RX architecture to GCC (take 2)
Date: Thu, 15 Oct 2009 13:23:00 -0000 [thread overview]
Message-ID: <Pine.LNX.4.64.0910151259240.5084@digraph.polyomino.org.uk> (raw)
In-Reply-To: <4AD6D9A3.3080209@redhat.com>
On Thu, 15 Oct 2009, Nick Clifton wrote:
> > > + static unsigned int
> > > + bit_count (unsigned int x)
> > > + {
> > > + const unsigned int m1 = 0x55555555;
> > > + const unsigned int m2 = 0x33333333;
> > > + const unsigned int m4 = 0x0f0f0f0f;
> > > +
> > > + x -= (x >> 1) & m1;
> > > + x = (x & m2) + ((x >> 2) & m2);
> > > + x = (x + (x >> 4)) & m4;
> > > + x += x >> 8;
> > > +
> > > + return (x + (x >> 16)) & 0x3f;
> >
> > We should probably have this function moved to somewhere generic. We have
> > several places within gcc that we compute a population count. Search for
> > popcount within the toplevel gcc sources.
>
> Could I submit that as a separate patch ? I would like to keep this one
> RX specific.
If we create a generic population count function, it should use
__builtin_popcount (or __builtin_popcountl for a count function of
unsigned long) when built with GCC 3.4 or later (and should probably be
inlined in a header in that case).
--
Joseph S. Myers
joseph@codesourcery.com
next prev parent reply other threads:[~2009-10-15 13:02 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-10-08 8:35 Nick Clifton
2009-10-08 14:14 ` Joseph S. Myers
2009-10-13 8:44 ` RFA: Adding @minus{} to gcc documentation Nick Clifton
2009-10-13 12:32 ` Joseph S. Myers
2009-10-13 16:12 ` Nick Clifton
2009-10-13 16:17 ` Alfred M. Szmidt
2009-10-13 18:22 ` Joseph S. Myers
2009-10-09 21:57 ` RFA: Add support for Renesas RX architecture to GCC (take 2) Richard Henderson
2009-10-15 8:18 ` Nick Clifton
2009-10-15 13:23 ` Joseph S. Myers [this message]
2009-10-15 15:32 ` Richard Henderson
2009-10-15 15:41 ` Richard Henderson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=Pine.LNX.4.64.0910151259240.5084@digraph.polyomino.org.uk \
--to=joseph@codesourcery.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=nickc@redhat.com \
--cc=rth@redhat.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).