From patchwork Mon Oct 23 17:31:44 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 116823 Delivered-To: patch@linaro.org Received: by 10.140.22.164 with SMTP id 33csp4895937qgn; Mon, 23 Oct 2017 10:32:04 -0700 (PDT) X-Received: by 10.98.20.197 with SMTP id 188mr14072564pfu.94.1508779924054; Mon, 23 Oct 2017 10:32:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1508779924; cv=none; d=google.com; s=arc-20160816; b=C1sWKR1gyrUxfIRELC6r4Iyps2EqGPXmLaULppwDDqCoeOcn7Ha6wxJ0GjWfYRjauH /TpcEorqeRZ0KY3Xpe+SuEMXReuRQul11lohvlo3Fid2pFmiZJU/NSedgTMGDlGXt3Ev iorABRAgCgqL8/ow2iKrE5X4EUlGpUyy4vQTgSy7vg+rVHQY4rKF9c3mmyFVGTxKN4+3 C2X4VeKA2yQn4HD3Z4UyXPYXK1CMnm3ZvXtR90cRuOKN8d5gMwyyA0KErBDyG3eWhgHO 68gipe4fZ18X+Km8THXsUJrFutZG/7WcIu1GP1kixeGyV4Hzr/1r/zajFxcsCwWj4Qqt 3RoQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:user-agent:message-id:in-reply-to:date:references :subject:mail-followup-to:to:from:delivered-to:sender:list-help :list-post:list-archive:list-unsubscribe:list-id:precedence :mailing-list:dkim-signature:domainkey-signature :arc-authentication-results; bh=SO9HmulE46275AIkErdBGO6bHWyq/NV/a2or3Tl7WGM=; b=qcpRfSGHKt4V0VYIerJg24dQFPNoFy4fV7GjcIUMfzjlo72V9jxH4dCUe+AN/H1Zx2 JtJ8VrQW6SLdzjcZJEp03sq4Zc3CafkYAzEUDNyWgICNekbk0W96+AfafCEarIpni2LE xx+CLiyCEJwAAULUKrX6iWNHV/TZcZzUHvsb+IruB9qygM20sioythB56V39xn/e82FN aQTzEZUMp4iz7NtuIEh0Ri9KQ5mleTdhTSkIcgWT2VySipO/djx+nxmi2B9xiIaIIqBn Ah3P9MjIA/f1J9asvZfgq3i1LlpB5HFwntGqyOP/grvNKnRqezSU1SQcBqIDakrBdANN 0fJA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=XdU+CoZT; spf=pass (google.com: domain of gcc-patches-return-464854-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464854-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sourceware.org (server1.sourceware.org. [209.132.180.131]) by mx.google.com with ESMTPS id t1si5167368pgc.703.2017.10.23.10.32.03 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 23 Oct 2017 10:32:04 -0700 (PDT) Received-SPF: pass (google.com: domain of gcc-patches-return-464854-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) client-ip=209.132.180.131; Authentication-Results: mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=XdU+CoZT; spf=pass (google.com: domain of gcc-patches-return-464854-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-464854-patch=linaro.org@gcc.gnu.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org 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:references:date:in-reply-to:message-id:mime-version :content-type; q=dns; s=default; b=W6raH+2AkpgzkEiuSLhzg+WBn9TX3 dDElt6ygm87XNrCT91wwUeP2ONgP0CPTeBusZqBZmb8iDut51Isa9kj376dMHHdf OYrIVntGuNkXdXwmNZM4rficMLxmg+QVvqqp/Ohk8IEX9vKYeZZfN2/UVV+ID32W jmUsV3nECrCf+Q= 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:references:date:in-reply-to:message-id:mime-version :content-type; s=default; bh=idL/Immnc3XPQ0EKHG0KyE5OLjo=; b=XdU +CoZTo4Ps7ksef3Mrm8fXQZWAChZj3HXjfKFZ4Se/BldpSYkNoJWt6s7JIaNd7T6 TDtNdBQLsyXez1VaboR/DmXUeF8OxdxiC/aSY4m1ntjhfccvHQDO7j+TJHvM0b7c pn0eHI/Ve0144ihFtTUAVQosi0K4pLRcmLF+zP1s= Received: (qmail 28457 invoked by alias); 23 Oct 2017 17:31:50 -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 27932 invoked by uid 89); 23 Oct 2017 17:31:49 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.8 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_2, GIT_PATCH_3, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wr0-f169.google.com Received: from mail-wr0-f169.google.com (HELO mail-wr0-f169.google.com) (209.85.128.169) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Mon, 23 Oct 2017 17:31:48 +0000 Received: by mail-wr0-f169.google.com with SMTP id p96so4312836wrb.7 for ; Mon, 23 Oct 2017 10:31:48 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:mail-followup-to:subject:references:date :in-reply-to:message-id:user-agent:mime-version; bh=SO9HmulE46275AIkErdBGO6bHWyq/NV/a2or3Tl7WGM=; b=NTW+9V/fmj+UgNGy9qsoZv7s6SC7BN/MYbpvaPFstXsnxht0u79Zi0Hj8jkMtDfowq CUCZf5P9IcdpMd2h1HYDN5ngbTajYUhOnj3MfV+wLSIGZkyGNwWsrvV+nUzG0ewCRNDv O74NOKHzavv+qbp6oWIEmQ1LUG1Si/hXVCPspVZtOqWN1cvd+O2ZwGE2snypDC/P/EkB n9bjumSJ+SuuQUaxmviKIJSadgfceyGvKOsupSatb0ViwTt0EZqa1+H9G8/PhsHXj8NM 8i1b9q3Nhubg2bcV5i8wVNA4BQQ/4aB1fijEC/8DHNVgFo4Qgk1MB+3V6PItGJspnV4b KDoA== X-Gm-Message-State: AMCzsaVW2XWNalPnesxCFwXHcUuACOzBxhmZCqiqyIhCqdsgfecpBFFU C8yfZGYTx47DfJco8YDDqZjnRK2fx1w= X-Google-Smtp-Source: ABhQp+Rk1AEuSRcj09iEOq26uUIddNghCyWerrTCxZRZrX6hPrJGs4avJjKLhFGm1aLisnP2rC50WA== X-Received: by 10.223.175.232 with SMTP id y40mr12889225wrd.207.1508779906199; Mon, 23 Oct 2017 10:31:46 -0700 (PDT) Received: from localhost ([2.26.27.199]) by smtp.gmail.com with ESMTPSA id l130sm1436435wmd.47.2017.10.23.10.31.45 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 23 Oct 2017 10:31:45 -0700 (PDT) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [078/nnn] poly_int: two-operation SLP References: <871sltvm7r.fsf@linaro.org> Date: Mon, 23 Oct 2017 18:31:44 +0100 In-Reply-To: <871sltvm7r.fsf@linaro.org> (Richard Sandiford's message of "Mon, 23 Oct 2017 17:54:32 +0100") Message-ID: <87inf5hitb.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.2 (gnu/linux) MIME-Version: 1.0 This patch makes two-operation SLP handle but reject variable-length vectors. Adding support for this is a post-GCC8 thing. 2017-10-23 Richard Sandiford Alan Hayward David Sherwood gcc/ * tree-vect-slp.c (vect_build_slp_tree_1): Handle polynomial numbers of units. (vect_schedule_slp_instance): Likewise. Index: gcc/tree-vect-slp.c =================================================================== --- gcc/tree-vect-slp.c 2017-10-23 17:22:42.827179461 +0100 +++ gcc/tree-vect-slp.c 2017-10-23 17:22:43.865071801 +0100 @@ -903,10 +903,19 @@ vect_build_slp_tree_1 (vec_info *vinfo, /* If we allowed a two-operation SLP node verify the target can cope with the permute we are going to use. */ + poly_uint64 nunits = TYPE_VECTOR_SUBPARTS (vectype); if (alt_stmt_code != ERROR_MARK && TREE_CODE_CLASS (alt_stmt_code) != tcc_reference) { - unsigned int count = TYPE_VECTOR_SUBPARTS (vectype); + unsigned HOST_WIDE_INT count; + if (!nunits.is_constant (&count)) + { + if (dump_enabled_p ()) + dump_printf_loc (MSG_MISSED_OPTIMIZATION, vect_location, + "Build SLP failed: different operations " + "not allowed with variable-length SLP.\n"); + return false; + } auto_vec_perm_indices sel (count); for (i = 0; i < count; ++i) { @@ -3796,6 +3805,7 @@ vect_schedule_slp_instance (slp_tree nod /* VECTYPE is the type of the destination. */ vectype = STMT_VINFO_VECTYPE (stmt_info); + poly_uint64 nunits = TYPE_VECTOR_SUBPARTS (vectype); group_size = SLP_INSTANCE_GROUP_SIZE (instance); if (!SLP_TREE_VEC_STMTS (node).exists ()) @@ -3858,13 +3868,16 @@ vect_schedule_slp_instance (slp_tree nod unsigned k = 0, l; for (j = 0; j < v0.length (); ++j) { - unsigned int nunits = TYPE_VECTOR_SUBPARTS (vectype); - auto_vec melts (nunits); - for (l = 0; l < nunits; ++l) + /* Enforced by vect_build_slp_tree, which rejects variable-length + vectors for SLP_TREE_TWO_OPERATORS. */ + unsigned int const_nunits = nunits.to_constant (); + auto_vec melts (const_nunits); + for (l = 0; l < const_nunits; ++l) { if (k >= group_size) k = 0; - tree t = build_int_cst (meltype, mask[k++] * nunits + l); + tree t = build_int_cst (meltype, + mask[k++] * const_nunits + l); melts.quick_push (t); } tmask = build_vector (mvectype, melts);