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]

Re: [PATCH 6/6] combine: allow combining two insns into two in some cases (PR52714)


On Mon, Dec 01, 2014 at 10:39:58AM -0700, Jeff Law wrote:
> Also OK with a testcase.  I'd recommend just using the one from 52714, 
> make it m68k specific.  Not sure if it's best to scan the assembly or 
> .combine dump -- your call.

Here is the testcase.  I cannot actually test it on an m68k build, should
really do something about that (I build lots of cross compilers but they
cannot run the testsuite).  Does it look okay, can you test it yourself?
[I did of course test the generated asm is indeed okay; just cannot test
the dejagnu stuff].


Segher


2014-12-02  Segher Boessenkool  <segher@kernel.crashing.org>

gcc/testsuite/
	PR rtl-optimization/52714
	* gcc.target/m68k/pr52714.c: New testcase.

---
 gcc/testsuite/gcc.target/m68k/pr52714.c | 33 +++++++++++++++++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/m68k/pr52714.c

diff --git a/gcc/testsuite/gcc.target/m68k/pr52714.c b/gcc/testsuite/gcc.target/m68k/pr52714.c
new file mode 100644
index 0000000..0a52a1d
--- /dev/null
+++ b/gcc/testsuite/gcc.target/m68k/pr52714.c
@@ -0,0 +1,33 @@
+/* PR rtl-optimization/52714
+
+   Check that combine manages to remove the "stack == 0" test.
+   Without ICEing.  */
+
+/* { dg-do compile } */
+/* { dg-options "-O1" } */
+
+int __re_compile_fastmap(unsigned char *p)
+{
+    unsigned char **stack;
+    unsigned size;
+    unsigned avail;
+
+    stack = __builtin_alloca(5 * sizeof(unsigned char*));
+    if (stack == 0)
+	return -2;
+    size = 5;
+    avail = 0;
+
+    for (;;) {
+	switch (*p++) {
+	case 0:
+	    if (avail == size)
+		return -2;
+	    stack[avail++] = p;
+	}
+    }
+
+    return 0;
+}
+
+/* { dg-final { scan-assembler-not {\mtst\.l %sp\M} } } */
-- 
1.8.1.4


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