From patchwork Wed Sep 8 19:21:56 2010 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Vladimir Makarov X-Patchwork-Id: 64199 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 2924EB6EF7 for ; Thu, 9 Sep 2010 05:22:13 +1000 (EST) Received: (qmail 10809 invoked by alias); 8 Sep 2010 19:22:11 -0000 Received: (qmail 10788 invoked by uid 22791); 8 Sep 2010 19:22:09 -0000 X-SWARE-Spam-Status: No, hits=-6.0 required=5.0 tests=AWL, BAYES_00, RCVD_IN_DNSWL_HI, SPF_HELO_PASS, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mx1.redhat.com (HELO mx1.redhat.com) (209.132.183.28) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 08 Sep 2010 19:21:59 +0000 Received: from int-mx02.intmail.prod.int.phx2.redhat.com (int-mx02.intmail.prod.int.phx2.redhat.com [10.5.11.12]) by mx1.redhat.com (8.13.8/8.13.8) with ESMTP id o88JLvYK027905 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=OK) for ; Wed, 8 Sep 2010 15:21:57 -0400 Received: from toll.yyz.redhat.com (toll.yyz.redhat.com [10.15.16.165]) by int-mx02.intmail.prod.int.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id o88JLuv3021595; Wed, 8 Sep 2010 15:21:57 -0400 Message-ID: <4C87E254.7080209@redhat.com> Date: Wed, 08 Sep 2010 15:21:56 -0400 From: Vladimir Makarov User-Agent: Mozilla/5.0 (X11; U; Linux x86_64; en-US; rv:1.9.2.7) Gecko/20100720 Fedora/3.1.1-1.fc13 Thunderbird/3.1.1 MIME-Version: 1.0 To: gcc-patches CC: Jeffrey Law Subject: [patch] A fix for PR40386 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 The following patch fixes PR40386. The problem in details is described on http://gcc.gnu.org/bugzilla/show_bug.cgi?id=40386. Is it ok to commit into trunk and gcc-4.4-branch? 2010-09-08 Vladimir Makarov PR middle-end/40386 * ira.c (pseudo_for_reload_consideration_p): Don't use flag_ira_share_spill_slots. 2010-09-08 Vladimir Makarov PR middle-end/40386 * gcc.c-torture/execute/{pr40386.c,pr40386.x}: New testcase. Index: ira.c =================================================================== --- ira.c (revision 164011) +++ ira.c (working copy) @@ -2742,8 +2742,7 @@ pseudo_for_reload_consideration_p (int r { /* Consider spilled pseudos too for IRA because they still have a chance to get hard-registers in the reload when IRA is used. */ - return (reg_renumber[regno] >= 0 - || (ira_conflicts_p && flag_ira_share_spill_slots)); + return (reg_renumber[regno] >= 0 || ira_conflicts_p); } /* Init LIVE_SUBREGS[ALLOCNUM] and LIVE_SUBREGS_USED[ALLOCNUM] using Index: testsuite/gcc.c-torture/execute/pr40386.c =================================================================== --- testsuite/gcc.c-torture/execute/pr40386.c (revision 0) +++ testsuite/gcc.c-torture/execute/pr40386.c (revision 0) @@ -0,0 +1,99 @@ +/* { dg-options "-fno-ira-share-spill-slots" } */ +#define CHAR_BIT 8 + +#define ROR(a,b) (((a) >> (b)) | ((a) << ((sizeof (a) * CHAR_BIT) - (b)))) +#define ROL(a,b) (((a) << (b)) | ((a) >> ((sizeof (a) * CHAR_BIT) - (b)))) + +#define CHAR_VALUE ((char)0xf234) +#define SHORT_VALUE ((short)0xf234) +#define INT_VALUE ((int)0xf234) +#define LONG_VALUE ((long)0xf2345678L) +#define LL_VALUE ((long long)0xf2345678abcdef0LL) + +#define SHIFT1 4 +#define SHIFT2 ((sizeof (long long) * CHAR_BIT) - SHIFT1) + +char c = CHAR_VALUE; +short s = SHORT_VALUE; +int i = INT_VALUE; +long l = LONG_VALUE; +long long ll = LL_VALUE; +int shift1 = SHIFT1; +int shift2 = SHIFT2; + +main () +{ + if (ROR (c, shift1) != ROR (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROR (c, SHIFT1) != ROR (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROR (s, shift1) != ROR (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROR (s, SHIFT1) != ROR (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROR (i, shift1) != ROR (INT_VALUE, SHIFT1)) + abort (); + + if (ROR (i, SHIFT1) != ROR (INT_VALUE, SHIFT1)) + abort (); + + if (ROR (l, shift1) != ROR (LONG_VALUE, SHIFT1)) + abort (); + + if (ROR (l, SHIFT1) != ROR (LONG_VALUE, SHIFT1)) + abort (); + + if (ROR (ll, shift1) != ROR (LL_VALUE, SHIFT1)) + abort (); + + if (ROR (ll, SHIFT1) != ROR (LL_VALUE, SHIFT1)) + abort (); + + if (ROR (ll, shift2) != ROR (LL_VALUE, SHIFT2)) + abort (); + + if (ROR (ll, SHIFT2) != ROR (LL_VALUE, SHIFT2)) + abort (); + + if (ROL (c, shift1) != ROL (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROL (c, SHIFT1) != ROL (CHAR_VALUE, SHIFT1)) + abort (); + + if (ROL (s, shift1) != ROL (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROL (s, SHIFT1) != ROL (SHORT_VALUE, SHIFT1)) + abort (); + + if (ROL (i, shift1) != ROL (INT_VALUE, SHIFT1)) + abort (); + + if (ROL (i, SHIFT1) != ROL (INT_VALUE, SHIFT1)) + abort (); + + if (ROL (l, shift1) != ROL (LONG_VALUE, SHIFT1)) + abort (); + + if (ROL (l, SHIFT1) != ROL (LONG_VALUE, SHIFT1)) + abort (); + + if (ROL (ll, shift1) != ROL (LL_VALUE, SHIFT1)) + abort (); + + if (ROL (ll, SHIFT1) != ROL (LL_VALUE, SHIFT1)) + abort (); + + if (ROL (ll, shift2) != ROL (LL_VALUE, SHIFT2)) + abort (); + + if (ROL (ll, SHIFT2) != ROL (LL_VALUE, SHIFT2)) + abort (); + + exit (0); +} Index: testsuite/gcc.c-torture/execute/pr40386.x =================================================================== --- testsuite/gcc.c-torture/execute/pr40386.x (revision 0) +++ testsuite/gcc.c-torture/execute/pr40386.x (revision 0) @@ -0,0 +1,2 @@ +set additional_flags "-fno-ira-share-spill-slots" +return 0