diff mbox

[SH] PR 50749 - Auto-inc-dec does not find subsequent contiguous mem accesses

Message ID 1339452336.2157.11.camel@yam-132-YW-E178-FTW
State New
Headers show

Commit Message

Oleg Endo June 11, 2012, 10:05 p.m. UTC
Hello,

I'd like to add the attached SH test cases to verify the auto-inc-dec
pass operation on the SH target.
Checked by invoking the individual test cases manually with make
check-gcc on sh-sim.  Some of the tests pass, some of them don't because
of the auto-inc-dec issues mentioned in the PR.

Cheers,
Oleg

testsuite/ChangeLog:

	PR target/50749
	* gcc.target/sh/pr50749-sf-postinc-2.c: New.
	* gcc.target/sh/pr50749-sf-postinc-4.c: New.
	* gcc.target/sh/pr50749-qihisi-postinc-2.c: New.
	* gcc.target/sh/pr50749-qihisi-postinc-4.c: New.
	* gcc.target/sh/pr50749-sf-predec-2.c: New.
	* gcc.target/sh/pr50749-sf-predec-4.c: New.
	* gcc.target/sh/pr50749-qihisi-predec-1.c: New.
	* gcc.target/sh/pr50749-qihisi-predec-3.c: New.
	* gcc.target/sh/pr50749-sf-postinc-1.c: New.
	* gcc.target/sh/pr50749-sf-postinc-3.c: New.
	* gcc.target/sh/pr50749-qihisi-postinc-1.c: New.
	* gcc.target/sh/pr50749-qihisi-postinc-3.c: New.
	* gcc.target/sh/pr50749-sf-predec-1.c: New.
	* gcc.target/sh/pr50749-sf-predec-3.c: New.
	* gcc.target/sh/pr50749-qihisi-predec-2.c: New.
	* gcc.target/sh/pr50749-qihisi-predec-4.c: New.

Comments

Kaz Kojima June 12, 2012, 12:40 a.m. UTC | #1
Oleg Endo <oleg.endo@t-online.de> wrote:
>  Some of the tests pass, some of them don't because
> of the auto-inc-dec issues mentioned in the PR.

I thought that the tests which are known to fail are marked
with XFAIL, though I'm not sure the usual way for the failing
test cases.

Regards,
	kaz
Hans-Peter Nilsson June 12, 2012, 1:19 a.m. UTC | #2
On Tue, 12 Jun 2012, Kaz Kojima wrote:
> Oleg Endo <oleg.endo@t-online.de> wrote:
> >  Some of the tests pass, some of them don't because
> > of the auto-inc-dec issues mentioned in the PR.
>
> I thought that the tests which are known to fail are marked
> with XFAIL,

Yes, with a clear reference to the PR at the xfail.
The closest thing to a written rule for this seems to be
<http://gcc.gnu.org/wiki/HowToPrepareATestcase>.

brgds, H-P
Kaz Kojima June 12, 2012, 1:33 a.m. UTC | #3
Hans-Peter Nilsson <hp@bitrange.com> wrote:
> On Tue, 12 Jun 2012, Kaz Kojima wrote:
> > Oleg Endo <oleg.endo@t-online.de> wrote:
> > >  Some of the tests pass, some of them don't because
> > > of the auto-inc-dec issues mentioned in the PR.
> >
> > I thought that the tests which are known to fail are marked
> > with XFAIL,
> 
> Yes, with a clear reference to the PR at the xfail.
> The closest thing to a written rule for this seems to be
> <http://gcc.gnu.org/wiki/HowToPrepareATestcase>.

Thanks for clarification!

Oleg, the patch is OK with that change.

Regards,
	kaz
diff mbox

Patch

Index: gcc/testsuite/gcc.target/sh/pr50749-qihisi-predec-4.c
===================================================================
--- gcc/testsuite/gcc.target/sh/pr50749-qihisi-predec-4.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/pr50749-qihisi-predec-4.c	(revision 0)
@@ -0,0 +1,43 @@ 
+/* Verify that pre-decrement addressing is generated inside a loop.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "mov.b\tr\[0-9]\+,@-r\[0-9]\+" 3 } } */
+/* { dg-final { scan-assembler-times "mov.w\tr\[0-9]\+,@-r\[0-9]\+" 3 } } */
+/* { dg-final { scan-assembler-times "mov.l\tr\[0-9]\+,@-r\[0-9]\+" 3 } } */
+
+char*
+test_func_00 (char* p, int c, int x)
+{
+  do
+  {
+    *--p = (char)x;
+    *--p = (char)x;
+    *--p = (char)x;
+  } while (--c);
+  return p;
+}
+
+short*
+test_func_01 (short* p, int c, int x)
+{
+  do
+  {
+    *--p = (short)x;
+    *--p = (short)x;
+    *--p = (short)x;
+  } while (--c);
+  return p;
+}
+
+int*
+test_func_02 (int* p, int c, int x)
+{
+  do
+  {
+    *--p = x;
+    *--p = x;
+    *--p = x;
+  } while (--c);
+  return p;
+}
+
Index: gcc/testsuite/gcc.target/sh/pr50749-sf-postinc-1.c
===================================================================
--- gcc/testsuite/gcc.target/sh/pr50749-sf-postinc-1.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/pr50749-sf-postinc-1.c	(revision 0)
@@ -0,0 +1,15 @@ 
+/* Verify that post-increment addressing is generated.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2*" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } }  */
+/* { dg-final { scan-assembler-times "fmov.s\t@r\[0-9]\+\\+,fr\[0-9]\+" 1 } } */
+
+float*
+test_func_00 (float* p, float* x)
+{
+  float r = 0;
+  r += *p++;
+  *x = r;
+  return p;
+}
+
Index: gcc/testsuite/gcc.target/sh/pr50749-sf-postinc-3.c
===================================================================
--- gcc/testsuite/gcc.target/sh/pr50749-sf-postinc-3.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/pr50749-sf-postinc-3.c	(revision 0)
@@ -0,0 +1,17 @@ 
+/* Verify that post-increment addressing is generated inside a loop.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2*" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } }  */
+/* { dg-final { scan-assembler-times "fmov.s\t@r\[0-9]\+\\+,fr\[0-9]\+" 1 } } */
+
+float
+test_func_00 (float* p, int c)
+{
+  float r = 0;
+  do
+  {
+    r += *p++;
+  } while (--c);
+  return r;
+}
+
Index: gcc/testsuite/gcc.target/sh/pr50749-qihisi-postinc-1.c
===================================================================
--- gcc/testsuite/gcc.target/sh/pr50749-qihisi-postinc-1.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/pr50749-qihisi-postinc-1.c	(revision 0)
@@ -0,0 +1,34 @@ 
+/* Verify that post-increment addressing is generated.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "mov.b\t@r\[0-9]\+\\+,r\[0-9]\+" 1 } } */
+/* { dg-final { scan-assembler-times "mov.w\t@r\[0-9]\+\\+,r\[0-9]\+" 1 } } */
+/* { dg-final { scan-assembler-times "mov.l\t@r\[0-9]\+\\+,r\[0-9]\+" 1 } } */
+
+char*
+test_func_00 (char* p, int* x)
+{
+  int r = 0;
+  r += *p++;
+  *x = r;
+  return p;
+}
+
+short*
+test_func_01 (short* p, int* x)
+{
+  int r = 0;
+  r += *p++;
+  *x = r;
+  return p;
+}
+
+int*
+test_func_02 (int* p, int* x)
+{
+  int r = 0;
+  r += *p++;
+  *x = r;
+  return p;
+}
+
Index: gcc/testsuite/gcc.target/sh/pr50749-qihisi-postinc-3.c
===================================================================
--- gcc/testsuite/gcc.target/sh/pr50749-qihisi-postinc-3.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/pr50749-qihisi-postinc-3.c	(revision 0)
@@ -0,0 +1,40 @@ 
+/* Verify that post-increment addressing is generated inside a loop.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "mov.b\t@r\[0-9]\+\\+,r\[0-9]\+" 1 } } */
+/* { dg-final { scan-assembler-times "mov.w\t@r\[0-9]\+\\+,r\[0-9]\+" 1 } } */
+/* { dg-final { scan-assembler-times "mov.l\t@r\[0-9]\+\\+,r\[0-9]\+" 1 } } */
+
+int
+test_func_00 (char* p, int c)
+{
+  int r = 0;
+  do
+  {
+    r += *p++;
+  } while (--c);
+  return r;
+}
+
+int
+test_func_01 (short* p, int c)
+{
+  int r = 0;
+  do
+  {
+    r += *p++;
+  } while (--c);
+  return r;
+}
+
+int
+test_func_02 (int* p, int c)
+{
+  int r = 0;
+  do
+  {
+    r += *p++;
+  } while (--c);
+  return r;
+}
+
Index: gcc/testsuite/gcc.target/sh/pr50749-sf-predec-2.c
===================================================================
--- gcc/testsuite/gcc.target/sh/pr50749-sf-predec-2.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/pr50749-sf-predec-2.c	(revision 0)
@@ -0,0 +1,23 @@ 
+/* Verify that subsequent pre-decrement addressings are generated.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2*" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } }  */
+/* { dg-final { scan-assembler-times "fmov.s\tfr\[0-9]\+,@-r\[0-9]\+" 5 } } */
+
+float*
+test_func_00 (float* p, float c)
+{
+  *--p = c;
+  *--p = c;
+  return p;
+}
+
+float*
+test_func_01 (float* p, float c)
+{
+  *--p = c;
+  *--p = c;
+  *--p = c;
+  return p;
+}
+
Index: gcc/testsuite/gcc.target/sh/pr50749-sf-predec-4.c
===================================================================
--- gcc/testsuite/gcc.target/sh/pr50749-sf-predec-4.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/pr50749-sf-predec-4.c	(revision 0)
@@ -0,0 +1,18 @@ 
+/* Verify that pre-decrement addressing is generated inside a loop.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2*" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } }  */
+/* { dg-final { scan-assembler-times "fmov.s\tfr\[0-9]\+,@-r\[0-9]\+" 3 } } */
+
+float*
+test_func_00 (float* p, int c, float x)
+{
+  do
+  {
+    *--p = x;
+    *--p = x;
+    *--p = x;
+  } while (--c);
+  return p;
+}
+
Index: gcc/testsuite/gcc.target/sh/pr50749-qihisi-predec-1.c
===================================================================
--- gcc/testsuite/gcc.target/sh/pr50749-qihisi-predec-1.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/pr50749-qihisi-predec-1.c	(revision 0)
@@ -0,0 +1,28 @@ 
+/* Verify that pre-decrement addressing is generated.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "mov.b\tr\[0-9]\+,@-r\[0-9]\+" 1 } } */
+/* { dg-final { scan-assembler-times "mov.w\tr\[0-9]\+,@-r\[0-9]\+" 1 } } */
+/* { dg-final { scan-assembler-times "mov.l\tr\[0-9]\+,@-r\[0-9]\+" 1 } } */
+
+char*
+test_func_00 (char* p, int c)
+{
+  *--p = (char)c;
+  return p;
+}
+
+short*
+test_func_01 (short* p, int c)
+{
+  *--p = (short)c;
+  return p;
+}
+
+int*
+test_func_02 (int* p, int c)
+{
+  *--p = c;
+  return p;
+}
+
Index: gcc/testsuite/gcc.target/sh/pr50749-qihisi-predec-3.c
===================================================================
--- gcc/testsuite/gcc.target/sh/pr50749-qihisi-predec-3.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/pr50749-qihisi-predec-3.c	(revision 0)
@@ -0,0 +1,37 @@ 
+/* Verify that pre-decrement addressing is generated inside a loop.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "mov.b\tr\[0-9]\+,@-r\[0-9]\+" 1 } } */
+/* { dg-final { scan-assembler-times "mov.w\tr\[0-9]\+,@-r\[0-9]\+" 1 } } */
+/* { dg-final { scan-assembler-times "mov.l\tr\[0-9]\+,@-r\[0-9]\+" 1 } } */
+
+char*
+test_func_00 (char* p, int c, int x)
+{
+  do
+  {
+    *--p = (char)x;
+  } while (--c);
+  return p;
+}
+
+short*
+test_func_01 (short* p, int c, int x)
+{
+  do
+  {
+    *--p = (short)x;
+  } while (--c);
+  return p;
+}
+
+int*
+test_func_02 (int* p, int c, int x)
+{
+  do
+  {
+    *--p = x;
+  } while (--c);
+  return p;
+}
+
Index: gcc/testsuite/gcc.target/sh/pr50749-sf-postinc-2.c
===================================================================
--- gcc/testsuite/gcc.target/sh/pr50749-sf-postinc-2.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/pr50749-sf-postinc-2.c	(revision 0)
@@ -0,0 +1,27 @@ 
+/* Verify that subsequent post-increment addressings are generated.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2*" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } }  */
+/* { dg-final { scan-assembler-times "fmov.s\t@r\[0-9]\+\\+,fr\[0-9]\+" 5 } } */
+
+float*
+test_func_00 (float* p, float* x)
+{
+  float r = 0;
+  r += *p++;
+  r += *p++;
+  *x = r;
+  return p;
+}
+
+float*
+test_func_01 (float* p, float* x)
+{
+  float r = 0;
+  r += *p++;
+  r += *p++;
+  r += *p++;
+  *x = r;
+  return p;
+}
+
Index: gcc/testsuite/gcc.target/sh/pr50749-sf-postinc-4.c
===================================================================
--- gcc/testsuite/gcc.target/sh/pr50749-sf-postinc-4.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/pr50749-sf-postinc-4.c	(revision 0)
@@ -0,0 +1,19 @@ 
+/* Verify that post-increment addressing is generated inside a loop.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2*" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } }  */
+/* { dg-final { scan-assembler-times "fmov.s\t@r\[0-9]\+\\+,fr\[0-9]\+" 3 } } */
+
+float
+test_func_00 (float* p, int c)
+{
+  float r = 0;
+  do
+  {
+    r += *p++;
+    r += *p++;
+    r += *p++;
+  } while (--c);
+  return r;
+}
+
Index: gcc/testsuite/gcc.target/sh/pr50749-qihisi-postinc-2.c
===================================================================
--- gcc/testsuite/gcc.target/sh/pr50749-qihisi-postinc-2.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/pr50749-qihisi-postinc-2.c	(revision 0)
@@ -0,0 +1,70 @@ 
+/* Verify that subsequent post-increment addressings are generated.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "mov.b\t@r\[0-9]\+\\+,r\[0-9]\+" 5 } } */
+/* { dg-final { scan-assembler-times "mov.w\t@r\[0-9]\+\\+,r\[0-9]\+" 5 } } */
+/* { dg-final { scan-assembler-times "mov.l\t@r\[0-9]\+\\+,r\[0-9]\+" 5 } } */
+
+char*
+test_func_00 (char* p, int* x)
+{
+  int r = 0;
+  r += *p++;
+  r += *p++;
+  *x = r;
+  return p;
+}
+
+char*
+test_func_01 (char* p, int* x)
+{
+  int r = 0;
+  r += *p++;
+  r += *p++;
+  r += *p++;
+  *x = r;
+  return p;
+}
+
+short*
+test_func_02 (short* p, int* x)
+{
+  int r = 0;
+  r += *p++;
+  r += *p++;
+  *x = r;
+  return p;
+}
+
+short*
+test_func_03 (short* p, int* x)
+{
+  int r = 0;
+  r += *p++;
+  r += *p++;
+  r += *p++;
+  *x = r;
+  return p;
+}
+
+int*
+test_func_04 (int* p, int* x)
+{
+  int r = 0;
+  r += *p++;
+  r += *p++;
+  *x = r;
+  return p;
+}
+
+int*
+test_func_05 (int* p, int* x)
+{
+  int r = 0;
+  r += *p++;
+  r += *p++;
+  r += *p++;
+  *x = r;
+  return p;
+}
+
Index: gcc/testsuite/gcc.target/sh/pr50749-qihisi-postinc-4.c
===================================================================
--- gcc/testsuite/gcc.target/sh/pr50749-qihisi-postinc-4.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/pr50749-qihisi-postinc-4.c	(revision 0)
@@ -0,0 +1,46 @@ 
+/* Verify that post-increment addressing is generated inside a loop.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "mov.b\t@r\[0-9]\+\\+,r\[0-9]\+" 3 } } */
+/* { dg-final { scan-assembler-times "mov.w\t@r\[0-9]\+\\+,r\[0-9]\+" 3 } } */
+/* { dg-final { scan-assembler-times "mov.l\t@r\[0-9]\+\\+,r\[0-9]\+" 3 } } */
+
+int
+test_func_00 (char* p, int c)
+{
+  int r = 0;
+  do
+  {
+    r += *p++;
+    r += *p++;
+    r += *p++;
+  } while (--c);
+  return r;
+}
+
+int
+test_func_01 (short* p, int c)
+{
+  int r = 0;
+  do
+  {
+    r += *p++;
+    r += *p++;
+    r += *p++;
+  } while (--c);
+  return r;
+}
+
+int
+test_func_02 (int* p, int c)
+{
+  int r = 0;
+  do
+  {
+    r += *p++;
+    r += *p++;
+    r += *p++;
+  } while (--c);
+  return r;
+}
+
Index: gcc/testsuite/gcc.target/sh/pr50749-sf-predec-1.c
===================================================================
--- gcc/testsuite/gcc.target/sh/pr50749-sf-predec-1.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/pr50749-sf-predec-1.c	(revision 0)
@@ -0,0 +1,13 @@ 
+/* Verify that pre-decrement addressing is generated.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2*" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } }  */
+/* { dg-final { scan-assembler-times "fmov.s\tfr\[0-9]\+,@-r\[0-9]\+" 1 } } */
+
+float*
+test_func_00 (float* p, float c)
+{
+  *--p = c;
+  return p;
+}
+
Index: gcc/testsuite/gcc.target/sh/pr50749-sf-predec-3.c
===================================================================
--- gcc/testsuite/gcc.target/sh/pr50749-sf-predec-3.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/pr50749-sf-predec-3.c	(revision 0)
@@ -0,0 +1,16 @@ 
+/* Verify that pre-decrement addressing is generated inside a loop.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m1" "-m2*" "-m4al" "*nofpu" "-m4-340*" "-m4-400*" "-m4-500*" "-m5*" } { "" } }  */
+/* { dg-final { scan-assembler-times "fmov.s\tfr\[0-9]\+,@-r\[0-9]\+" 1 } } */
+
+float*
+test_func_00 (float* p, int c, float x)
+{
+  do
+  {
+    *--p = x;
+  } while (--c);
+  return p;
+}
+
Index: gcc/testsuite/gcc.target/sh/pr50749-qihisi-predec-2.c
===================================================================
--- gcc/testsuite/gcc.target/sh/pr50749-qihisi-predec-2.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/pr50749-qihisi-predec-2.c	(revision 0)
@@ -0,0 +1,58 @@ 
+/* Verify that subsequent pre-decrement addressings are generated.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O2" } */
+/* { dg-final { scan-assembler-times "mov.b\tr\[0-9]\+,@-r\[0-9]\+" 5 } } */
+/* { dg-final { scan-assembler-times "mov.w\tr\[0-9]\+,@-r\[0-9]\+" 5 } } */
+/* { dg-final { scan-assembler-times "mov.l\tr\[0-9]\+,@-r\[0-9]\+" 5 } } */
+
+char*
+test_func_00 (char* p, int c)
+{
+  *--p = (char)c;
+  *--p = (char)c;
+  return p;
+}
+
+char*
+test_func_01 (char* p, int c)
+{
+  *--p = (char)c;
+  *--p = (char)c;
+  *--p = (char)c;
+  return p;
+}
+
+short*
+test_func_02 (short* p, int c)
+{
+  *--p = (short)c;
+  *--p = (short)c;
+  return p;
+}
+
+short*
+test_func_03 (short* p, int c)
+{
+  *--p = (short)c;
+  *--p = (short)c;
+  *--p = (short)c;
+  return p;
+}
+
+int*
+test_func_04 (int* p, int c)
+{
+  *--p = c;
+  *--p = c;
+  return p;
+}
+
+int*
+test_func_05 (int* p, int c)
+{
+  *--p = c;
+  *--p = c;
+  *--p = c;
+  return p;
+}
+