libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / fold-parity-6.c
bloba407597854e2f4a48396e2cc475f99c877944b34
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-optimized" } */
4 int foo(unsigned int x)
6 #if __SIZEOF_INT__ == 4
7 return __builtin_parity (__builtin_bswap32(x));
8 #elif __SIZEOF_INT__ == 2
9 return __builtin_parity (__builtin_bswap16(x));
10 #else
11 return x;
12 #endif
15 int bar(unsigned long x)
17 #if __SIZEOF_LONG__ == 8
18 return __builtin_parityl (__builtin_bswap64(x));
19 #elif __SIZEOF_LONG__ == 4
20 return __builtin_parityl (__builtin_bswap32(x));
21 #else
22 return x;
23 #endif
26 int baz(unsigned long long x)
28 #if __SIZEOF_LONG_LONG__ == 8
29 return __builtin_parityll (__builtin_bswap64(x));
30 #elif __SIZEOF_LONG_LONG__ == 4
31 return __builtin_parityll (__builtin_bswap32(x));
32 #else
33 return x;
34 #endif
37 /* { dg-final { scan-tree-dump-not "bswap" "optimized" } } */