From patchwork Fri Jun 6 08:52:20 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bingfeng Mei X-Patchwork-Id: 356724 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 55885140087 for ; Fri, 6 Jun 2014 18:52:33 +1000 (EST) DomainKey-Signature: a=rsa-sha1; c=nofws; d=gcc.gnu.org; h=list-id :list-unsubscribe:list-archive:list-post:list-help:sender:from :to:subject:date:message-id:content-type :content-transfer-encoding:mime-version; q=dns; s=default; b=kVn K/HHIrrXc3RazPkRj7xKe1uXcRWORVd5njV6CeWvFNlhpYteeC1YJcxyLGTwzHox KQ0IPxupZ5//MbiRmKYWX53Yc1fXU/yB/ikKt+0hTGxT37AkuypbuKSMiUJMQ2Wy tvzrsLKmly+WbOcS2tcvopke304ot/mRYet5bdes= 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:from :to:subject:date:message-id:content-type :content-transfer-encoding:mime-version; s=default; bh=k+iJBUh/s ZDQaCRptC1h6g7JkFE=; b=m80X/rBSbucaLjBE5gZ2pXx573Lmr+BFql6tofYzZ 7gqwlhk2OO6Ejy1wkRpvvBDguvz2ruY6rSo1vm25derPHQCwpxBplfa4z6Jkgxoo iaz0jlGhkFVhMM03viQRMT3IU40Pf2P0toNVbehzX7fBDtQbhUnXje5CDhObXPKz xk= Received: (qmail 27996 invoked by alias); 6 Jun 2014 08:52:25 -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 27964 invoked by uid 89); 6 Jun 2014 08:52:23 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-1.7 required=5.0 tests=AWL, BAYES_00, RP_MATCHES_RCVD autolearn=ham version=3.3.2 X-HELO: mail-gw1-out.broadcom.com Received: from mail-gw1-out.broadcom.com (HELO mail-gw1-out.broadcom.com) (216.31.210.62) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Fri, 06 Jun 2014 08:52:22 +0000 Received: from irvexchcas07.broadcom.com (HELO IRVEXCHCAS07.corp.ad.broadcom.com) ([10.9.208.55]) by mail-gw1-out.broadcom.com with ESMTP; 06 Jun 2014 02:03:10 -0700 Received: from SJEXCHCAS04.corp.ad.broadcom.com (10.16.203.10) by IRVEXCHCAS07.corp.ad.broadcom.com (10.9.208.55) with Microsoft SMTP Server (TLS) id 14.3.174.1; Fri, 6 Jun 2014 01:52:20 -0700 Received: from SJEXCHMB13.corp.ad.broadcom.com ([fe80::9d40:1e86:a7dc:c46a]) by SJEXCHCAS04.corp.ad.broadcom.com ([::1]) with mapi id 14.03.0174.001; Fri, 6 Jun 2014 01:52:20 -0700 From: Bingfeng Mei To: "gcc-patches@gcc.gnu.org" Subject: [PATCH] default_add_stmt_cost should call target specific builitin_vectorization_cost. Date: Fri, 6 Jun 2014 08:52:20 +0000 Message-ID: MIME-Version: 1.0 X-IsSubscribed: yes Hi, I came across this issue a while back. My colleague Paulo Matos asked and it was agreed that this is a bug. But he forgot to submit a patch. default_add_stmt_cost should call target specific builtin_vectozriation_cost. instead of default_builtin_vectorization_cost directly. So if the hook TARGET_VECTORIZE_BUILTIN_VECTORIZATION_COST is defined, it will use that cost. Otherwise, it will fall back to default_builtin_vectorization_cost. Bootstrapped and tested. OK for trunk? Thanks, Bingfeng Mei Index: gcc/ChangeLog =================================================================== --- gcc/ChangeLog (revision 211281) +++ gcc/ChangeLog (working copy) @@ -1,3 +1,8 @@ +2014-06-05 Bingfeng Mei + + * targhooks.c (default_add_stmt_cost): Call target specific + hook instead of default one. + 2014-06-05 Ilya Enkovich * tree-inline.c (tree_function_versioning): Check DF info existence Index: gcc/targhooks.c =================================================================== --- gcc/targhooks.c (revision 211281) +++ gcc/targhooks.c (working copy) @@ -1073,8 +1073,8 @@ default_add_stmt_cost (void *data, int c unsigned retval = 0; tree vectype = stmt_info ? stmt_vectype (stmt_info) : NULL_TREE; - int stmt_cost = default_builtin_vectorization_cost (kind, vectype, - misalign); + int stmt_cost = targetm.vectorize.builtin_vectorization_cost (kind, vectype, + misalign); /* Statements in an inner loop relative to the loop being vectorized are weighted more heavily. The value here is arbitrary and could potentially be improved with analysis. */