From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 54391 invoked by alias); 10 Mar 2015 15:11:59 -0000 Mailing-List: contact gcc-patches-help@gcc.gnu.org; run by ezmlm Precedence: bulk List-Id: List-Archive: List-Post: List-Help: Sender: gcc-patches-owner@gcc.gnu.org Received: (qmail 54379 invoked by uid 89); 10 Mar 2015 15:11:58 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=1.4 required=5.0 tests=AWL,BAYES_00,FREEMAIL_FROM,KAM_FROM_URIBL_PCCC,KAM_STOCKGEN,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-ie0-f178.google.com Received: from mail-ie0-f178.google.com (HELO mail-ie0-f178.google.com) (209.85.223.178) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Tue, 10 Mar 2015 15:11:54 +0000 Received: by iecvj10 with SMTP id vj10so18456653iec.0 for ; Tue, 10 Mar 2015 08:11:52 -0700 (PDT) X-Received: by 10.50.136.228 with SMTP id qd4mr85042991igb.13.1426000312280; Tue, 10 Mar 2015 08:11:52 -0700 (PDT) Received: from msticlxl57.ims.intel.com (fmdmzpr02-ext.fm.intel.com. [192.55.55.37]) by mx.google.com with ESMTPSA id n15sm624485ioe.6.2015.03.10.08.11.50 for (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 10 Mar 2015 08:11:51 -0700 (PDT) Date: Tue, 10 Mar 2015 15:11:00 -0000 From: Ilya Enkovich To: gcc-patches@gcc.gnu.org Subject: [PATCH, PR target/65103, 3/3] Change rtx cost for i386 address constants Message-ID: <20150310151140.GD27860@msticlxl57.ims.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2015-03/txt/msg00567.txt.bz2 Hi, This patch changes rtx cost for address constants to 0 similar to what we have in address cost hook beacuse we expect them to be propagated into address expression anyway. Bootstrapped and tested on x86_64-unknown-linux-gnu. OK for trunk or stage 1? Thanks, Ilya -- gcc/ 2015-03-10 Ilya Enkovich PR target/65103 * gcc/config/i386/i386.c (ix86_rtx_costs): We want to propagate link time constants into adress expressions and therefore set their cost to 0. gcc/testsuite/ 2015-03-10 Ilya Enkovich PR target/65103 * gcc.target/i386/pr65103-3.c: New. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index b3971b8..341a157 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -42039,7 +42039,8 @@ ix86_rtx_costs (rtx x, int code_i, int outer_code_i, int opno, int *total, && !(TARGET_64BIT && (GET_CODE (x) == LABEL_REF || (GET_CODE (x) == SYMBOL_REF - && SYMBOL_REF_LOCAL_P (x))))) + && SYMBOL_REF_LOCAL_P (x)))) + && (TARGET_64BIT || GET_CODE (x) != CONST)) *total = 1; else *total = 0; diff --git a/gcc/testsuite/gcc.target/i386/pr65103-3.c b/gcc/testsuite/gcc.target/i386/pr65103-3.c new file mode 100644 index 0000000..1481bf9 --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr65103-3.c @@ -0,0 +1,18 @@ +/* { dg-do compile { target ia32 } } */ +/* { dg-options "-m32 -O2 -fPIE" } */ +/* { dg-final { scan-assembler-not "GOTOFF," } } */ + +static int *data[100]; + +void test (long a, long b) +{ + do + { + if( a < b ) + { + data[a] = data[b]; + a++; + } + } + while (a <= b); +}