Debian Codegraph @

gcc/testsuite/gcc.dg/tree-ssa/pr117927.c

raw
1 /* PR tree-optimization/117927 */
2 /* { dg-do compile { target { int32 && longlong64 } } } */
3 /* { dg-options "-O2 -fdump-tree-optimized" } */
4 /* { dg-final { scan-tree-dump-times " r<< " 4 "optimized" } } */
5 /* { dg-final { scan-tree-dump-times " r>> " 4 "optimized" } } */
6 /* { dg-final { scan-tree-dump-times " & 31;" 2 "optimized" } } */
7 /* { dg-final { scan-tree-dump-times " & 63;" 2 "optimized" } } */
8 /* { dg-final { scan-tree-dump-not "32 - " "optimized" } } */
9 /* { dg-final { scan-tree-dump-not "64 - " "optimized" } } */
10
11 static inline
12 unsigned lrotate32 (unsigned x, int t)
13 {
14 unsigned tl = x << t;
15 unsigned th = x >> (-t & 31);
16 return tl | th;
17 }
18
19 static inline
20 unsigned rrotate32 (unsigned x, int t)
21 {
22 unsigned tl = x >> t;
23 unsigned th = x << (-t & 31);
24 return tl | th;
25 }
26
27 static inline
28 unsigned long long lrotate64 (unsigned long long x, int t)
29 {
30 unsigned long long tl = x << t;
31 unsigned long long th = x >> (-t & 63);
32 return tl | th;
33 }
34
35 static inline
36 unsigned long long rrotate64 (unsigned long long x, int t)
37 {
38 unsigned long long tl = x >> t;
39 unsigned long long th = x << (-t & 63);
40 return tl | th;
41 }
42
43 unsigned
44 f1 (unsigned x, int t)
45 {
46 return lrotate32 (x, 32 - t);
47 }
48
49 unsigned long long
50 f2 (unsigned long long x, int t)
51 {
52 return lrotate64 (x, 64 - t);
53 }
54
55 unsigned
56 f3 (unsigned x, int t)
57 {
58 if (t == 32)
59 __builtin_unreachable ();
60 return lrotate32 (x, 32 - t);
61 }
62
63 unsigned long long
64 f4 (unsigned long long x, int t)
65 {
66 if (t == 64)
67 __builtin_unreachable ();
68 return lrotate64 (x, 64 - t);
69 }
70
71 unsigned
72 f5 (unsigned x, int t)
73 {
74 return rrotate32 (x, 32 - t);
75 }
76
77 unsigned long long
78 f6 (unsigned long long x, int t)
79 {
80 return rrotate64 (x, 64 - t);
81 }
82
83 unsigned
84 f7 (unsigned x, int t)
85 {
86 if (t == 32)
87 __builtin_unreachable ();
88 return rrotate32 (x, 32 - t);
89 }
90
91 unsigned long long
92 f8 (unsigned long long x, int t)
93 {
94 if (t == 64)
95 __builtin_unreachable ();
96 return rrotate64 (x, 64 - t);
97 }