From patchwork Sun Oct 14 18:19:18 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Oleg Endo X-Patchwork-Id: 191374 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from sourceware.org (server1.sourceware.org [209.132.180.131]) by ozlabs.org (Postfix) with SMTP id AF94D2C0097 for ; Mon, 15 Oct 2012 05:19:45 +1100 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1350843587; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References: Content-Type:Mime-Version:Mailing-List:Precedence:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:Sender: Delivered-To; bh=2SzDTgDPIJg9dbhTMRb689n6uNs=; b=GTPH3F0KZSXARJN WlPM5kbTTKRibSumH0YJJRUsBin7PzvxwwnfdkU1BR5M8GpWeAiCNKtXJmlbRnXh vHiBtlp7wUmA9dBB+z+/2XqcbQCDtJcWzisXul4zh8+nPV35VHBjzFOHmt8h94As 4p2WqVuNpH2hwa8C2/3kq56atHxI= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:Received:Message-ID:Subject:From:To:Cc:Date:In-Reply-To:References:Content-Type:Mime-Version:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=WmEwAqg0+lwCFF2tG8EXE7zGdEi3FqlMccNuJck9ut0r/HnrVsazRI+rZyntvt vnY0WndI+zUyC1VTP+K7C5IDOhfAZUQJ5zMZQ/a2qAB2YfAIie0siIsfC4+0Jtf7 0OkHCS94RU76OVIX6TdSpoFxVkJQRJ0JDD1mJbQg1EUxc=; Received: (qmail 26778 invoked by alias); 14 Oct 2012 18:19:40 -0000 Received: (qmail 26763 invoked by uid 22791); 14 Oct 2012 18:19:39 -0000 X-SWARE-Spam-Status: No, hits=-3.9 required=5.0 tests=AWL, BAYES_00, KHOP_THREADED, RCVD_IN_DNSWL_NONE, RCVD_IN_HOSTKARMA_NO, RCVD_IN_HOSTKARMA_YE, RP_MATCHES_RCVD, UNPARSEABLE_RELAY X-Spam-Check-By: sourceware.org Received: from mailout11.t-online.de (HELO mailout11.t-online.de) (194.25.134.85) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Sun, 14 Oct 2012 18:19:32 +0000 Received: from fwd06.aul.t-online.de (fwd06.aul.t-online.de ) by mailout11.t-online.de with smtp id 1TNSmf-0004UP-FT; Sun, 14 Oct 2012 20:19:29 +0200 Received: from [192.168.0.100] (ECX5VUZXZhjHAZgu9WmHQ29sBV+XDC101Qzyxoo5HQet25VoZXy71-L3rkxJungQs5@[93.218.191.89]) by fwd06.t-online.de with esmtp id 1TNSme-27neNc0; Sun, 14 Oct 2012 20:19:28 +0200 Message-ID: <1350238758.2348.13.camel@yam-132-YW-E178-FTW> Subject: Re: [SH] PR 34777 - Add test case From: Oleg Endo To: Kaz Kojima Cc: gcc-patches@gcc.gnu.org Date: Sun, 14 Oct 2012 20:19:18 +0200 In-Reply-To: <20121010.074628.188076401.kkojima@rr.iij4u.or.jp> References: <1349737251.21984.55.camel@yam-132-YW-E178-FTW> <20121009.183324.498911932.kkojima@rr.iij4u.or.jp> <1349805465.21984.65.camel@yam-132-YW-E178-FTW> <20121010.074628.188076401.kkojima@rr.iij4u.or.jp> Mime-Version: 1.0 X-IsSubscribed: yes Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Unsubscribe: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Delivered-To: mailing list gcc-patches@gcc.gnu.org On Wed, 2012-10-10 at 07:46 +0900, Kaz Kojima wrote: > Oleg Endo 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. 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 +# . + +# 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