From patchwork Wed Apr 2 20:57:29 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 336469 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 EF12F1400FA for ; Thu, 3 Apr 2014 07:57:23 +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 :message-id:date:from:mime-version:to:subject:content-type; q= dns; s=default; b=I9GQtRiDnjyGCxEIDGzV9V/CPjcf/+4RtkLeQRBimW4/4D EmNIXkqCrplwERolSPvfYquk+7xs8tRS/r890m7gYQRQDPVSQrG7KYlUzbzBzEtg 5nkWZHO4iuuZjyyor1kByPxxR/R+nHIBEKBz7sSM+twHaKDXBS1M9TvUmZvcY= 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 :message-id:date:from:mime-version:to:subject:content-type; s= default; bh=x92/5ZPOW0/bidBSUIcbx16dyQk=; b=cifTVQBzTb8iQUdaNLRf tgkt6ookUK44BoGIo3ZcdVKpNn+Nd5ePntQDuRGziRAhbo7kj8YMijqmPFr10Qs7 puGMWPZi/vB7wBe/0R/Ckp5z+SXuPhs8jneSn7dRo3EbPqi9tsDvHo4NTZyScn0U gwjtJj69ZOjwYn2uHQfZPc4= Received: (qmail 4700 invoked by alias); 2 Apr 2014 20:57:17 -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 4690 invoked by uid 89); 2 Apr 2014 20:57:16 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-4.3 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD, SPF_HELO_PASS, SPF_PASS autolearn=ham version=3.3.2 X-HELO: mx1.redhat.com Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Wed, 02 Apr 2014 20:57:13 +0000 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s32KvC8p012868 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 2 Apr 2014 16:57:12 -0400 Received: from Mair.local (vpn-62-64.rdu2.redhat.com [10.10.62.64]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id s32KvBMn015572 for ; Wed, 2 Apr 2014 16:57:12 -0400 Message-ID: <533C79B9.3060809@redhat.com> Date: Wed, 02 Apr 2014 16:57:29 -0400 From: Vladimir Makarov User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:24.0) Gecko/20100101 Thunderbird/24.4.0 MIME-Version: 1.0 To: GCC Patches Subject: one more patch to fix PR60650 X-IsSubscribed: yes The following patch fixes the PR for new set of options. The details of the problem can be found on http://gcc.gnu.org/bugzilla/show_bug.cgi?id=60650 The patch affects a sensitive part for LRA. Therefore I bootstrapped and tested it on x86-64, aarch64, arm, s390, and Ppc64. The results look ok. x86/x86-64 SPEC2000 testing shows no visible effect on performance and code size. Committed as rev. 209038. 2014-04-02 Vladimir Makarov PR rtl-optimization/60650 * lra-constraints.c (process_alt_operands): Decrease reject for earlyclobber matching. 2014-04-02 Vladimir Makarov PR rtl-optimization/60650 * gcc.target/arm/pr60650-2.c: New. Index: lra-constraints.c =================================================================== --- lra-constraints.c (revision 208989) +++ lra-constraints.c (working copy) @@ -1747,12 +1747,27 @@ process_alt_operands (int only_alternati [GET_MODE (*curr_id->operand_loc[m])]); } - /* We prefer no matching alternatives because - it gives more freedom in RA. */ - if (operand_reg[nop] == NULL_RTX - || (find_regno_note (curr_insn, REG_DEAD, - REGNO (operand_reg[nop])) - == NULL_RTX)) + /* Prefer matching earlyclobber alternative as + it results in less hard regs required for + the insn than a non-matching earlyclobber + alternative. */ + if (curr_static_id->operand[m].early_clobber) + { + if (lra_dump_file != NULL) + fprintf + (lra_dump_file, + " %d Matching earlyclobber alt:" + " reject--\n", + nop); + reject--; + } + /* Otherwise we prefer no matching + alternatives because it gives more freedom + in RA. */ + else if (operand_reg[nop] == NULL_RTX + || (find_regno_note (curr_insn, REG_DEAD, + REGNO (operand_reg[nop])) + == NULL_RTX)) { if (lra_dump_file != NULL) fprintf @@ -2143,7 +2158,7 @@ process_alt_operands (int only_alternati } /* If the operand is dying, has a matching constraint, and satisfies constraints of the matched operand - which failed to satisfy the own constraints, probably + which failed to satisfy the own constraints, most probably the reload for this operand will be gone. */ if (this_alternative_matches >= 0 && !curr_alt_win[this_alternative_matches] Index: testsuite/gcc.target/arm/pr60650-2.c =================================================================== --- testsuite/gcc.target/arm/pr60650-2.c (revision 0) +++ testsuite/gcc.target/arm/pr60650-2.c (working copy) @@ -0,0 +1,37 @@ +/* { dg-do compile } */ +/* { dg-options "-O2 -fno-omit-frame-pointer -march=armv7-a" } */ + +int a, h, j; +long long d, e, i; +int f; +fn1 (void *p1, int p2) +{ + switch (p2) + case 8: +{ + register b = *(long long *) p1, c asm ("r2"); + asm ("%0": "=r" (a), "=r" (c):"r" (b), "r" (0)); + *(long long *) p1 = c; + } +} + +fn2 () +{ + int k; + k = f; + while (1) + { + fn1 (&i, sizeof i); + e = d + k; + switch (d) + case 0: + ( + { + register l asm ("r4"); + register m asm ("r0"); + asm (" .err .endif\n\t": "=r" (h), "=r" (j):"r" (m), + "r" + (l));; + }); + } +}