Debian Codegraph @

gcc/testsuite/gcc.c-torture/execute/pr65215-3.c

raw
1 /* PR tree-optimization/65215 */
2
3 struct S { unsigned long long l1 : 24, l2 : 8, l3 : 32; };
4
5 static inline unsigned int
6 foo (unsigned int x)
7 {
8 return (x >> 24) | ((x >> 8) & 0xff00) | ((x << 8) & 0xff0000) | (x << 24);
9 }
10
11 __attribute__((noinline, noclone)) unsigned long long
12 bar (struct S *x)
13 {
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;
17 }
18
19 int
20 main ()
21 {
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;
31 }