1 /* PR target/85582 */
2 
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
10 
11 __attribute__((noipa)) S
f1(S x,int y)12 f1 (S x, int y)
13 {
14   x = x << (y & 5);
15   x += y;
16   return x;
17 }
18 
19 __attribute__((noipa)) S
f2(S x,int y)20 f2 (S x, int y)
21 {
22   x = x >> (y & 5);
23   x += y;
24   return x;
25 }
26 
27 __attribute__((noipa)) U
f3(U x,int y)28 f3 (U x, int y)
29 {
30   x = x >> (y & 5);
31   x += y;
32   return x;
33 }
34 
35 int
main()36 main ()
37 {
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;
51 }
52