From patchwork Fri Dec 12 12:21:05 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Zamyatin, Igor" X-Patchwork-Id: 420446 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 DD5EA1400D5 for ; Fri, 12 Dec 2014 23:21:21 +1100 (AEDT) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:cc:subject:date:message-id:content-type :content-transfer-encoding:mime-version; q=dns; s=default; b=YuX 0IpDokDEUtk08G6opI2Kdn2ZZa4N4WHAqJXScroXcJ2Z8pt9tOOJfKhQBXQiM8eh L+UpObf//A2NZ1YnoSC+0galiFcP6r90zF9qqQsAY0Qw6aOv0jbtfJNynm/tmuDR tjH+vwn51Eo3Xt4inmGt2d4My8siJXxSlQGz+B8Y= 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:from :to:cc:subject:date:message-id:content-type :content-transfer-encoding:mime-version; s=default; bh=DTQwEnz+k 7yX3D1FgjZKqu5dHTE=; b=nZ8Nl32pDp5uQxCe2n96kkFeEBTrOoH0TkD5fjR7w RxFT0LNqveY1yl43pKSoW8iIyzYCA/ufSWQI7l3vOBhFLXjYebN0SHv9WUfEa5yA 7kKCIyIOhUh06Kp3TA5zOTEAbgZg+/7MFf1dwbTCs5Jhz2wdwbb0+Nq8nd5hAOXz rg= Received: (qmail 7005 invoked by alias); 12 Dec 2014 12:21:11 -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 6904 invoked by uid 89); 12 Dec 2014 12:21:10 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-2.0 required=5.0 tests=AWL, BAYES_00, SPF_PASS, T_RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mga01.intel.com Received: from mga01.intel.com (HELO mga01.intel.com) (192.55.52.88) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 12 Dec 2014 12:21:08 +0000 Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga101.fm.intel.com with ESMTP; 12 Dec 2014 04:21:07 -0800 X-ExtLoop1: 1 Received: from irsmsx155.ger.corp.intel.com ([163.33.192.3]) by fmsmga001.fm.intel.com with ESMTP; 12 Dec 2014 04:21:07 -0800 Received: from irsmsx101.ger.corp.intel.com ([169.254.1.126]) by IRSMSX155.ger.corp.intel.com ([169.254.14.228]) with mapi id 14.03.0195.001; Fri, 12 Dec 2014 12:21:06 +0000 From: "Zamyatin, Igor" To: "GCC Patches (gcc-patches@gcc.gnu.org)" CC: "ubizjak@gmail.com" Subject: [PATCH, x86][PIC] Making check for PIC register in address cost calculation only on RTL level Date: Fri, 12 Dec 2014 12:21:05 +0000 Message-ID: <0EFAB2BDD0F67E4FB6CCC8B9F87D756969CDC45C@IRSMSX101.ger.corp.intel.com> MIME-Version: 1.0 X-IsSubscribed: yes Hi! When adding checks for PIC register in address cost calculation (http://gcc.gnu.org/ml/gcc-cvs/2014-10/msg00411.html) it was meant to affect only RTL passes. Since !pic_offset_table_rtx is not enough for it (I see that pic_offset_table_rtx enabled on GIMPLE level) following change explicitly adds this restriction. Bootstrapped and regtested with RUNTESTFLAGS="--target_board='unix{-m32,-fpic}'" Is it ok for trunk? Thanks, Igor Changelog: 2014-12-12 Igor Zamyatin * config/i386/i386.c (ix86_address_cost): Add explicit restriction to RTL level for the check for PIC register. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index fffddfc..799411c 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -12802,12 +12802,14 @@ ix86_address_cost (rtx x, machine_mode, addr_space_t, bool) Therefore only "pic_offset_table_rtx" could be hoisted out, which is not profitable for x86. */ if (parts.base - && (!pic_offset_table_rtx - || REGNO (pic_offset_table_rtx) != REGNO(parts.base)) + && (current_pass->type == GIMPLE_PASS + || (!pic_offset_table_rtx + || REGNO (pic_offset_table_rtx) != REGNO(parts.base))) && (!REG_P (parts.base) || REGNO (parts.base) >= FIRST_PSEUDO_REGISTER) && parts.index - && (!pic_offset_table_rtx - || REGNO (pic_offset_table_rtx) != REGNO(parts.index)) + && (current_pass->type == GIMPLE_PASS + || (!pic_offset_table_rtx + || REGNO (pic_offset_table_rtx) != REGNO(parts.index))) && (!REG_P (parts.index) || REGNO (parts.index) >= FIRST_PSEUDO_REGISTER) && parts.base != parts.index) cost++;