summaryrefslogtreecommitdiff
path: root/gcc/testsuite/gcc.target/i386/pr35540.c
blob: 00af637d0020dff50323353d07f8bbef1c343c43 (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
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
/* { dg-do run } */
/* { dg-options "-O2" } */

extern void abort (void);

int __attribute__ ((noinline))
test (unsigned int *a, int b)
{
  return b ? 1 : __builtin_parity (*a);
}

int __attribute__ ((noinline))
testl (unsigned long *a, int b)
{
  return b ? 1 : __builtin_parityl (*a);
}

int __attribute__ ((noinline))
testll (unsigned long long *a, int b)
{
  return b ? 1 : __builtin_parityll (*a);
}

int
main ()
{
  unsigned int a = 0;
  unsigned long al;
  unsigned long long all;

  a = 0x12345670;
  if (test (&a, 0))
    abort ();

  al = 0x12345670ul;
  if (testl (&al, 0))
    abort();

#if 1
  all = 0x12345678abcdef0ull;
  if (testll (&all, 0))
    abort ();
#endif
  return 0;
}