c: Implement C23 nullptr (N3042)
[official-gcc.git] / gcc / testsuite / gcc.dg / pr86723.c
blobe3fd6b9d4a1b2328dd3c9be5a140310fd4082cd4
1 /* PR tree-optimization/86723 */
2 /* { dg-do run { target { ilp32 || lp64 } } } */
3 /* { dg-options "-O2" } */
5 __attribute__((noipa)) int
6 foo (unsigned long long value)
8 return (((value & 0x00000000000000ffull) << 56)
9 | ((value & 0x000000000000ff00ull) << 40)
10 | ((value & 0x0000000000ff0000ull) << 24)
11 | ((value & 0x00000000ff000000ull) << 8)
12 | ((value & 0x000000ff00000000ull) >> 8)
13 | ((value & 0x0000ff0000000000ull) >> 24)
14 | ((value & 0x00ff000000000000ull) >> 40)
15 | ((value & 0xff00000000000000ull) >> 56));
18 __attribute__((noipa)) int
19 bar (unsigned long long value)
21 return (((value & 0x000000ff00000000ull) >> 8)
22 | ((value & 0x0000ff0000000000ull) >> 24)
23 | ((value & 0x00ff000000000000ull) >> 40)
24 | ((value & 0xff00000000000000ull) >> 56));
27 __attribute__((noipa)) unsigned long long
28 baz (unsigned long long value)
30 return (((value & 0x00000000000000ffull) << 56)
31 | ((value & 0x000000000000ff00ull) << 40)
32 | ((value & 0x00000000ff000000ull) << 8)
33 | ((value & 0x000000ff00000000ull) >> 8)
34 | ((value & 0x0000ff0000000000ull) >> 24)
35 | ((value & 0xff00000000000000ull) >> 56));
38 __attribute__((noipa)) unsigned int
39 qux (unsigned int value)
41 return (((value & 0x000000ff) << 24)
42 | ((value & 0x00ff0000) >> 8)
43 | ((value & 0xff000000) >> 24));
46 __attribute__((noipa)) unsigned int
47 corge (unsigned int value)
49 return (((value & 0x000000ff) << 24)
50 | ((value & 0xff000000) >> 24));
53 int
54 main ()
56 if (foo (0x0102030405060708ull) != 0x04030201
57 || bar (0x0102030405060708ull) != 0x04030201
58 || baz (0x0102030405060708ull) != 0x0807000504030001ull
59 || qux (0x01020304) != 0x04000201
60 || corge (0x01020304) != 0x04000001)
61 __builtin_abort ();
62 return 0;