From patchwork Fri Mar 4 13:45:32 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alan Modra X-Patchwork-Id: 85419 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 5EC53B70CD for ; Sat, 5 Mar 2011 00:45:48 +1100 (EST) Received: (qmail 10221 invoked by alias); 4 Mar 2011 13:45:46 -0000 Received: (qmail 10209 invoked by uid 22791); 4 Mar 2011 13:45:45 -0000 X-SWARE-Spam-Status: No, hits=-2.4 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_LOW, T_TO_NO_BRKTS_FREEMAIL X-Spam-Check-By: sourceware.org Received: from mail-px0-f175.google.com (HELO mail-px0-f175.google.com) (209.85.212.175) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Fri, 04 Mar 2011 13:45:40 +0000 Received: by pxi17 with SMTP id 17so498105pxi.20 for ; Fri, 04 Mar 2011 05:45:39 -0800 (PST) Received: by 10.142.169.18 with SMTP id r18mr479166wfe.83.1299246339027; Fri, 04 Mar 2011 05:45:39 -0800 (PST) Received: from bubble.grove.modra.org ([115.187.252.19]) by mx.google.com with ESMTPS id 25sm2988248wfb.10.2011.03.04.05.45.37 (version=TLSv1/SSLv3 cipher=OTHER); Fri, 04 Mar 2011 05:45:38 -0800 (PST) Received: by bubble.grove.modra.org (Postfix, from userid 1000) id 5D741170C1FA; Sat, 5 Mar 2011 00:15:32 +1030 (CST) Date: Sat, 5 Mar 2011 00:15:32 +1030 From: Alan Modra To: gcc-patches@gcc.gnu.org Cc: David Edelsohn Subject: Fix PowerPC64 non-delegitimized UNSPEC Message-ID: <20110304134532.GD6275@bubble.grove.modra.org> Mail-Followup-To: gcc-patches@gcc.gnu.org, David Edelsohn MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.20 (2009-06-14) 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 gcc.c-torture/execute/20040709-1.c has been failing for a while when regression testing cmodel medium powerpc64 gcc. Details of the failure in the PR. This cures the problem by teaching rs6000_delegitimize_address a few more tricks. Bootstrap and regression test in progress. OK to apply assuming no regressions? PR target/47986 * config/rs6000/rs6000.c (rs6000_delegitimize_address): Handle full cmodel medium/large lo_sum + high addresses. Index: gcc/config/rs6000/rs6000.c =================================================================== --- gcc/config/rs6000/rs6000.c (revision 170673) +++ gcc/config/rs6000/rs6000.c (working copy) @@ -6248,17 +6239,23 @@ rs6000_delegitimize_address (rtx orig_x) if (MEM_P (x)) x = XEXP (x, 0); - if ((GET_CODE (x) == PLUS - || GET_CODE (x) == LO_SUM) - && GET_CODE (XEXP (x, 0)) == REG - && (REGNO (XEXP (x, 0)) == TOC_REGISTER - || TARGET_MINIMAL_TOC - || TARGET_CMODEL != CMODEL_SMALL) + if (GET_CODE (x) == (TARGET_CMODEL != CMODEL_SMALL ? LO_SUM : PLUS) && GET_CODE (XEXP (x, 1)) == CONST) { y = XEXP (XEXP (x, 1), 0); if (GET_CODE (y) == UNSPEC - && XINT (y, 1) == UNSPEC_TOCREL) + && XINT (y, 1) == UNSPEC_TOCREL + && ((GET_CODE (XEXP (x, 0)) == REG + && (REGNO (XEXP (x, 0)) == TOC_REGISTER + || TARGET_MINIMAL_TOC + || TARGET_CMODEL != CMODEL_SMALL)) + || (TARGET_CMODEL != CMODEL_SMALL + && GET_CODE (XEXP (x, 0)) == PLUS + && GET_CODE (XEXP (XEXP (x, 0), 0)) == REG + && REGNO (XEXP (XEXP (x, 0), 0)) == TOC_REGISTER + && GET_CODE (XEXP (XEXP (x, 0), 1)) == HIGH + && rtx_equal_p (XEXP (x, 1), + XEXP (XEXP (XEXP (x, 0), 1), 0))))) { y = XVECEXP (y, 0, 0); if (!MEM_P (orig_x))