Debian Codegraph @

gcc/testsuite/gcc.dg/fold-parity-5.c

raw
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
3 /* { dg-require-effective-target int32plus } */
4
5 int test_and4(unsigned int a)
6 {
7 return __builtin_parity(a&4);
8 }
9
10 int test_and4l(unsigned long b)
11 {
12 return __builtin_parityl(b&4);
13 }
14
15 int test_and4ll(unsigned long long c)
16 {
17 return __builtin_parityll(c&4);
18 }
19
20 int test_shift(unsigned int d)
21 {
22 int bits = 8*sizeof(unsigned int)-1;
23 return __builtin_parity(d<<31);
24 }
25
26 int test_shiftl(unsigned long e)
27 {
28 int bits = 8*sizeof(unsigned long)-1;
29 return __builtin_parityl(e<<bits);
30 }
31
32 int test_shiftll(unsigned long long f)
33 {
34 int bits = 8*sizeof(unsigned long long)-1;
35 return __builtin_parityll(f<<bits);
36 }
37
38 /* { dg-final { scan-tree-dump-times "parity" 0 "optimized" } } */
39