aboutsummaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.c-torture/execute/pr65215-2.c
blob: a2842057c50a8eff0e2d683fbe5c0d38c38a61fb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
/* PR tree-optimization/65215 */

static inline unsigned int
foo (unsigned int x)
{
  return (x >> 24) | ((x >> 8) & 0xff00) | ((x << 8) & 0xff0000) | (x << 24);
}

__attribute__((noinline, noclone)) unsigned long long
bar (unsigned long long *x)
{
  return ((unsigned long long) foo (*x) << 32) | foo (*x >> 32);
}

int
main ()
{
  if (__CHAR_BIT__ != 8 || sizeof (unsigned int) != 4 || sizeof (unsigned long long) != 8)
    return 0;
  unsigned long long l = foo (0xfeedbea8U) | ((unsigned long long) foo (0xdeadbeefU) << 32);
  if (bar (&l) != 0xfeedbea8deadbeefULL)
    __builtin_abort ();
  return 0;
}