This is the mail archive of the gcc-patches@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Simplify gcc.target/mips/fuse-caller-save*.c


Richard,

during testing the gcc.target/mips/fuse-caller-save*.c test-cases with more combinations of -march, -mabi, -fpic etc, I found that the checks for amount of stores are rather fragile, so I removed them in this patch.

The remaining checks check for absence of $16. To address the risk that $16 is absent for another reason than -fuse-caller-save, I've added 3 corresponding test-cases that check for presence of $16 with -fno-use-caller-save.

The fuse-caller-save tests now pass for all combinations I've tried. OK for trunk?

Thanks,
- Tom
2014-07-09  Tom de Vries  <tom@codesourcery.com>

	* gcc.target/mips/fuse-caller-save.c: Remove test on number of stores.
	* gcc.target/mips/fuse-caller-save-mips16.c: Same.
	* gcc.target/mips/fuse-caller-save-micromips.c: Same.
	* gcc.target/mips/fuse-caller-save-neg.c: New test.
	* gcc.target/mips/fuse-caller-save-mips16-neg.c: Same.
	* gcc.target/mips/fuse-caller-save-micromips-neg.c: Same.

diff --git a/gcc/testsuite/gcc.target/mips/fuse-caller-save-micromips-neg.c b/gcc/testsuite/gcc.target/mips/fuse-caller-save-micromips-neg.c
new file mode 100644
index 0000000..9d43be9
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/fuse-caller-save-micromips-neg.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-fno-use-caller-save (-mmicromips)" } */
+/* At -O0 and -O1, the register allocator behaves more conservatively, and
+   the fuse-caller-save optimization doesnt' trigger.  */
+/* { dg-skip-if "" { *-*-* }  { "-O0" "-O1" } } */
+/* Testing -fuse-caller-save optimization option.  */
+
+#define ATTRIBUTE MICROMIPS
+#include "fuse-caller-save.h"
+
+/* Check that the first caller-save register is used.  This is to make sure that
+   test fuse-caller-save-mips16 tests something meaningful.  */
+/* { dg-final { scan-assembler "\\\$16" } } */
diff --git a/gcc/testsuite/gcc.target/mips/fuse-caller-save-micromips.c b/gcc/testsuite/gcc.target/mips/fuse-caller-save-micromips.c
index 6ad01c7..bb70890 100644
--- a/gcc/testsuite/gcc.target/mips/fuse-caller-save-micromips.c
+++ b/gcc/testsuite/gcc.target/mips/fuse-caller-save-micromips.c
@@ -8,10 +8,5 @@
 #define ATTRIBUTE MICROMIPS
 #include "fuse-caller-save.h"
 
-/* Check that there are only 2 stack-saves: r31 in main and foo.  */
-
-/* Check that there only 2 sw/sd.  */
-/* { dg-final { scan-assembler-times "(?n)s\[wd\]\t\\\$.*,.*\\(\\\$sp\\)" 2 } } */
-
 /* Check that the first caller-save register is unused.  */
 /* { dg-final { scan-assembler-not "\\\$16" } } */
diff --git a/gcc/testsuite/gcc.target/mips/fuse-caller-save-mips16-neg.c b/gcc/testsuite/gcc.target/mips/fuse-caller-save-mips16-neg.c
new file mode 100644
index 0000000..cb6360b
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/fuse-caller-save-mips16-neg.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-fno-use-caller-save (-mips16)" } */
+/* At -O0 and -O1, the register allocator behaves more conservatively, and
+   the fuse-caller-save optimization doesnt' trigger.  */
+/* { dg-skip-if "" { *-*-* }  { "-O0" "-O1" } } */
+/* Testing -fuse-caller-save optimization option.  */
+
+#define ATTRIBUTE MIPS16
+#include "fuse-caller-save.h"
+
+/* Check that the first caller-save register is used.  This is to make sure that
+   test fuse-caller-save-mips16 tests something meaningful.  */
+/* { dg-final { scan-assembler "\\\$16" } } */
diff --git a/gcc/testsuite/gcc.target/mips/fuse-caller-save-mips16.c b/gcc/testsuite/gcc.target/mips/fuse-caller-save-mips16.c
index a7c6cf4..62b33a7 100644
--- a/gcc/testsuite/gcc.target/mips/fuse-caller-save-mips16.c
+++ b/gcc/testsuite/gcc.target/mips/fuse-caller-save-mips16.c
@@ -8,10 +8,5 @@
 #define ATTRIBUTE MIPS16
 #include "fuse-caller-save.h"
 
-/* Check that there are only 2 stack-saves: r31 in main and foo.  */
-
-/* Check that there only 2 sw/sd.  */
-/* { dg-final { scan-assembler-times "(?n)s\[wd\]\t\\\$.*,.*\\(\\\$sp\\)" 2 } } */
-
 /* Check that the first caller-save register is unused.  */
 /* { dg-final { scan-assembler-not "\\\$16" } } */
diff --git a/gcc/testsuite/gcc.target/mips/fuse-caller-save-neg.c b/gcc/testsuite/gcc.target/mips/fuse-caller-save-neg.c
new file mode 100644
index 0000000..3de0168
--- /dev/null
+++ b/gcc/testsuite/gcc.target/mips/fuse-caller-save-neg.c
@@ -0,0 +1,13 @@
+/* { dg-do compile } */
+/* { dg-options "-fno-use-caller-save" } */
+/* At -O0 and -O1, the register allocator behaves more conservatively, and
+   the fuse-caller-save optimization doesnt' trigger.  */
+/* { dg-skip-if "" { *-*-* }  { "-O0" "-O1" } } */
+/* Testing -fuse-caller-save optimization option.  */
+
+#define ATTRIBUTE NOCOMPRESSION
+#include "fuse-caller-save.h"
+
+/* Check that the first caller-save register is used.  This is to make sure that
+   test fuse-caller-save-mips16 tests something meaningful.  */
+/* { dg-final { scan-assembler "\\\$16" } } */
diff --git a/gcc/testsuite/gcc.target/mips/fuse-caller-save.c b/gcc/testsuite/gcc.target/mips/fuse-caller-save.c
index 72c08fe..a0267f0 100644
--- a/gcc/testsuite/gcc.target/mips/fuse-caller-save.c
+++ b/gcc/testsuite/gcc.target/mips/fuse-caller-save.c
@@ -10,8 +10,5 @@
 
 /* Check that there are only 2 stack-saves: r31 in main and foo.  */
 
-/* Check that there only 2 sw/sd.  */
-/* { dg-final { scan-assembler-times "(?n)s\[wd\]\t\\\$.*,.*\\(\\\$sp\\)" 2 } } */
-
 /* Check that the first caller-save register is unused.  */
 /* { dg-final { scan-assembler-not "\\\$16" } } */
-- 
1.9.1


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]