PR middle-end/77357 - strlen of constant strings not folded
[official-gcc.git] / gcc / testsuite / gcc.c-torture / execute / pr85582-2.c
blob7fd5b55ab28d855d3bdd19c749afa9cbc3dc3d10
1 /* PR target/85582 */
3 #ifdef __SIZEOF_INT128__
4 typedef __int128 S;
5 typedef unsigned __int128 U;
6 #else
7 typedef long long S;
8 typedef unsigned long long U;
9 #endif
11 __attribute__((noipa)) S
12 f1 (S x, int y)
14 x = x << (y & 5);
15 x += y;
16 return x;
19 __attribute__((noipa)) S
20 f2 (S x, int y)
22 x = x >> (y & 5);
23 x += y;
24 return x;
27 __attribute__((noipa)) U
28 f3 (U x, int y)
30 x = x >> (y & 5);
31 x += y;
32 return x;
35 int
36 main ()
38 S a = (S) 1 << (sizeof (S) * __CHAR_BIT__ - 7);
39 S b = f1 (a, 12);
40 if (b != ((S) 1 << (sizeof (S) * __CHAR_BIT__ - 3)) + 12)
41 __builtin_abort ();
42 S c = (U) 1 << (sizeof (S) * __CHAR_BIT__ - 1);
43 S d = f2 (c, 12);
44 if ((U) d != ((U) 0x1f << (sizeof (S) * __CHAR_BIT__ - 5)) + 12)
45 __builtin_abort ();
46 U e = (U) 1 << (sizeof (U) * __CHAR_BIT__ - 1);
47 U f = f3 (c, 12);
48 if (f != ((U) 1 << (sizeof (U) * __CHAR_BIT__ - 5)) + 12)
49 __builtin_abort ();
50 return 0;