From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (qmail 41358 invoked by alias); 13 May 2015 08:23:41 -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 41342 invoked by uid 89); 13 May 2015 08:23:40 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=0.5 required=5.0 tests=AWL,BAYES_40,FREEMAIL_FROM,KAM_STOCKGEN,RCVD_IN_DNSWL_LOW,SPF_PASS autolearn=no version=3.3.2 X-HELO: mail-wg0-f53.google.com Received: from mail-wg0-f53.google.com (HELO mail-wg0-f53.google.com) (74.125.82.53) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with (AES128-GCM-SHA256 encrypted) ESMTPS; Wed, 13 May 2015 08:23:39 +0000 Received: by wgnd10 with SMTP id d10so32912673wgn.2 for ; Wed, 13 May 2015 01:23:36 -0700 (PDT) X-Received: by 10.194.192.72 with SMTP id he8mr38360071wjc.11.1431505416653; Wed, 13 May 2015 01:23:36 -0700 (PDT) Received: from msticlxl57.ims.intel.com (fmdmzpr04-ext.fm.intel.com. [192.55.55.39]) by mx.google.com with ESMTPSA id hu1sm6764157wib.6.2015.05.13.01.23.33 (version=TLSv1 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 13 May 2015 01:23:35 -0700 (PDT) Date: Wed, 13 May 2015 08:39:00 -0000 From: Ilya Enkovich To: Uros Bizjak Cc: "gcc-patches@gcc.gnu.org" Subject: Re: [PATCH, PR target/65103, 3/3] Change rtx cost for i386 address constants Message-ID: <20150513082054.GC47912@msticlxl57.ims.intel.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes X-SW-Source: 2015-05/txt/msg01182.txt.bz2 On 12 May 17:33, Uros Bizjak wrote: > Hello! > > >> 2015-03-10 Ilya Enkovich > >> > >> PR target/65103 > >> * 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)) > > Please also add a one-line comment for the new condition. > > OK with this change. > > Uros. Thanks! Here is committed version. Ilya -- gcc/ 2015-05-13 Ilya Enkovich PR target/65103 * 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-05-13 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 fd52d89..d739f89 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -42005,7 +42005,9 @@ 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)))) + /* Use 0 cost for CONST to improve its propagation. */ + && (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..eddf20b --- /dev/null +++ b/gcc/testsuite/gcc.target/i386/pr65103-3.c @@ -0,0 +1,19 @@ +/* { dg-do compile { target ia32 } } */ +/* { dg-require-effective-target pie } */ +/* { dg-options "-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); +}