PR inline-asm/84742
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / pr65215-3.c
blob0874e193b9db3430ff567b7abd1fa12db4816f00
1 /* PR tree-optimization/65215 */
3 struct S { unsigned long long l1 : 24, l2 : 8, l3 : 32; };
5 static inline unsigned int
6 foo (unsigned int x)
8 return (x >> 24) | ((x >> 8) & 0xff00) | ((x << 8) & 0xff0000) | (x << 24);
11 __attribute__((noinline, noclone)) unsigned long long
12 bar (struct S *x)
14 unsigned long long x1 = foo (((unsigned int) x->l1 << 8) | x->l2);
15 unsigned long long x2 = foo (x->l3);
16 return (x2 << 32) | x1;
19 int
20 main ()
22 if (__CHAR_BIT__ != 8 || sizeof (unsigned int) != 4 || sizeof (unsigned long long) != 8)
23 return 0;
24 struct S s = { 0xdeadbeU, 0xefU, 0xfeedbea8U };
25 unsigned long long l = bar (&s);
26 if (foo (l >> 32) != s.l3
27 || (foo (l) >> 8) != s.l1
28 || (foo (l) & 0xff) != s.l2)
29 __builtin_abort ();
30 return 0;