Patchwork Committed: Fix sh regression for target/55160

login
register
mail settings
Submitter Oleg Endo
Date Nov. 1, 2012, 8:54 a.m.
Message ID <1351760078.8110.8.camel@yam-132-YW-E178-FTW>
Download mbox | patch
Permalink /patch/196095/
State New
Headers show

Comments

Oleg Endo - Nov. 1, 2012, 8:54 a.m.
On Thu, 2012-11-01 at 02:31 -0400, Joern Rennecke wrote:
> gen_doloop_end_split creates a pattern that sets pc, hence emit_jump_insn
> has to be used instead of emit_insn.
> 
> Committed as obvious.

I'd like to add a test case for this.

Attached patch was tested with
make -k check-gcc RUNTESTFLAGS="sh.exp=pr55160.c --target_board=sh-sim
\{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"

OK to install?

Cheers,
Oleg


testsuite/ChangeLog:

	PR target/55160
	* gcc.target/sh/pr55160.c: New.
Joern Rennecke - Nov. 1, 2012, 9:18 a.m.
Quoting Oleg Endo <oleg.endo@t-online.de>:

> I'd like to add a test case for this.
>
> Attached patch was tested with
> make -k check-gcc RUNTESTFLAGS="sh.exp=pr55160.c --target_board=sh-sim
> \{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"
>
> OK to install?

That'll be for the SH maintainers to decide.

However, I note that dg-skip-if is used with negated logic from what is
described in:
http://gcc.gnu.org/onlinedocs/gccint/Directives.html

Is that a documentation bug?
Oleg Endo - Nov. 1, 2012, 9:31 a.m.
On Thu, 2012-11-01 at 05:18 -0400, Joern Rennecke wrote:
> Quoting Oleg Endo <oleg.endo@t-online.de>:
> 
> > I'd like to add a test case for this.
> >
> > Attached patch was tested with
> > make -k check-gcc RUNTESTFLAGS="sh.exp=pr55160.c --target_board=sh-sim
> > \{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"
> >
> > OK to install?
> 
> That'll be for the SH maintainers to decide.
> 
> However, I note that dg-skip-if is used with negated logic from what is
> described in:
> http://gcc.gnu.org/onlinedocs/gccint/Directives.html
> 
> Is that a documentation bug?

I'm using:
/* { dg-skip-if "" { "sh*-*-*" } { "-m5*"} { "" } }  */

Documentation says:

{ dg-skip-if comment { selector } [{ include-opts } [{ exclude-opts }]] }

For example, to skip a test if option -Os is present:
     /* { dg-skip-if "" { *-*-* }  { "-Os" } { "" } } */

Has been working for me as described in the docs so far (there are more
SH tests that use dg-skip-if, e.g. to skip SH2A tests when not compiling
for SH2A etc).

Cheers,
Oleg
Joern Rennecke - Nov. 1, 2012, 9:53 a.m.
Quoting Oleg Endo <oleg.endo@t-online.de>:

> I'm using:
> /* { dg-skip-if "" { "sh*-*-*" } { "-m5*"} { "" } }  */

Sorry, I mentally mixed up the arguments.
Kaz Kojima - Nov. 1, 2012, 11:14 a.m.
Oleg Endo <oleg.endo@t-online.de> wrote:
> I'd like to add a test case for this.
> 
> Attached patch was tested with
> make -k check-gcc RUNTESTFLAGS="sh.exp=pr55160.c --target_board=sh-sim
> \{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"
> 
> OK to install?

OK.

Regards,
	kaz

Patch

Index: gcc/testsuite/gcc.target/sh/pr55160.c
===================================================================
--- gcc/testsuite/gcc.target/sh/pr55160.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/pr55160.c	(revision 0)
@@ -0,0 +1,25 @@ 
+/* Check that the decrement-and-test instruction is generated.  */
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-options "-O1" } */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m5*"} { "" } }  */
+/* { dg-final { scan-assembler-times "dt\tr" 2 } } */
+
+int
+test_00 (int* x, int c)
+{
+  int s = 0;
+  int i;
+  for (i = 0; i < c; ++i)
+    s += x[i];
+  return s;
+}
+
+int
+test_01 (int* x, int c)
+{
+  int s = 0;
+  int i;
+  for (i = 0; i < c; ++i)
+    s += *--x;
+  return s;
+}