From patchwork Wed Jun 27 03:20:58 2012 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Henderson X-Patchwork-Id: 167493 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 E05D2B6EE6 for ; Wed, 27 Jun 2012 13:21:42 +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=1341372103; h=Comment: DomainKey-Signature:Received:Received:Received:Received:Received: Received:From:To:Subject:Date:Message-Id:In-Reply-To:References: Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive: List-Post:List-Help:Sender:Delivered-To; bh=tk5z1PdaOCZ8WdEEsSXv aNaVC08=; b=XJYzbwJhcKTyohXtzxbO87+CkWuhxeo/H1dcVW5B2EUBQwc24ReR rqgy+p55y8BICmPo879Tal907CPk+TrNIyK1eueo2ee8pCVXpBaImiShSxn5K4B7 N1PT9jDXiZr0EU7xQ5tckq2YVfTXeJw0ZapnMnFaXwZwzDnDe6SBwHU= 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:Received:Received:From:To:Subject:Date:Message-Id:In-Reply-To:References:X-IsSubscribed:Mailing-List:Precedence:List-Id:List-Unsubscribe:List-Archive:List-Post:List-Help:Sender:Delivered-To; b=ESGMxwUKrnkZc+XadBPP86twoaGSWL/bhh+l4qYjzDlq1vV+6WCrXwvbQHd3ly WWUhJZktYW8m9wRrUflovMww1XIzJOB2XVUx+nQC16q7h9anIYhd+SbAE5799+ik dqvBkekl1X/LkV9/UwnRDHDnBtgI6/qiTD0BTgIdGp4xw=; Received: (qmail 27269 invoked by alias); 27 Jun 2012 03:21:30 -0000 Received: (qmail 27199 invoked by uid 22791); 27 Jun 2012 03:21:28 -0000 X-SWARE-Spam-Status: No, hits=-4.7 required=5.0 tests=AWL, BAYES_00, DKIM_SIGNED, DKIM_VALID, FREEMAIL_ENVFROM_END_DIGIT, FREEMAIL_FROM, KHOP_RCVD_TRUST, KHOP_THREADED, RCVD_IN_DNSWL_LOW, RCVD_IN_HOSTKARMA_YE X-Spam-Check-By: sourceware.org Received: from mail-pb0-f47.google.com (HELO mail-pb0-f47.google.com) (209.85.160.47) by sourceware.org (qpsmtpd/0.43rc1) with ESMTP; Wed, 27 Jun 2012 03:21:06 +0000 Received: by pbbrq2 with SMTP id rq2so998082pbb.20 for ; Tue, 26 Jun 2012 20:21:06 -0700 (PDT) Received: by 10.68.232.197 with SMTP id tq5mr58435963pbc.53.1340767266089; Tue, 26 Jun 2012 20:21:06 -0700 (PDT) Received: from anchor.twiddle.home ([173.160.232.49]) by mx.google.com with ESMTPS id tj8sm8666575pbc.10.2012.06.26.20.21.05 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 26 Jun 2012 20:21:05 -0700 (PDT) From: Richard Henderson To: gcc-patches@gcc.gnu.org Subject: [PATCH 3/3] i386: Correct costs on CONST_DOUBLE and CONST_VECTOR Date: Tue, 26 Jun 2012 20:20:58 -0700 Message-Id: <1340767258-21086-3-git-send-email-rth@redhat.com> In-Reply-To: <1340767258-21086-1-git-send-email-rth@redhat.com> References: <1340767258-21086-1-git-send-email-rth@redhat.com> X-IsSubscribed: yes 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 We were always falling through to the memory default. Also use standard_sse_constant_p on CONST_VECTOR. * config/i386/i386.c (ix86_rtx_costs): Use standard_sse_constant_p and don't fall thru from standard_80387_constant_p to the memory fallback, --- gcc/ChangeLog | 6 ++++++ gcc/config/i386/i386.c | 48 +++++++++++++++++++++++++++++++----------------- 2 files changed, 37 insertions(+), 17 deletions(-) diff --git a/gcc/config/i386/i386.c b/gcc/config/i386/i386.c index b96fc6e..edfc649 100644 --- a/gcc/config/i386/i386.c +++ b/gcc/config/i386/i386.c @@ -32102,24 +32102,38 @@ ix86_rtx_costs (rtx x, int code_i, int outer_code_i, int opno, int *total, case CONST_DOUBLE: if (mode == VOIDmode) - *total = 0; - else - switch (standard_80387_constant_p (x)) - { - case 1: /* 0.0 */ - *total = 1; - break; - default: /* Other constants */ - *total = 2; - break; - case 0: - case -1: - break; - } - /* FALLTHRU */ - + { + *total = 0; + return true; + } + switch (standard_80387_constant_p (x)) + { + case 1: /* 0.0 */ + *total = 1; + return true; + default: /* Other constants */ + *total = 2; + return true; + case 0: + case -1: + break; + } + if (SSE_FLOAT_MODE_P (mode)) + { case CONST_VECTOR: - /* Start with (MEM (SYMBOL_REF)), since that's where + switch (standard_sse_constant_p (x)) + { + case 0: + break; + case 1: /* 0: xor eliminates false dependency */ + *total = 0; + return true; + default: /* -1: cmp contains false dependency */ + *total = 1; + return true; + } + } + /* Fall back to (MEM (SYMBOL_REF)), since that's where it'll probably end up. Add a penalty for size. */ *total = (COSTS_N_INSNS (1) + (flag_pic != 0 && !TARGET_64BIT)