blob: 0a3ee0f65dd60951c06a4a1b80e56d93731a6c57 [file] [log] [blame]
/* APPLE LOCAL file radar 4287182 */
/* { dg-do compile { target "i?86-*-*" } } */
/* { dg-options "-O2" } */
/* { dg-final { scan-assembler-not "movb" } } */
/* { dg-final { scan-assembler-not "movw" } } */
/* { dg-final { scan-assembler-not "andw" } } */
#define ARRAY_LENGTH 16
union bitfield {
struct {
unsigned int field0 : 6;
unsigned int field1 : 6;
unsigned int field2 : 6;
unsigned int field3 : 6;
unsigned int field4 : 3;
unsigned int field5 : 4;
unsigned int field6 : 1;
} bitfields, bits;
unsigned int u32All;
signed int i32All;
float f32All;
};
typedef struct program_t {
union bitfield array[ARRAY_LENGTH];
} program;
void foo(program* prog, unsigned int fmt1)
{
unsigned int shift = 0;
unsigned int texCount = 0;
unsigned int i;
for (i = 0; i < 8; i++)
{
prog->array[i].bitfields.field0 = texCount;
prog->array[i].bitfields.field1 = texCount + 1;
prog->array[i].bitfields.field2 = texCount + 2;
prog->array[i].bitfields.field3 = texCount + 3;
texCount += (fmt1 >> shift) & 0x7;
shift += 3;
}
}
/* APPLE LOCAL file radar 4287182 */