public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [SH] PR 34777 - Add test case
@ 2012-10-08 23:01 Oleg Endo
  2012-10-09  9:34 ` Kaz Kojima
  0 siblings, 1 reply; 6+ messages in thread
From: Oleg Endo @ 2012-10-08 23:01 UTC (permalink / raw)
  To: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 339 bytes --]

Hello,

This adds the reduced test case as mentioned by Kaz in the PR to the
test suite.
Tested with
make -k check-gcc RUNTESTFLAGS="compile.exp=pr34777*
--target_board=sh-sim
\{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"

OK?

Cheers,
Oleg

testsuite/ChangeLog:

	PR target/34777
	* gcc.c-torture/compile/pr34777.c: New.

[-- Attachment #2: sh_pr34777_1.patch --]
[-- Type: text/x-patch, Size: 1304 bytes --]

Index: gcc/testsuite/gcc.c-torture/compile/pr34777.c
===================================================================
--- gcc/testsuite/gcc.c-torture/compile/pr34777.c	(revision 0)
+++ gcc/testsuite/gcc.c-torture/compile/pr34777.c	(revision 0)
@@ -0,0 +1,30 @@
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-additional-options "-fPIC" }  */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m5*" } { "" } }  */
+
+static __inline __attribute__ ((__always_inline__)) void *
+_dl_mmap (void * start, int length, int prot, int flags, int fd,
+	  int offset)
+{
+  register long __sc3 __asm__ ("r3") = 90;
+  register long __sc4 __asm__ ("r4") = (long) start;
+  register long __sc5 __asm__ ("r5") = (long) length;
+  register long __sc6 __asm__ ("r6") = (long) prot;
+  register long __sc7 __asm__ ("r7") = (long) flags;
+  register long __sc0 __asm__ ("r0") = (long) fd;
+  register long __sc1 __asm__ ("r1") = (long) offset;
+  __asm__ __volatile__ ("trapa	%1"
+			: "=z" (__sc0)
+			: "i" (0x10 + 6), "0" (__sc0), "r" (__sc4),
+			  "r" (__sc5), "r" (__sc6), "r" (__sc7),
+			  "r" (__sc3), "r" (__sc1)
+			: "memory" );
+}
+
+extern int _dl_pagesize;
+void
+_dl_dprintf(int fd, const char *fmt, ...)
+{
+  static char *buf;
+  buf = _dl_mmap ((void *) 0, _dl_pagesize, 0x1 | 0x2, 0x02 | 0x20, -1, 0);
+}

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [SH] PR 34777 - Add test case
  2012-10-08 23:01 [SH] PR 34777 - Add test case Oleg Endo
@ 2012-10-09  9:34 ` Kaz Kojima
  2012-10-09 17:58   ` Oleg Endo
  0 siblings, 1 reply; 6+ messages in thread
From: Kaz Kojima @ 2012-10-09  9:34 UTC (permalink / raw)
  To: oleg.endo; +Cc: gcc-patches

Oleg Endo <oleg.endo@t-online.de> wrote:
> This adds the reduced test case as mentioned by Kaz in the PR to the
> test suite.
> Tested with
> make -k check-gcc RUNTESTFLAGS="compile.exp=pr34777*
> --target_board=sh-sim
> \{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"
> 
> OK?

It should be put into gcc.target/sh instead of gcc.c-torture/compile
and tested with -Os -fschedule-insns -fPIC -mprefergot, shouldn't it?

Regards,
	kaz

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [SH] PR 34777 - Add test case
  2012-10-09  9:34 ` Kaz Kojima
@ 2012-10-09 17:58   ` Oleg Endo
  2012-10-09 22:47     ` Kaz Kojima
  0 siblings, 1 reply; 6+ messages in thread
From: Oleg Endo @ 2012-10-09 17:58 UTC (permalink / raw)
  To: Kaz Kojima; +Cc: gcc-patches

On Tue, 2012-10-09 at 18:33 +0900, Kaz Kojima wrote:
> Oleg Endo <oleg.endo@t-online.de> wrote:
> > This adds the reduced test case as mentioned by Kaz in the PR to the
> > test suite.
> > Tested with
> > make -k check-gcc RUNTESTFLAGS="compile.exp=pr34777*
> > --target_board=sh-sim
> > \{-m2/-ml,-m2/-mb,-m2a/-mb,-m4/-ml,-m4/-mb,-m4a/-ml,-m4a/-mb}"
> > 
> > OK?
> 
> It should be put into gcc.target/sh instead of gcc.c-torture/compile
> and tested with -Os -fschedule-insns -fPIC -mprefergot, shouldn't it?
> 

Uhm, yes, I forgot to add the -fschedule-insns and -mprefergot options.
Regarding the -Os option, I think it's better to test this one at
multiple optimization levels, just in case.  I've looked through
gcc.c-torture/compile and found some target specific test cases there,
so I thought it would be OK to do the same :)
Some targets also have their own torture subdir.  If it's better, I
could also create gcc.target/sh/torture.

Cheers,
Oleg

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [SH] PR 34777 - Add test case
  2012-10-09 17:58   ` Oleg Endo
@ 2012-10-09 22:47     ` Kaz Kojima
  2012-10-14 18:40       ` Oleg Endo
  0 siblings, 1 reply; 6+ messages in thread
From: Kaz Kojima @ 2012-10-09 22:47 UTC (permalink / raw)
  To: oleg.endo; +Cc: gcc-patches

Oleg Endo <oleg.endo@t-online.de> wrote:
> Uhm, yes, I forgot to add the -fschedule-insns and -mprefergot options.
> Regarding the -Os option, I think it's better to test this one at
> multiple optimization levels, just in case.  I've looked through
> gcc.c-torture/compile and found some target specific test cases there,
> so I thought it would be OK to do the same :)
> Some targets also have their own torture subdir.  If it's better, I
> could also create gcc.target/sh/torture.

Maybe.  For this specific test, I thought that "-Os -fschedule-insns
-fPIC -mprefergot" would be enough because empirically these options
will give high R0 register pressure which had caused that PR.

Regards,
	kaz

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [SH] PR 34777 - Add test case
  2012-10-09 22:47     ` Kaz Kojima
@ 2012-10-14 18:40       ` Oleg Endo
  2012-10-15 11:34         ` Kaz Kojima
  0 siblings, 1 reply; 6+ messages in thread
From: Oleg Endo @ 2012-10-14 18:40 UTC (permalink / raw)
  To: Kaz Kojima; +Cc: gcc-patches

[-- Attachment #1: Type: text/plain, Size: 1158 bytes --]

On Wed, 2012-10-10 at 07:46 +0900, Kaz Kojima wrote:
> Oleg Endo <oleg.endo@t-online.de> wrote:
> > Uhm, yes, I forgot to add the -fschedule-insns and -mprefergot options.
> > Regarding the -Os option, I think it's better to test this one at
> > multiple optimization levels, just in case.  I've looked through
> > gcc.c-torture/compile and found some target specific test cases there,
> > so I thought it would be OK to do the same :)
> > Some targets also have their own torture subdir.  If it's better, I
> > could also create gcc.target/sh/torture.
> 
> Maybe.  For this specific test, I thought that "-Os -fschedule-insns
> -fPIC -mprefergot" would be enough because empirically these options
> will give high R0 register pressure which had caused that PR.
> 

Sorry for the delayed reply.
The attached patch adds gcc.target/sh/torture and puts the test there.
The torture subdir might be also useful in the future.
Tested on rev 192417 with
make -k check-gcc RUNTESTFLAGS="--target_board=sh-sim\{-m2/-ml}"

OK?

Cheers,
Oleg

testsuite/ChangeLog:

	PR target/34777
	* gcc.target/sh/torture/sh-torture.exp: New.
	* gcc.target/sh/torture/pr34777.c: New.

[-- Attachment #2: sh_pr34777_2.patch --]
[-- Type: text/x-patch, Size: 2902 bytes --]

Index: gcc/testsuite/gcc.target/sh/torture/pr34777.c
===================================================================
--- gcc/testsuite/gcc.target/sh/torture/pr34777.c	(revision 0)
+++ gcc/testsuite/gcc.target/sh/torture/pr34777.c	(revision 0)
@@ -0,0 +1,30 @@
+/* { dg-do compile { target "sh*-*-*" } } */
+/* { dg-additional-options "-fschedule-insns -fPIC -mprefergot" }  */
+/* { dg-skip-if "" { "sh*-*-*" } { "-m5*" } { "" } }  */
+
+static __inline __attribute__ ((__always_inline__)) void *
+_dl_mmap (void * start, int length, int prot, int flags, int fd,
+	  int offset)
+{
+  register long __sc3 __asm__ ("r3") = 90;
+  register long __sc4 __asm__ ("r4") = (long) start;
+  register long __sc5 __asm__ ("r5") = (long) length;
+  register long __sc6 __asm__ ("r6") = (long) prot;
+  register long __sc7 __asm__ ("r7") = (long) flags;
+  register long __sc0 __asm__ ("r0") = (long) fd;
+  register long __sc1 __asm__ ("r1") = (long) offset;
+  __asm__ __volatile__ ("trapa	%1"
+			: "=z" (__sc0)
+			: "i" (0x10 + 6), "0" (__sc0), "r" (__sc4),
+			  "r" (__sc5), "r" (__sc6), "r" (__sc7),
+			  "r" (__sc3), "r" (__sc1)
+			: "memory" );
+}
+
+extern int _dl_pagesize;
+void
+_dl_dprintf(int fd, const char *fmt, ...)
+{
+  static char *buf;
+  buf = _dl_mmap ((void *) 0, _dl_pagesize, 0x1 | 0x2, 0x02 | 0x20, -1, 0);
+}
Index: gcc/testsuite/gcc.target/sh/torture/sh-torture.exp
===================================================================
--- gcc/testsuite/gcc.target/sh/torture/sh-torture.exp	(revision 0)
+++ gcc/testsuite/gcc.target/sh/torture/sh-torture.exp	(revision 0)
@@ -0,0 +1,41 @@
+#   Copyright (C) 2012 Free Software Foundation, Inc.
+
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 3 of the License, or
+# (at your option) any later version.
+# 
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+# 
+# You should have received a copy of the GNU General Public License
+# along with GCC; see the file COPYING3.  If not see
+# <http://www.gnu.org/licenses/>.
+
+# GCC testsuite that uses the `gcc-dg.exp' driver, looping over
+# optimization options.
+
+# Exit immediately if this isn't a SH target.
+if { ![istarget sh*-*-*] } then {
+  return
+}
+
+# Load support procs.
+load_lib gcc-dg.exp
+
+# If a testcase doesn't have special options, use these.
+global DEFAULT_CFLAGS
+if ![info exists DEFAULT_CFLAGS] then {
+    set DEFAULT_CFLAGS " -ansi -pedantic-errors"
+}
+
+# Initialize `dg'.
+dg-init
+
+# Main loop.
+gcc-dg-runtest [lsort [glob -nocomplain $srcdir/$subdir/*.\[cS\]]] $DEFAULT_CFLAGS
+
+# All done.
+dg-finish

^ permalink raw reply	[flat|nested] 6+ messages in thread

* Re: [SH] PR 34777 - Add test case
  2012-10-14 18:40       ` Oleg Endo
@ 2012-10-15 11:34         ` Kaz Kojima
  0 siblings, 0 replies; 6+ messages in thread
From: Kaz Kojima @ 2012-10-15 11:34 UTC (permalink / raw)
  To: oleg.endo; +Cc: gcc-patches

Oleg Endo <oleg.endo@t-online.de> wrote:
> The attached patch adds gcc.target/sh/torture and puts the test there.
> The torture subdir might be also useful in the future.
> Tested on rev 192417 with
> make -k check-gcc RUNTESTFLAGS="--target_board=sh-sim\{-m2/-ml}"
> 
> OK?

OK.

Regards,
	kaz

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2012-10-15 11:33 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-10-08 23:01 [SH] PR 34777 - Add test case Oleg Endo
2012-10-09  9:34 ` Kaz Kojima
2012-10-09 17:58   ` Oleg Endo
2012-10-09 22:47     ` Kaz Kojima
2012-10-14 18:40       ` Oleg Endo
2012-10-15 11:34         ` Kaz Kojima

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).