Hi,
This adds some more addc/subc tests which are now working after the
treg_set_expr patch.
Tested with make -k check-gcc RUNTESTFLAGS="sh.exp=pr54236*
--target_board=sh-sim
\{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"
Committed as r220093.
Cheers,
Oleg
gcc/testsuite/ChangeLog:
PR target/54236
* gcc.target/sh/pr54236-4.c: New.
Index: gcc/testsuite/gcc.target/sh/pr54236-4.c
===================================================================
--- gcc/testsuite/gcc.target/sh/pr54236-4.c (revision 0)
+++ gcc/testsuite/gcc.target/sh/pr54236-4.c (revision 0)
@@ -0,0 +1,70 @@
+/* Check that addc and subc patterns are converted if the T value is
+ inverted. */
+/* { dg-do compile } */
+/* { dg-options "-O2" } */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m5*"} { "" } } */
+/* { dg-final { scan-assembler-times "cmp/eq" 7 } } */
+
+/* { dg-final { scan-assembler-times "subc" 5 { target { ! sh2a } } } } */
+/* { dg-final { scan-assembler-times "not\t" 3 { target { ! sh2a } } } } */
+/* { dg-final { scan-assembler-times "addc" 2 { target { ! sh2a } } } } */
+
+/* { dg-final { scan-assembler-times "subc" 2 { target { sh2a } } } } */
+/* { dg-final { scan-assembler-times "addc" 5 { target { sh2a } } } } */
+/* { dg-final { scan-assembler-times "nott" 3 { target { sh2a } } } } */
+
+/* { dg-final { scan-assembler-not "movt" } } */
+/* { dg-final { scan-assembler-not "negc" } } */
+/* { dg-final { scan-assembler-not "movrt" } } */
+
+int
+test_0 (int a, int b, int c)
+{
+ /* 1x cmp/eq, 1x subc */
+ return c + (a != b);
+}
+
+int
+test_1 (int a, int b, int c, int d)
+{
+ /* 1x cmp/eq, 1x not, 1x subc
+ SH2A: 1x cmp/eq, 1x nott, 1x addc */
+ return (a != b) + c + d;
+}
+
+int
+test_2 (int a, int b, int c, int d)
+{
+ /* 1x cmp/eq, 1x not, 1x subc
+ SH2A: 1x cmp/eq, 1x nott, 1x addc */
+ return c + (a != b) + d;
+}
+
+int
+test_3 (int a, int b, int c, int d)
+{
+ /* 1x cmp/eq, 1x not, 1x subc
+ SH2A: 1x cmp/eq, 1x nott, 1x addc */
+ return c + d + (a != b);
+}
+
+int
+test_4 (int a, int b, int c, int d)
+{
+ /* 1x cmp/eq, 1x subc */
+ return (a != b) - c;
+}
+
+int
+test_5 (int a, int b, int c, int d)
+{
+ /* 1x cmp/eq, 1x add #-1, 1x addc */
+ return c - (a != b);
+}
+
+int
+test_6 (int a, int b, int c, int d)
+{
+ /* 1x cmp/eq, 1x add #-1, 1x addc */
+ return c - (a != b) + d;
+}