From patchwork Wed Mar 26 12:11:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andreas Krebbel X-Patchwork-Id: 333838 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]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 6DF91140090 for ; Wed, 26 Mar 2014 23:11:25 +1100 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=y4PEC0UlCW/KA3S1qrY2+ib0WmurPDQNOxKgUC4qXUSr7qpO8wq2Q qqiHZqYNiQMsrrQg2hXQwH2AZ9RU1K3S7DIDL+vREhCOq+9/wc4iVN5ulhacQxSO GFs4v3S+Q88rinNYaT4L/OsE1BT62WICfWrHqx9JSBhusI/pkUuqsU= DKIM-Signature: v=1; a=rsa-sha1; c=relaxed; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=JNnJjxiRpsYEdwo7gduBSZjNsqY=; b=lHueQcgzSaJCx2Us38SF pTGUZ+VtwGMf0btMY9OL1HzlJOX1fX3GF5Xik61I0lhBPg33E+s+s+ejIEDbT0rE 3LHK2+91LNnNbncqxQAv+ckOMWyGak9KT0baeZWdt+HwUpkQ4h8Lq6o0ZF09uYcx Opgik7y3fOOc1Nfkat0+0Sw= Received: (qmail 7829 invoked by alias); 26 Mar 2014 12:11:19 -0000 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 Received: (qmail 7818 invoked by uid 89); 26 Mar 2014 12:11:18 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.4 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: e06smtp18.uk.ibm.com Received: from e06smtp18.uk.ibm.com (HELO e06smtp18.uk.ibm.com) (195.75.94.114) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES256-SHA encrypted) ESMTPS; Wed, 26 Mar 2014 12:11:17 +0000 Received: from /spool/local by e06smtp18.uk.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Wed, 26 Mar 2014 12:11:14 -0000 Received: from d06dlp03.portsmouth.uk.ibm.com (9.149.20.15) by e06smtp18.uk.ibm.com (192.168.101.148) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; Wed, 26 Mar 2014 12:11:11 -0000 Received: from b06cxnps3074.portsmouth.uk.ibm.com (d06relay09.portsmouth.uk.ibm.com [9.149.109.194]) by d06dlp03.portsmouth.uk.ibm.com (Postfix) with ESMTP id 89D081B08066 for ; Wed, 26 Mar 2014 12:11:04 +0000 (GMT) Received: from d06av09.portsmouth.uk.ibm.com (d06av09.portsmouth.uk.ibm.com [9.149.37.250]) by b06cxnps3074.portsmouth.uk.ibm.com (8.13.8/8.13.8/NCO v10.0) with ESMTP id s2QCAxKj63963166 for ; Wed, 26 Mar 2014 12:10:59 GMT Received: from d06av09.portsmouth.uk.ibm.com (localhost [127.0.0.1]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVout) with ESMTP id s2QCBBv7020249 for ; Wed, 26 Mar 2014 06:11:11 -0600 Received: from bart (dyn-9-152-212-28.boeblingen.de.ibm.com [9.152.212.28]) by d06av09.portsmouth.uk.ibm.com (8.14.4/8.14.4/NCO v10.0 AVin) with SMTP id s2QCB9aI020188 for ; Wed, 26 Mar 2014 06:11:09 -0600 Received: by bart (sSMTP sendmail emulation); Wed, 26 Mar 2014 13:11:09 +0100 Date: Wed, 26 Mar 2014 13:11:09 +0100 From: Andreas Krebbel To: gcc-patches@gcc.gnu.org Subject: [PATCH] S/390: Fix FPR restores with shrink wrapping on 31bit zarch Message-ID: <20140326121109.GA957@bart> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-TM-AS-MML: disable X-Content-Scanned: Fidelis XPS MAILER x-cbid: 14032612-6892-0000-0000-00000841B3FE X-IsSubscribed: yes Hi, in the attached testcase the restore of f4 gets dropped when compiled with -m31 -mzarch. The problem is that s390_can_use_return_insn lacks a check for f4 and f6 which are call-saved on 31 bit. Bootstraps on s390 and s390x are still running. I'll commit it afterwards. This fixes a miscompile of the 433.milc SpecCPU testcase. Bye, -Andreas- 2014-03-26 Andreas Krebbel * config/s390/s390.c (s390_can_use_return_insn): Check for call-saved FPRs on 31 bit. 2014-03-26 Andreas Krebbel * gcc.target/s390/20140326-1.c: New testcase. diff --git a/gcc/config/s390/s390.c b/gcc/config/s390/s390.c index 7a79286..bdb577c 100644 --- a/gcc/config/s390/s390.c +++ b/gcc/config/s390/s390.c @@ -9225,6 +9225,13 @@ s390_can_use_return_insn (void) if (cfun_gpr_save_slot (i)) return false; + /* For 31 bit this is not covered by the frame_size check below + since f4, f6 are saved in the register save area without needing + additional stack space. */ + if (!TARGET_64BIT + && (cfun_fpr_save_p (FPR4_REGNUM) || cfun_fpr_save_p (FPR6_REGNUM))) + return false; + if (cfun->machine->base_reg && !call_really_used_regs[REGNO (cfun->machine->base_reg)]) return false; diff --git a/gcc/testsuite/gcc.target/s390/20140326-1.c b/gcc/testsuite/gcc.target/s390/20140326-1.c new file mode 100644 index 0000000..f71c38f --- /dev/null +++ b/gcc/testsuite/gcc.target/s390/20140326-1.c @@ -0,0 +1,10 @@ +/* { dg-do compile } */ +/* { dg-options "-O3 -m31 -mzarch" } */ + +void +foo () +{ + asm ("" ::: "%f4"); +} + +/* { dg-final { scan-assembler "ld" } } */