This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Some middle-end improvements for bitfield handling
- From: Andreas Schwab <schwab at suse dot de>
- To: Paolo Bonzini <bonzini at gnu dot org>
- Cc: gcc-patches at gcc dot gnu dot org
- Date: Wed, 30 Jun 2004 17:44:41 +0200
- Subject: Re: [PATCH] Some middle-end improvements for bitfield handling
- References: <10406301355.AA16523@vlsi1.ultra.nyu.edu><40E2D891.4060608@gnu.org>
Paolo Bonzini <bonzini@gnu.org> writes:
>> We may want to lower bitfields in some cases, for example if
>> the vectorizer determines that accesses in a loop can be vectorized.
>> I don't follow. How could it do that for fields that were not arrays?
>> We don't currently support arrays of bitfields.
>
> For array of structs, as in
>
> struct x {
> unsigned a : 3;
> unsigned b : 1;
> unsigned c : 5;
> } a[128];
>
> struct x *p;
> for (p = a; p < a + 128; p++)
> p->b = 1;
>
> which may get optimized to
>
> int *p;
>
> for (p = (int *) a; p < (int *) (a + 128); p++)
> p->b |= 0x88888888;
Assuming s/p->b/*p/, s/0x88888888/0x08080808/, CHAR_BIT == 9 and suitable
alignment of a. :-)
Andreas.
--
Andreas Schwab, SuSE Labs, schwab@suse.de
SuSE Linux AG, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."