Merge from trunk
[official-gcc.git] / gcc / testsuite / gcc.target / sh / pr53976-1.c
blob4893b0668a5ec1f0a27ac7609d20f18d7d3c9997
1 /* Check that the SH specific sh_optimize_sett_clrt RTL optimization pass
2 works as expected. */
3 /* { dg-do compile } */
4 /* { dg-options "-O2" } */
5 /* { dg-skip-if "" { "sh*-*-*" } { "-m5*" } { "" } } */
6 /* { dg-final { scan-assembler-times "clrt" 2 } } */
7 /* { dg-final { scan-assembler-times "sett" 1 } } */
9 long long
10 test_00 (long long a, long long b, long long c, int d)
12 /* One of the blocks should have a clrt and the other one should not. */
13 if (d > 5)
14 return a + b;
15 else
16 return a + c;
19 long long
20 test_01 (long long a, long long b)
22 /* Must see a clrt because T bit is undefined at function entry. */
23 return a + b;
26 int
27 test_02 (const char* a)
29 /* Must not see a sett after the inlined strlen. */
30 return __builtin_strlen (a);
33 int
34 test_03 (int a, int b, int c, int d)
36 /* One of the blocks should have a sett and the other one should not. */
37 if (d > 4)
38 return a + b + 1;
39 else
40 return a + c + 1;