This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH] Some middle-end improvements for bitfield handling


    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;

Nice savings.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]