From patchwork Wed Jun 13 14:47:29 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "H.J. Lu" X-Patchwork-Id: 164704 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 18E93B7037 for ; Thu, 14 Jun 2012 00:48:01 +1000 (EST) Comment: DKIM? See http://www.dkim.org DKIM-Signature: v=1; a=rsa-sha1; c=relaxed/relaxed; d=gcc.gnu.org; s=default; x=1340203682; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:Date:From:To:Cc:Subject:Message-ID:Reply-To: MIME-Version:Content-Type:Content-Disposition:User-Agent: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=N33p3ktMfcBbs+wJPcz0 y9C0OE8=; b=u6Pw+lgvzHTp/yBk2TKb7ZmdfitDacqnBk95TbitWQylUaaQI0GY nzrr9ujecnThOGHcS38HeaRVkoZgyU9zqwgw5rChdAMQ28MaL1RdnnX3Q63aW+MJ YCHXBvzuJSwsvEYYoopd/jLBhnJhn16fxzIfht/qcWsGM/CLLE+OoO0= Comment: DomainKeys? See http://antispam.yahoo.com/domainkeys DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=default; d=gcc.gnu.org; h=Received:Received:X-SWARE-Spam-Status:X-Spam-Check-By:Received:Received:X-ExtLoop1:Received:Received:Date:From:To:Cc:Subject:Message-ID:Reply-To:MIME-Version:Content-Type:Content-Disposition:User-Agent:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=VmtxZlatJCgs1FEhPZeGfe+Orc3ucSHFijUT5UofzzAct3+RZ9cuS1VhZ5tvPU f9xSULVb1EidAzpIcv6cZuah6AL+jGBK38dGiqNqgS3ld4DdL887hTSU3vcLUIfn mK75xVJzzQWNHnprNWM9+BxLpuIQvlhP0GgFaYLkzlMeY=; Received: (qmail 22132 invoked by alias); 13 Jun 2012 14:47:55 -0000 Received: (qmail 22049 invoked by uid 22791); 13 Jun 2012 14:47:53 -0000 X-SWARE-Spam-Status: No, hits=-4.7 required=5.0 tests=AWL, BAYES_00, FSL_FREEMAIL_1, KHOP_RCVD_UNTRUST, NO_DNS_FOR_FROM, RCVD_IN_DNSWL_HI, RCVD_IN_HOSTKARMA_W, T_RP_MATCHES_RCVD X-Spam-Check-By: sourceware.org Received: from mga14.intel.com (HELO mga14.intel.com) (143.182.124.37) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 13 Jun 2012 14:47:30 +0000 Received: from azsmga001.ch.intel.com ([10.2.17.19]) by azsmga102.ch.intel.com with ESMTP; 13 Jun 2012 07:47:30 -0700 X-ExtLoop1: 1 Received: from gnu-6.sc.intel.com ([10.3.194.135]) by azsmga001.ch.intel.com with ESMTP; 13 Jun 2012 07:47:29 -0700 Received: by gnu-6.sc.intel.com (Postfix, from userid 500) id 9AE4EC201A; Wed, 13 Jun 2012 07:47:29 -0700 (PDT) Date: Wed, 13 Jun 2012 07:47:29 -0700 From: "H.J. Lu" To: gcc-patches@gcc.gnu.org Cc: Uros Bizjak Subject: PATCH: PR target/53647: Set proper cache values when needed Message-ID: <20120613144729.GA565@intel.com> Reply-To: "H.J. Lu" MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.21 (2010-09-15) 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 Hi, On i386, ix86_size_cost will be used for -Os, which has zero for simultaneous_prefetches, prefetch_block, l1_cache_size and l2_cache_size. This patch adds ix86_tune_cost and uses it for simultaneous_prefetches, prefetch_block, l1_cache_size and l2_cache_size if ones from ix86_cost are zero. OK to install? Thanks. H.J. --- 2012-06-13 H.J. Lu PR target/53647 * config/i386/i386.c (ix86_tune_cost): New variable. (ix86_option_override_internal): Set ix86_tune_cost. Use ix86_tune_cost for simultaneous_prefetches, prefetch_block, l1_cache_size and l2_cache_size if ones from ix86_cost are zero. diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index 13755f4..2e64d55 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -1874,6 +1874,10 @@ struct processor_costs generic32_cost = { 1, /* cond_not_taken_branch_cost. */ }; +/* Set by -mtune. */ +const struct processor_costs *ix86_tune_cost = &pentium_cost; + +/* Set by -mtune or -Os. */ const struct processor_costs *ix86_cost = &pentium_cost; /* Processor feature/optimization bitmasks. */ @@ -3546,6 +3550,7 @@ ix86_option_override_internal (bool main_args_p) flag_pcc_struct_return = DEFAULT_PCC_STRUCT_RETURN; } + ix86_tune_cost = processor_target_table[ix86_tune].cost; if (optimize_size) ix86_cost = &ix86_size_cost; else @@ -3794,16 +3799,27 @@ ix86_option_override_internal (bool main_args_p) flag_schedule_insns_after_reload = flag_schedule_insns = 0; maybe_set_param_value (PARAM_SIMULTANEOUS_PREFETCHES, - ix86_cost->simultaneous_prefetches, + ix86_cost->simultaneous_prefetches + ? ix86_cost->simultaneous_prefetches + : ix86_tune_cost->simultaneous_prefetches, global_options.x_param_values, global_options_set.x_param_values); - maybe_set_param_value (PARAM_L1_CACHE_LINE_SIZE, ix86_cost->prefetch_block, + maybe_set_param_value (PARAM_L1_CACHE_LINE_SIZE, + ix86_cost->prefetch_block + ? ix86_cost->prefetch_block + : ix86_tune_cost->prefetch_block, global_options.x_param_values, global_options_set.x_param_values); - maybe_set_param_value (PARAM_L1_CACHE_SIZE, ix86_cost->l1_cache_size, + maybe_set_param_value (PARAM_L1_CACHE_SIZE, + ix86_cost->l1_cache_size + ? ix86_cost->l1_cache_size + : ix86_tune_cost->l1_cache_size, global_options.x_param_values, global_options_set.x_param_values); - maybe_set_param_value (PARAM_L2_CACHE_SIZE, ix86_cost->l2_cache_size, + maybe_set_param_value (PARAM_L2_CACHE_SIZE, + ix86_cost->l2_cache_size + ? ix86_cost->l2_cache_size + : ix86_cost->l2_cache_size, global_options.x_param_values, global_options_set.x_param_values);