libcpp, c, middle-end: Optimize initializers using #embed in C
[official-gcc.git] / gcc / testsuite / gcc.dg / pr96542.c
blob1b59816d9e1bd128be8b69150c15c7b4d98803ca
1 /* { dg-do compile } */
2 /* { dg-options "-O2 -fdump-tree-evrp" } */
3 /* { dg-require-effective-target int32 } */
5 unsigned char
6 foo (unsigned int x)
8 _Bool y = x;
9 return (((unsigned char) ~0) >> y) * 2;
12 unsigned char
13 bar (unsigned int x)
15 return (((unsigned char) ~0) >> (_Bool) x) * 2;
18 unsigned
19 baz (unsigned int x)
21 if (x >= 4) return 32;
22 return (-1U >> x) * 16;
25 /* { dg-final { scan-tree-dump-times "return 254" 2 "evrp" } } */
26 /* { dg-final { scan-tree-dump "= PHI <32.*, 4294967280" "evrp" } } */