From patchwork Tue Mar 10 15:11:40 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ilya Enkovich X-Patchwork-Id: 448545 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 E1C181401AF for ; Wed, 11 Mar 2015 02:12:08 +1100 (AEDT) Authentication-Results: ozlabs.org; dkim=pass reason="1024-bit key; unprotected key" header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b=WJVLwpbT; dkim-adsp=none (unprotected policy); dkim-atps=neutral DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:date :from:to:subject:message-id:mime-version:content-type; q=dns; s= default; b=UKQUcmFBeH2AjCcVh0whgkJqDOD/ZCPVftsx31dI9Ovb0P+nZYTuN 1lK2+6lxMV+bZl+3PBAonp6OgZPVeTXDJeBeIY122LEvNEm7ZBIDWQgvNEyebFrE zzmlanPEJdZ7++J82XxpU3wi4SdkZmOw2Pfk0zHuZv6PUJXFsYrNMI= 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:date :from:to:subject:message-id:mime-version:content-type; s= default; bh=iiJHnJ6iGNfLTDpnH1heaGittx8=; b=WJVLwpbTEJPkpozBeC7K Qd9Q/mn2QIkidPpIberCdM8wy/rrtqhsvLHpJuP1/aJYCvergecUOAWrGGyH40iU jFiW4CvPw9bYixBsxB9C3c91xGigPBOx0uhA4ev1ucTz3pglaTGnrIb6caeR+v7D bR1JCHKI1DccCO43B8MS3Nk= 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-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 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 18:11:40 +0300 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-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) X-IsSubscribed: yes 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); +}