From patchwork Tue Oct 17 13:34:15 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jan Hubicka X-Patchwork-Id: 827010 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=gcc.gnu.org (client-ip=209.132.180.131; helo=sourceware.org; envelope-from=gcc-patches-return-464330-incoming=patchwork.ozlabs.org@gcc.gnu.org; receiver=) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=gcc.gnu.org header.i=@gcc.gnu.org header.b="kuVA2VpU"; dkim-atps=neutral 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 3yGblB2m5vz9s8J for ; Wed, 18 Oct 2017 00:34:29 +1100 (AEDT) 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=tqOUAXK/q6/7C6m8BqfYuhLL+YdRZ3nAkd/zIjxf+d8skcJnDpeKl nd+LbZFdxRiINCZxsBGdWCtF9NL6HNSnMND6PsiZaNmieimyDm3p+h8QaucSyHxg qldA1u776kMjsi1tdwMaVHeZF1d1dMbnaht5wZnnnb48m1orqBdbVE= 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=PVw3pWoUe3GWHMIqhZ0lJzDMFq8=; b=kuVA2VpUj5y+Xudyb32L VEI6PCBQA9VxVu5lk13MQaLYOP2FLWDLCpn5aRF2bEMHvSfLwBS3N6yjhYAPrpNr UDmImdHRXVoJ3gRKHkM7bPKs6fznwdMub/OMgZTcUfLFIgdUmey3BAmweZBa6Jxs I/dTOAMEtTx591yAIUEI790= Received: (qmail 128794 invoked by alias); 17 Oct 2017 13:34:21 -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 128770 invoked by uid 89); 17 Oct 2017 13:34:19 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-9.6 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, KAM_LAZY_DOMAIN_SECURITY, RP_MATCHES_RCVD autolearn=ham version=3.3.2 spammy=253789 X-HELO: nikam.ms.mff.cuni.cz Received: from nikam.ms.mff.cuni.cz (HELO nikam.ms.mff.cuni.cz) (195.113.20.16) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Tue, 17 Oct 2017 13:34:17 +0000 Received: by nikam.ms.mff.cuni.cz (Postfix, from userid 16202) id 3D5EC548965; Tue, 17 Oct 2017 15:34:15 +0200 (CEST) Date: Tue, 17 Oct 2017 15:34:15 +0200 From: Jan Hubicka To: gcc-patches@gcc.gnu.org, rguenther@suse.de, Venkataramanan.Kumar@amd.com Subject: [RFA] Zen tuning part 9: Add support for scatter/gather in vectorizer costmodel Message-ID: <20171017133415.GC94155@kam.mff.cuni.cz> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Hi, gether/scatter loads tends to be expensive (at least for x86) while we now account them as vector loads/stores which are cheap. This patch adds vectorizer cost entry for these so this can be modelled more realistically. Bootstrapped/regtested x86_64-linux, OK? Honza 2017-10-17 Jan Hubicka * target.h (enum vect_cost_for_stmt): Add vec_gather_load and vec_scatter_store * tree-vect-stmts.c (record_stmt_cost): Make difference between normal and scatter/gather ops. * aarch64/aarch64.c (aarch64_builtin_vectorization_cost): Add vec_gather_load and vec_scatter_store. * arm/arm.c (arm_builtin_vectorization_cost): Likewise. * powerpcspe/powerpcspe.c (rs6000_builtin_vectorization_cost): Likewise. * rs6000/rs6000.c (rs6000_builtin_vectorization_cost): Likewise. * s390/s390.c (s390_builtin_vectorization_cost): Likewise. * spu/spu.c (spu_builtin_vectorization_cost): Likewise. Index: config/aarch64/aarch64.c =================================================================== --- config/aarch64/aarch64.c (revision 253789) +++ config/aarch64/aarch64.c (working copy) @@ -8547,9 +8547,10 @@ aarch64_builtin_vectorization_cost (enum return fp ? costs->vec_fp_stmt_cost : costs->vec_int_stmt_cost; case vector_load: + case vector_gather_load: return costs->vec_align_load_cost; - case vector_store: + case vector_scatter_store: return costs->vec_store_cost; case vec_to_scalar: Index: config/arm/arm.c =================================================================== --- config/arm/arm.c (revision 253789) +++ config/arm/arm.c (working copy) @@ -11241,9 +11241,11 @@ arm_builtin_vectorization_cost (enum vec return current_tune->vec_costs->vec_stmt_cost; case vector_load: + case vector_gather_load: return current_tune->vec_costs->vec_align_load_cost; case vector_store: + case vector_scatter_store: return current_tune->vec_costs->vec_store_cost; case vec_to_scalar: Index: config/powerpcspe/powerpcspe.c =================================================================== --- config/powerpcspe/powerpcspe.c (revision 253789) +++ config/powerpcspe/powerpcspe.c (working copy) @@ -5834,6 +5834,8 @@ rs6000_builtin_vectorization_cost (enum case vector_stmt: case vector_load: case vector_store: + case vector_gather_load: + case vector_scatter_store: case vec_to_scalar: case scalar_to_vec: case cond_branch_not_taken: Index: config/rs6000/rs6000.c =================================================================== --- config/rs6000/rs6000.c (revision 253789) +++ config/rs6000/rs6000.c (working copy) @@ -5398,6 +5398,8 @@ rs6000_builtin_vectorization_cost (enum case vector_stmt: case vector_load: case vector_store: + case vector_gather_load: + case vector_scatter_store: case vec_to_scalar: case scalar_to_vec: case cond_branch_not_taken: Index: config/s390/s390.c =================================================================== --- config/s390/s390.c (revision 253789) +++ config/s390/s390.c (working copy) @@ -3717,6 +3717,8 @@ s390_builtin_vectorization_cost (enum ve case vector_stmt: case vector_load: case vector_store: + case vector_gather_load: + case vector_scatter_store: case vec_to_scalar: case scalar_to_vec: case cond_branch_not_taken: Index: config/spu/spu.c =================================================================== --- config/spu/spu.c (revision 253789) +++ config/spu/spu.c (working copy) @@ -6625,6 +6625,8 @@ spu_builtin_vectorization_cost (enum vec case vector_stmt: case vector_load: case vector_store: + case vector_gather_load: + case vector_scatter_store: case vec_to_scalar: case scalar_to_vec: case cond_branch_not_taken: Index: target.h =================================================================== --- target.h (revision 253789) +++ target.h (working copy) @@ -171,9 +171,11 @@ enum vect_cost_for_stmt scalar_store, vector_stmt, vector_load, + vector_gather_load, unaligned_load, unaligned_store, vector_store, + vector_scatter_store, vec_to_scalar, scalar_to_vec, cond_branch_not_taken, Index: tree-vect-stmts.c =================================================================== --- tree-vect-stmts.c (revision 253789) +++ tree-vect-stmts.c (working copy) @@ -95,6 +95,12 @@ record_stmt_cost (stmt_vector_for_cost * enum vect_cost_for_stmt kind, stmt_vec_info stmt_info, int misalign, enum vect_cost_model_location where) { + if ((kind == vector_load || kind == unaligned_load) + && STMT_VINFO_GATHER_SCATTER_P (stmt_info)) + kind = vector_gather_load; + if ((kind == vector_store || kind == unaligned_store) + && STMT_VINFO_GATHER_SCATTER_P (stmt_info)) + kind = vector_scatter_store; if (body_cost_vec) { tree vectype = stmt_info ? stmt_vectype (stmt_info) : NULL_TREE;