Merge aosp-toolchain/gcc/gcc-4_9 changes.
[official-gcc.git] / gcc-4_9 / gcc / testsuite / gcc.target / sh / pr54236-2.c
blobb3cf48c9d32e3c5533cb5007ad35315966ee8130
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" } */
6 /* { dg-skip-if "" { "sh*-*-*" } { "-m5*"} { "" } } */
7 /* { dg-final { scan-assembler-times "addc" 37 } } */
8 /* { dg-final { scan-assembler-times "shlr" 23 } } */
9 /* { dg-final { scan-assembler-times "shll" 14 } } */
10 /* { dg-final { scan-assembler-times "add\t" 12 } } */
11 /* { dg-final { scan-assembler-not "movt" } } */
13 int
14 test_000 (int a, int c, int b, int d)
16 // 1x shlr, 1x addc
17 return a + (b & 1);
20 int
21 test_001 (int a, int c, int b, int d)
23 // 1x shlr, 1x addc
24 return a + b + (c & 1);
27 int
28 test_002 (int a, int c, int b, int d)
30 // 1x shlr, 1x add, 1x addc
31 return a + b + c + (d & 1);
34 int
35 test_003 (int a, int c, int b, int d)
37 // 1x shlr, 1x addc
38 return (b & 1) + a;
41 int
42 test_004 (int a, int c, int b, int d)
44 // 1x shlr, 1x addc
45 return a + (c & 1) + b;
48 int
49 test_005 (int a, int c, int b, int d)
51 // 1x shlr, 1x add, 1x addc
52 return a + b + (d & 1) + c;
55 int
56 test_006 (int a, int c, int b, int d)
58 // 1x shlr, 1x addc
59 return (c & 1) + a + b;
62 int
63 test_007 (int a, int c, int b, int d)
65 // 1x shlr, 1x add, 1x addc
66 return a + (d & 1) + b + c;
69 int
70 test_008 (int a, int c, int b, int d)
72 // 1x shlr, 1x add, 1x addc
73 return (d & 1) + a + b + c;
76 int
77 test_009 (int a, int c, int b, int d)
79 // 1x shlr, 1x addc
80 return a + b + (b & 1);
83 int
84 test_010 (int a, int c, int b, int d)
86 // 1x shlr, 1x addc
87 return a + (b & 1) + b;
90 int
91 test_011 (int a, int c, int b, int d)
93 // 1x shlr, 1x addc
94 return (b & 1) + a + b;
97 int
98 test_012 (int a, int c, int b, int d)
100 // 1x shlr, 1x add, 1x addc
101 return a + b + d + (b & 1);
105 test_013 (int a, int c, int b, int d)
107 // 1x shlr, 1x add, 1x addc
108 return a + d + (b & 1) + b;
112 test_014 (int a, int c, int b, int d)
114 // 1x shlr, 1x add, 1x addc
115 return a + (b & 1) + d + b;
119 test_015 (int a, int c, int b, int d)
121 // 1x shlr, 1x add, 1x addc
122 return (b & 1) + a + d + b;
126 test_016 (int a, int b, int c, int d)
128 // 1x shlr, 1x addc
129 return a + (a & 1);
133 test_017 (int a, int b, int c, int d)
135 // 1x shlr, 1x addc
136 return a + a + (a & 1);
140 test_018 (int a, int b, int c, int d)
142 // 1x shlr, 1x addc
143 return a + (a & 1) + a;
147 test_019 (int a, int b, int c, int d)
149 // 1x shlr, 1x addc
150 return (a & 1) + a + a;
154 test_020 (int a, int b, int c, int d)
156 // 1x shlr, 1x addc
157 return b + b + (a & 1);
161 test_021 (int a, int b, int c, int d)
163 // 1x shlr, 1x addc
164 return b + (a & 1) + b;
168 test_022 (int a, int b, int c, int d)
170 // 1x shlr, 1x addc
171 return (a & 1) + b + b;
175 test_023 (int a, int b, int c, int d)
177 // 1x shll, 1x addc
178 return a + ((b >> 31) & 1);
182 test_024 (int a, int b, int c, int d)
184 // 1x shll, 1x addc
185 return ((b >> 31) & 1) + a;
189 test_025 (int a, int b, int c, int d)
191 // 1x shll, 1x addc
192 return ((a >> 31) & 1) + a;
196 test_026 (int a, int b, int c, int d)
198 // 1x shll, 1x addc
199 return a + ((a >> 31) & 1);
203 test_027 (int a, int b, int c, int d)
205 // 1x shll, 1x addc
206 return a + b + ((c >> 31) & 1);
210 test_028 (int a, int b, int c, int d)
212 // 1x shll, 1x addc
213 return a + ((c >> 31) & 1) + b;
217 test_029 (int a, int b, int c, int d)
219 // 1x shll, 1x addc
220 return ((c >> 31) & 1) + a + b;
224 test_030 (int a, int b, int c, int d)
226 // 1x shll, 1x addc, 1x add
227 return a + b + c + ((d >> 31) & 1);
231 test_031 (int a, int b, int c, int d)
233 // 1x shll, 1x addc, 1x add
234 return a + b + ((d >> 31) & 1) + c;
238 test_032 (int a, int b, int c, int d)
240 // 1x shll, 1x addc, 1x add
241 return a + ((d >> 31) & 1) + b + c;
245 test_033 (int a, int b, int c, int d)
247 // 1x shll, 1x addc, 1x add
248 return ((d >> 31) & 1) + a + b + c;
252 test_034 (int a, int b, int c, int d)
254 // 1x shll, 1x addc
255 return a + a + ((d >> 31) & 1);
259 test_035 (int a, int b, int c, int d)
261 // 1x shll, 1x addc
262 return a + ((d >> 31) & 1) + a;
266 test_036 (int a, int b, int c, int d)
268 // 1x shll, 1x addc
269 return ((d >> 31) & 1) + a + a;