Debian Codegraph @

gcc/testsuite/gcc.target/sh/pr54089-1.c

raw
1 /* Check that the rotcr instruction is generated. */
2 /* { dg-do compile } */
3 /* { dg-options "-O2" } */
4 /* { dg-final { scan-assembler-times "rotcr" 25 } } */
5 /* { dg-final { scan-assembler-times "sett" 1 } } */
6 /* { dg-final { scan-assembler-times "shll\t" 1 } } */
7 /* { dg-final { scan-assembler-not "and\t#1" } } */
8 /* { dg-final { scan-assembler-not "cmp/pl" } } */
9
10 typedef char mybool;
11
12 long long
13 test_00 (long long a)
14 {
15 return a >> 1;
16 }
17
18 unsigned int
19 test_01 (unsigned int a, int b, int c)
20 {
21 mybool r = b == c;
22 return ((a >> 1) | (r << 31));
23 }
24
25 unsigned int
26 test_02 (unsigned int a, int b, int c)
27 {
28 mybool r = b == c;
29 return ((a >> 2) | (r << 31));
30 }
31
32 unsigned int
33 test_03 (unsigned int a, int b, int c)
34 {
35 mybool r = b == c;
36 return ((a >> 3) | (r << 31));
37 }
38
39 unsigned int
40 test_04 (unsigned int a, int b, int c)
41 {
42 mybool r = b == c;
43 return ((a >> 4) | (r << 31));
44 }
45
46 unsigned int
47 test_05 (unsigned int a, int b, int c)
48 {
49 mybool r = b == c;
50 return ((a >> 5) | (r << 31));
51 }
52
53 unsigned int
54 test_06 (unsigned int a, int b, int c)
55 {
56 mybool r = b == c;
57 return ((a >> 6) | (r << 31));
58 }
59
60 unsigned int
61 test_07 (unsigned int a, int b, int c)
62 {
63 mybool r = b == c;
64 return ((a >> 7) | (r << 31));
65 }
66
67 unsigned int
68 test_08 (unsigned int a, int b, int c)
69 {
70 mybool r = b == c;
71 return ((a >> 8) | (r << 31));
72 }
73
74 unsigned int
75 test_09 (unsigned int a, int b, int c)
76 {
77 mybool r = b == c;
78 return ((a >> 31) | (r << 31));
79 }
80
81 int
82 test_10 (int a, int b)
83 {
84 mybool r = a == b;
85 return r << 31;
86 }
87
88 unsigned int
89 test_11 (unsigned int a, int b)
90 {
91 /* 1x shlr, 1x rotcr */
92 return (a >> 1) | (b << 31);
93 }
94
95 unsigned int
96 test_12 (unsigned int a, int b)
97 {
98 return (a >> 2) | (b << 31);
99 }
100
101 unsigned int
102 test_13 (unsigned int a, int b)
103 {
104 return (a >> 3) | (b << 31);
105 }
106
107 unsigned int
108 test_14 (unsigned int a, int b)
109 {
110 /* 1x shll, 1x rotcr */
111 mybool r = b < 0;
112 return ((a >> 1) | (r << 31));
113 }
114
115 unsigned int
116 test_15 (unsigned int a, int b, int c)
117 {
118 mybool r = b != c;
119 return ((a >> 1) | (r << 31));
120 }
121
122 unsigned int
123 test_16 (unsigned int a, int b, int c)
124 {
125 mybool r = b != c;
126 return ((a >> 2) | (r << 31));
127 }
128
129 unsigned int
130 test_17 (unsigned int a, int b, int c)
131 {
132 mybool r = b != c;
133 return ((a >> 3) | (r << 31));
134 }
135
136 unsigned int
137 test_18 (unsigned int a, int b, int c)
138 {
139 mybool r = b != c;
140 return ((a >> 4) | (r << 31));
141 }
142
143 unsigned int
144 test_19 (unsigned int a, int b, int c)
145 {
146 mybool r = b != c;
147 return ((a >> 5) | (r << 31));
148 }
149
150 unsigned int
151 test_20 (unsigned int a, int b, int c)
152 {
153 mybool r = b != c;
154 return ((a >> 6) | (r << 31));
155 }
156
157 unsigned int
158 test_21 (unsigned int a, int b, int c)
159 {
160 mybool r = b != c;
161 return ((a >> 7) | (r << 31));
162 }
163
164 unsigned int
165 test_22 (unsigned int a, int b, int c)
166 {
167 mybool r = b != c;
168 return ((a >> 8) | (r << 31));
169 }
170
171 unsigned int
172 test_23 (unsigned int a, int b, int c)
173 {
174 mybool r = b != c;
175 return ((a >> 31) | (r << 31));
176 }
177
178 unsigned int
179 test_24 (unsigned int a)
180 {
181 return (a >> 1) | (1 << 31);
182 }