Remove not needed __builtin_expect due to malloc predictor.
[official-gcc.git] / gcc / testsuite / gcc.target / sh / pr54236-2.c
blob1e2f3bbcb56cb9eda55e15f69ad99ce07bcafd92
1 /* Tests to check the utilization of the addc instruction in special cases.
2 If everything works as expected we won't see any movt instructions in
3 these cases. */
4 /* { dg-do compile } */
5 /* { dg-options "-O1" } */
7 /* { dg-final { scan-assembler-times "addc" 36 } } */
8 /* { dg-final { scan-assembler-times "shll" 14 } } */
9 /* { dg-final { scan-assembler-times "add\tr" 12 } } */
10 /* { dg-final { scan-assembler-not "movt" } } */
12 /* { dg-final { scan-assembler-times "add\t#1" 1 } } */
14 /* { dg-final { scan-assembler-times "mov\t#-2" 1 { target { ! sh2a } } } } */
15 /* { dg-final { scan-assembler-times "and\tr" 1 { target { ! sh2a } } } } */
17 /* { dg-final { scan-assembler-times "bclr\t#0" 1 { target { sh2a } } } } */
19 /* { dg-final { scan-assembler-times "shlr" 22 { target { ! sh2a } } } } */
20 /* { dg-final { scan-assembler-not "shlr" { target { sh2a } } } } */
22 int
23 test_000 (int a, int c, int b, int d)
25 // 1x shlr/bld, 1x addc
26 return a + (b & 1);
29 int
30 test_001 (int a, int c, int b, int d)
32 // 1x shlr/bld, 1x addc
33 return a + b + (c & 1);
36 int
37 test_002 (int a, int c, int b, int d)
39 // 1x shlr/bld, 1x add, 1x addc
40 return a + b + c + (d & 1);
43 int
44 test_003 (int a, int c, int b, int d)
46 // 1x shlr/bld, 1x addc
47 return (b & 1) + a;
50 int
51 test_004 (int a, int c, int b, int d)
53 // 1x shlr/bld, 1x addc
54 return a + (c & 1) + b;
57 int
58 test_005 (int a, int c, int b, int d)
60 // 1x shlr/bld, 1x add, 1x addc
61 return a + b + (d & 1) + c;
64 int
65 test_006 (int a, int c, int b, int d)
67 // 1x shlr/bld, 1x addc
68 return (c & 1) + a + b;
71 int
72 test_007 (int a, int c, int b, int d)
74 // 1x shlr/bld, 1x add, 1x addc
75 return a + (d & 1) + b + c;
78 int
79 test_008 (int a, int c, int b, int d)
81 // 1x shlr/bld, 1x add, 1x addc
82 return (d & 1) + a + b + c;
85 int
86 test_009 (int a, int c, int b, int d)
88 // 1x shlr/bld, 1x addc
89 return a + b + (b & 1);
92 int
93 test_010 (int a, int c, int b, int d)
95 // 1x shlr/bld, 1x addc
96 return a + (b & 1) + b;
99 int
100 test_011 (int a, int c, int b, int d)
102 // 1x shlr/bld, 1x addc
103 return (b & 1) + a + b;
107 test_012 (int a, int c, int b, int d)
109 // 1x shlr/bld, 1x add, 1x addc
110 return a + b + d + (b & 1);
114 test_013 (int a, int c, int b, int d)
116 // 1x shlr/bld, 1x add, 1x addc
117 return a + d + (b & 1) + b;
121 test_014 (int a, int c, int b, int d)
123 // 1x shlr/bld, 1x add, 1x addc
124 return a + (b & 1) + d + b;
128 test_015 (int a, int c, int b, int d)
130 // 1x shlr/bld, 1x add, 1x addc
131 return (b & 1) + a + d + b;
135 test_016 (int a, int b, int c, int d)
137 // non-SH2A: 1x add #1, 1x mov #-2, 1x and
138 // SH2A: 1x add #1, 1x bclr #0
139 return a + (a & 1);
143 test_017 (int a, int b, int c, int d)
145 // 1x shlr/bld, 1x addc
146 return a + a + (a & 1);
150 test_018 (int a, int b, int c, int d)
152 // 1x shlr/bld, 1x addc
153 return a + (a & 1) + a;
157 test_019 (int a, int b, int c, int d)
159 // 1x shlr/bld, 1x addc
160 return (a & 1) + a + a;
164 test_020 (int a, int b, int c, int d)
166 // 1x shlr/bld, 1x addc
167 return b + b + (a & 1);
171 test_021 (int a, int b, int c, int d)
173 // 1x shlr/bld, 1x addc
174 return b + (a & 1) + b;
178 test_022 (int a, int b, int c, int d)
180 // 1x shlr/bld, 1x addc
181 return (a & 1) + b + b;
185 test_023 (int a, int b, int c, int d)
187 // 1x shll, 1x addc
188 return a + ((b >> 31) & 1);
192 test_024 (int a, int b, int c, int d)
194 // 1x shll, 1x addc
195 return ((b >> 31) & 1) + a;
199 test_025 (int a, int b, int c, int d)
201 // 1x shll, 1x addc
202 return ((a >> 31) & 1) + a;
206 test_026 (int a, int b, int c, int d)
208 // 1x shll, 1x addc
209 return a + ((a >> 31) & 1);
213 test_027 (int a, int b, int c, int d)
215 // 1x shll, 1x addc
216 return a + b + ((c >> 31) & 1);
220 test_028 (int a, int b, int c, int d)
222 // 1x shll, 1x addc
223 return a + ((c >> 31) & 1) + b;
227 test_029 (int a, int b, int c, int d)
229 // 1x shll, 1x addc
230 return ((c >> 31) & 1) + a + b;
234 test_030 (int a, int b, int c, int d)
236 // 1x shll, 1x addc, 1x add
237 return a + b + c + ((d >> 31) & 1);
241 test_031 (int a, int b, int c, int d)
243 // 1x shll, 1x addc, 1x add
244 return a + b + ((d >> 31) & 1) + c;
248 test_032 (int a, int b, int c, int d)
250 // 1x shll, 1x addc, 1x add
251 return a + ((d >> 31) & 1) + b + c;
255 test_033 (int a, int b, int c, int d)
257 // 1x shll, 1x addc, 1x add
258 return ((d >> 31) & 1) + a + b + c;
262 test_034 (int a, int b, int c, int d)
264 // 1x shll, 1x addc
265 return a + a + ((d >> 31) & 1);
269 test_035 (int a, int b, int c, int d)
271 // 1x shll, 1x addc
272 return a + ((d >> 31) & 1) + a;
276 test_036 (int a, int b, int c, int d)
278 // 1x shll, 1x addc
279 return ((d >> 31) & 1) + a + a;