From patchwork Sat Dec 9 23:20:54 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 121298 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1164766qgn; Sat, 9 Dec 2017 15:21:12 -0800 (PST) X-Google-Smtp-Source: AGs4zMbyyOWzmxe2B9HT86sC0LWVBwunI1mjv92yqIvM3luVUQbnyTVmWxKrCcv6I2sg1MATWzjr X-Received: by 10.99.122.3 with SMTP id v3mr32923067pgc.394.1512861672168; Sat, 09 Dec 2017 15:21:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512861672; cv=none; d=google.com; s=arc-20160816; b=Ymdr16QHtRLtvQW+7zHccrA+uiXaa9K83yBUM0QXn3GUI9CqFcgTKPxIlQiAak4MEP FYYGGvAU+4KJB15uwc/yvX8e0oVM1fsCWTTK53NL/j4QLg1qgQtkiOPlqzjwLRp8kjgu ETuMsM3/tvwoZtleyAx2/juioduvxQPma/Gpk4LHKQ+o6c/X5Gt1bBFkSh3aCH/CJIKM c1Qyt4QyAJDPAaMyY+6Z7UFwH0UE1nvj7k+dT8z14OK3SlQMZbsy3yraE5Eyo1EaCI75 3mcKGwpA05TLaNumv/CUPcy+ErXmnQg2z8u1h8Pu1qgvZtHxY5vgk5Qk36Cbmxubx1Sx Uj7w== 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=LDan7GiGx/Ks5YEW/622PosOVVvuOMpGHKyAaX2UZwM=; b=N8hMI/DG6/rP7nTMUK6YYDNoGgltRDeGLlpEIFv4EgbSUf7fcAIoF4DxkGs6gjnQOY OlI7Q1Q3e8+8C0e6UmEKAAFKOcpA5f9H/F3Tye3d9EEw781MUdTAXhAg3DJ4oUeozH7y 73f8b/K64dHgMh3px8ijkId8bSOT8Cqc7JuJGvgxRAww2/dqAzRmx6IoXPqyNI/pi4Do jdqBhtMl/hFsV/BUvnpObdVUPw0Yxs9V42RYjwIDXZuOZZypfGuuuoP3EX45euJQ+wR7 Ub0iu1cuLiJlZkY3/bKs4XbrqUYL/kpR9lXd7t7fBnhKGPEFDFTEWzx1dV2EzQV64kTa +XXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=i8+t6Y3x; spf=pass (google.com: domain of gcc-patches-return-468858-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-468858-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 d4si7673782pgn.730.2017.12.09.15.21.11 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Dec 2017 15:21:12 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-468858-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=i8+t6Y3x; spf=pass (google.com: domain of gcc-patches-return-468858-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-468858-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=AYqsdfkVGW6dXDEOe9CIdBY19oZR/ DAJ3WOk8pQcZHEox0WhSHygy4mY3SJFH3zMy4xYoRK6u8IvRQ4iRjWsYwBq+Klby RAyKn7wooG+cZECCFSpevrfdkDB8F7nYm/xcViFrMlT56LU6BCIlqSTDSlZhd/p/ BOyEDT2tGTBjow= 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=KKPGbyekB8nTsZ6BebpHlRjQuTs=; b=i8+ t6Y3xi7fs1HXR5qPA7R5bcpmA2nYMp6CYw1iML3SWhO2uPOttlfUfJ3i26sd+D3J wYRpdWj0NH9pouly7rVQlO1jaQRu7MAcGea9uLLB+1Nk4yi7OEuSMY/oVOoqHfRM GSkC5JM3QdjrlJZQBvIQwGQjufZmsjNNb1vMX1Q8= Received: (qmail 101967 invoked by alias); 9 Dec 2017 23:20:59 -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 101957 invoked by uid 89); 9 Dec 2017 23:20:59 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-15.5 required=5.0 tests=AWL, BAYES_00, GIT_PATCH_1, GIT_PATCH_2, GIT_PATCH_3, KAM_ASCII_DIVIDERS, RCVD_IN_DNSWL_NONE, SPF_PASS autolearn=ham version=3.3.2 spammy= X-HELO: mail-wm0-f48.google.com Received: from mail-wm0-f48.google.com (HELO mail-wm0-f48.google.com) (74.125.82.48) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 09 Dec 2017 23:20:57 +0000 Received: by mail-wm0-f48.google.com with SMTP id 9so8505736wme.4 for ; Sat, 09 Dec 2017 15:20:57 -0800 (PST) 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=LDan7GiGx/Ks5YEW/622PosOVVvuOMpGHKyAaX2UZwM=; b=jW6w5xHzYfOSCPfsPqAeQNFjJbJh2PqrOVNu56PAqUYzrw7bx1W+Wb0EIOWBFClHQt tpz5yi0PfUkgyp/ornJ5qJKYECqXyHo0L+PIuzrI8K5fsgeYOUE3wDX9BQTTkThPrxf/ K/+G8X7vnCoWO1/5uOitbVMksbqXtk2cJO2n2bFNQ1YhqBP5CnJZltadPFAIrxXtEJZR MMfn71/AvuuFCqCMmT5OCan98N2ahFfxFQ3BqkuZOga1jhA1ac+0ry6IADVVk4G6YUx7 u7hFng8Gqpuz25DiVjIl01r1vhwqKV3uxu/5RdN92Gukk28VW7FkEfMboShqUqc3PQay LtWA== X-Gm-Message-State: AKGB3mJAAFVQ+VfjR9DRU5ekTwNIl2CoqfDsW6qeFyvUJyTFFZUbgZyt 0kk/XQWkYyWeZYhwoM7y8NJSjPsdY/A= X-Received: by 10.28.208.205 with SMTP id h196mr7944750wmg.160.1512861655540; Sat, 09 Dec 2017 15:20:55 -0800 (PST) Received: from localhost ([2.25.234.120]) by smtp.gmail.com with ESMTPSA id e3sm12064841wra.0.2017.12.09.15.20.54 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Dec 2017 15:20:54 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [08/13] Add a vec_perm_indices_to_tree helper function References: <87indfmrgt.fsf@linaro.org> Date: Sat, 09 Dec 2017 23:20:54 +0000 In-Reply-To: <87indfmrgt.fsf@linaro.org> (Richard Sandiford's message of "Sat, 09 Dec 2017 23:06:26 +0000") Message-ID: <87h8szlc89.fsf@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 This patch adds a function for creating a VECTOR_CST from a vec_perm_indices, operating directly on the encoding. 2017-12-09 Richard Sandiford gcc/ * vec-perm-indices.h (vec_perm_indices_to_tree): Declare. * vec-perm-indices.c (vec_perm_indices_to_tree): New function. * tree-ssa-forwprop.c (simplify_vector_constructor): Use it. * tree-vect-slp.c (vect_transform_slp_perm_load): Likewise. * tree-vect-stmts.c (vectorizable_bswap): Likewise. (vect_gen_perm_mask_any): Likewise. Index: gcc/vec-perm-indices.h =================================================================== --- gcc/vec-perm-indices.h 2017-12-09 22:48:47.548825399 +0000 +++ gcc/vec-perm-indices.h 2017-12-09 22:48:50.361942571 +0000 @@ -73,6 +73,7 @@ typedef int_vector_builder vec_oprnds = vNULL; @@ -6521,17 +6518,10 @@ vect_gen_perm_mask_any (tree vectype, co { tree mask_elt_type, mask_type; - unsigned int nunits = sel.length (); - gcc_checking_assert (nunits == TYPE_VECTOR_SUBPARTS (vectype)); - mask_elt_type = lang_hooks.types.type_for_mode (int_mode_for_mode (TYPE_MODE (TREE_TYPE (vectype))).require (), 1); mask_type = get_vectype_for_scalar_type (mask_elt_type); - - tree_vector_builder mask_elts (mask_type, nunits, 1); - for (unsigned int i = 0; i < nunits; ++i) - mask_elts.quick_push (build_int_cst (mask_elt_type, sel[i])); - return mask_elts.build (); + return vec_perm_indices_to_tree (mask_type, sel); } /* Checked version of vect_gen_perm_mask_any. Asserts can_vec_perm_const_p,