From: "William J. Schmidt" <wschmidt@linux.vnet.ibm.com>
To: Richard Guenther <rguenther@suse.de>
Cc: gcc-patches@gcc.gnu.org
Subject: Re: [PATCH][RFC][1/2] Bitfield lowering, add BIT_FIELD_EXPR
Date: Sun, 19 Jun 2011 23:45:00 -0000 [thread overview]
Message-ID: <1308526874.8025.5.camel@gnopaine> (raw)
In-Reply-To: <alpine.LNX.2.00.1106161328310.810@zhemvz.fhfr.qr>
On Thu, 2011-06-16 at 13:35 +0200, Richard Guenther wrote:
> This is a (possible) pre-requesite for the bitfield lowering patch,
> taken from the old mem-ref branch. It introduces BIT_FIELD_EXPR
> which can be used to do bitfield composition.
> BIT_FIELD_EXPR <a, b, C1, C2> is equivalent to computing
> a & ~((1 << C1 - 1) << C2) | ((b << C2) & (1 << C1 = 1)), thus
> inserting b of width C1 at the bitfield position C2 in a, returning
> the new value. This allows translating
> BIT_FIELD_REF <a, C1, C2> = b;
> to
> a = BIT_FIELD_EXPR <a, b, C1, C2>;
> which avoids partial definitions of a (thus, BIT_FIELD_EXPR is
> similar to COMPLEX_EXPR). BIT_FIELD_EXPR is supposed to work
> on registers only.
>
> Comments welcome, esp. on how to avoid introducing quaternary
> RHS on gimple stmts (or using a GIMPLE_SINGLE_RHS as the patch does).
>
At the risk of being obvious...it seems you could easily combine C1 and
C2 into a single "bitfield descriptor" TREE_INT_CST operand by using
both the high and low portions of the constant. Accessor macros could
be used to hide the slight hackishness of the solution. I didn't see
anything in either patch where this would look particularly ugly.
Storing operands differently than in BIT_FIELD_REF isn't ideal, but
perhaps it's better than a quaternary RHS. /shrug
Bill
next prev parent reply other threads:[~2011-06-19 23:41 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-06-16 11:46 Richard Guenther
2011-06-16 12:06 ` Jay Foad
2011-06-16 17:18 ` Richard Henderson
2011-06-16 18:10 ` Eric Botcazou
2011-06-16 19:23 ` Richard Guenther
2011-06-16 19:53 ` Richard Henderson
2011-06-20 14:23 ` William J. Schmidt
2011-06-20 19:09 ` Andrew Pinski
2011-06-20 21:03 ` Richard Guenther
2011-06-20 21:05 ` Andrew Pinski
2011-06-19 23:45 ` William J. Schmidt [this message]
2011-06-20 13:44 ` Michael Matz
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=1308526874.8025.5.camel@gnopaine \
--to=wschmidt@linux.vnet.ibm.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=rguenther@suse.de \
/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).