1 /* PR rtl-optimization/53942 */
2 /* { dg-do compile } */
3 /* { dg-options "-O2" } */
4 /* { dg-additional-options "-mtune=pentium2" { target { { i?86-*-* x86_64-*-* } && ia32 } } } */
5 
6 struct S
7 {
8   unsigned short w[3];
9   unsigned int x, y;
10 };
11 
12 struct S *baz (void);
13 
14 __attribute__ ((noinline))
15 static unsigned char
foo(struct S * x,unsigned char y)16 foo (struct S *x, unsigned char y)
17 {
18   unsigned char c = 0;
19   unsigned char v = x->w[0];
20   c |= v;
21   v = ((x->w[1]) & (1 << y)) ? 1 : 0;
22   c |= v << 1;
23   v = ((x->w[2]) & 0xff) & (1 << y);
24   c |= v << 2;
25   return c;
26 }
27 
28 void
bar(void)29 bar (void)
30 {
31   struct S *s = baz ();
32   s->x = foo (s, 6);
33   s->y = foo (s, 7);
34 }
35