1 /* Tests to check the utilization of addc, subc and negc instructions in
2 special cases. If everything works as expected we won't see any
3 movt instructions in these cases. */
4 /* { dg-do compile } */
5 /* { dg-options "-O2" } */
7 /* { dg-final { scan-assembler-times "addc" 6 } } */
8 /* { dg-final { scan-assembler-times "subc" 4 } } */
9 /* { dg-final { scan-assembler-times "sett" 5 } } */
11 /* { dg-final { scan-assembler-times "negc" 2 { target { ! sh2a } } } } */
12 /* { dg-final { scan-assembler-not "movt" { target { ! sh2a } } } } */
14 /* { dg-final { scan-assembler-times "bld" 1 { target { sh2a } } } } */
15 /* { dg-final { scan-assembler-times "movt" 1 { target { sh2a } } } } */
18 test_00 (int a
, int b
, int c
, int d
)
20 /* 1x addc, 1x sett */
25 test_01 (int a
, int b
, int c
, int d
)
32 test_02 (int a
, int b
, int c
, int d
)
34 /* 1x subc, 1x sett */
39 test_03 (int a
, int b
, int c
, int d
)
46 test_04 (int a
, int b
, int c
, int d
)
48 /* 1x addc, 1x sett */
53 test_05 (int a
, int b
, int c
, int d
)
55 /* 1x subc, 1x sett */
60 test_06 (int a
, int b
, int c
, int d
)
63 return 0 - a
- (b
== c
);
69 /* Must not see a 'sett' or 'addc' here.
70 This is a case where combine tries to produce
71 'a + (0 - b) + 1' out of 'a - b + 1'.
72 On non-SH2A there is a 'tst + negc', on SH2A a 'bld + movt'. */
77 if (zi
!= 0 && z
< -1)
78 vi
-= (((vi
>> 7) & 0x01) << 1) - 1;
86 /* 1x addc, 1x sett */
91 test_09 (unsigned int x
)
98 test_10 (unsigned int x
)
100 /* 1x tst, 1x subc */
105 test_11 (unsigned int x
)
107 /* 1x tst, 1x addc */