2018-02-09 Sebastian Perta <sebastian.perta@renesas.com>
[official-gcc.git] / gcc / testsuite / gcc.target / sh / pr54236-5.c
blob082b4f0bd3e610c4b567b26d348bb6bbf1a281f5
1 /* Check that addc and subc instructions are generated as expected in
2 combination with ifcvt. */
3 /* { dg-do compile } */
4 /* { dg-options "-O2" } */
6 /* { dg-final { scan-assembler-times "subc" 4 { target { ! sh2a } } } } */
7 /* { dg-final { scan-assembler-times "addc" 4 { target { ! sh2a } } } } */
8 /* { dg-final { scan-assembler-times "not\t" 0 { target { ! sh2a } } } } */
10 /* { dg-final { scan-assembler-times "subc" 4 { target { sh2a } } } } */
11 /* { dg-final { scan-assembler-times "addc" 4 { target { sh2a } } } } */
12 /* { dg-final { scan-assembler-times "nott" 0 { target { sh2a } } } } */
14 /* { dg-final { scan-assembler-times "tst\t" 4 } } */
15 /* { dg-final { scan-assembler-times "cmp/eq" 1 } } */
16 /* { dg-final { scan-assembler-times "cmp/pl" 2 } } */
17 /* { dg-final { scan-assembler-times "cmp/gt" 1 } } */
19 /* { dg-final { scan-assembler-not "movt" } } */
20 /* { dg-final { scan-assembler-not "negc" } } */
21 /* { dg-final { scan-assembler-not "movrt" } } */
23 int
24 test_00 (int x, int y)
26 /* 1x tst, 1x subc */
27 if (y)
28 ++x;
29 return x;
32 int
33 test_01 (int x, int y)
35 /* 1x tst, 1x addc */
36 if (y)
37 --x;
38 return x;
41 int
42 test_02 (int x, int y)
44 /* 1x tst, 1x addc */
45 if (!y)
46 ++x;
47 return x;
50 int
51 test_03 (int x, int y)
53 /* 1x tst, 1x subc */
54 if (!y)
55 --x;
56 return x;
59 int
60 test_04 (int x, int y)
62 /* 1x cmp/eq, 1x addc */
63 if (y == x)
64 ++x;
65 return x;
68 int
69 test_05 (int x, int y)
71 /* 1x cmp/gt, 1x subc */
72 if (y < 4)
73 ++x;
74 return x;
77 int
78 test_06 (int x)
80 /* 1x cmp/pl, 1x addc */
81 return x > 0 ? x + 1 : x;
84 int
85 test_07 (int x)
87 /* 1x cmp/pl, 1x subc */
88 return x > 0 ? x - 1 : x;