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" } } */
24 test_00 (int x
, int y
)
33 test_01 (int x
, int y
)
42 test_02 (int x
, int y
)
51 test_03 (int x
, int y
)
60 test_04 (int x
, int y
)
62 /* 1x cmp/eq, 1x addc */
69 test_05 (int x
, int y
)
71 /* 1x cmp/gt, 1x subc */
80 /* 1x cmp/pl, 1x addc */
81 return x
> 0 ? x
+ 1 : x
;
87 /* 1x cmp/pl, 1x subc */
88 return x
> 0 ? x
- 1 : x
;