From patchwork Sat Dec 9 23:25:09 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Richard Sandiford X-Patchwork-Id: 121301 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp1167372qgn; Sat, 9 Dec 2017 15:25:26 -0800 (PST) X-Google-Smtp-Source: AGs4zMbH3p3HFlvytxkY4SAQOB7xW8Fzlu0S3Z/0pxvX6/4COEpHzgWd2pSHw8iQ6FYw2NdUMuyd X-Received: by 10.84.143.70 with SMTP id 64mr34637709ply.277.1512861926749; Sat, 09 Dec 2017 15:25:26 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512861926; cv=none; d=google.com; s=arc-20160816; b=cyfrTHuIIU1qR+IdjGJX4Xm62PTG2n9mxSy6b0+BE43WF7AK3842Cv3FPTbKt7yWN6 CIEj6b9w1QnzDVdLLPcQ5LR3/UfXdReewdUt1Jrm30m87hto8C7GnvmMVECFfV5hRtWE VYzdmgqufnGvNqMVo9RHu48Xr9BR3c9zjeK+QxYzYauVsXPTL0Gqab6mjRBAcJPqr9mu 5pMOr4pB0Yp0PTl4xjjge8nEUdIgnP8rmoSqiemFUR+Yol9QvrKEEJ3W0NAI9KyW1Avn Gn2j+FA9mKS7iA/w68BgGA6z7LgjQP7tefSbQjsceC6ut5I/zKFZmdNOnTPruCigG04K LAUw== 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=COYpxelZ5xPd25qvlL1FxMAi9mGRYKURy65PkcONibU=; b=ay2J7b8rKyKHCDSsJmo5q69GCtHf7g7te/tJvuOInwbP5thmLbWb9V040xQEfo5dww nxbnfQGQkzJWSgF5fSLLKK1glr5x2viY2DYPsAXZa7lBWc5zyWZAGtIzzMGRjWA6MNdu CrZHFxevsWNZ/Cu+TEWG+bhj+pF1nWjVgiqFUkSQqcSclsMS0YyuUg6x58Mq+Z+3D5wN 1OVjNt+fzALxYQ2DBYit5M4BGIRYWH2KeLKQb7OsMYly7a2Mq8twIK35sIJjeXeDgN03 72bD05MxdyJf07CXOGeROugj7vcK2JFwdLNpOuLSHxtCjpHyNGv+h8OGVfXc6GD47rfC 4VXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gcc.gnu.org header.s=default header.b=G9uw2BI+; spf=pass (google.com: domain of gcc-patches-return-468862-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-468862-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 s194si7758544pgc.0.2017.12.09.15.25.26 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 09 Dec 2017 15:25:26 -0800 (PST) Received-SPF: pass (google.com: domain of gcc-patches-return-468862-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=G9uw2BI+; spf=pass (google.com: domain of gcc-patches-return-468862-patch=linaro.org@gcc.gnu.org designates 209.132.180.131 as permitted sender) smtp.mailfrom=gcc-patches-return-468862-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=jwH+5gsSzp4IVzHYObbNN6AwFGi23 hgdZ6HZrmmXFWbzSYDH/9x8i/Hx0W/OY/PpkLDsdsihk0O8ENYeXqWjbX2q+LLRQ wQ8xjOj+ghoyjUmoeTw+SLAp886rnd6JrQWmisUJ50sZe/RS6uiXwrVFTZ3llBEL sDT69DGxe6+3Sk= 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=Hc3ekcdscwjww7E+6+s8IX+TOGw=; b=G9u w2BI+DrJl09Yzlb7ZVnQ/hwRc44OjQkGwPedmY3j2qWaHG3shpcNvAUCZGrU08YQ 5d9p1v4gcxEOvdt2ntFCL50UcEpDQCFwP1PHcFLfkhuiCNsbNng0it17eBCUDF1m drIB/PMAQKnLczjaMuDZ7aSDUfD9s1kEkkV1JsMY= Received: (qmail 109950 invoked by alias); 9 Dec 2017 23:25:14 -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 109940 invoked by uid 89); 9 Dec 2017 23:25:14 -0000 Authentication-Results: sourceware.org; auth=none X-Virus-Found: No X-Spam-SWARE-Status: No, score=-11.0 required=5.0 tests=AWL, BAYES_00, 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-f50.google.com Received: from mail-wm0-f50.google.com (HELO mail-wm0-f50.google.com) (74.125.82.50) by sourceware.org (qpsmtpd/0.93/v0.84-503-g423c35a) with ESMTP; Sat, 09 Dec 2017 23:25:13 +0000 Received: by mail-wm0-f50.google.com with SMTP id b76so8380326wmg.1 for ; Sat, 09 Dec 2017 15:25:12 -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=COYpxelZ5xPd25qvlL1FxMAi9mGRYKURy65PkcONibU=; b=f3RoPfrFGrIb8vCZ7OqugmZPgBlUxuD9jKaKKX3pqnL7ZRWtJDSCAwJLRtFNVKonpa UUZNwGApsPtKTBTg3BQTY3WBqQri0hiiw9GO63U2vltple1+o9ysfDXehU+gbciTBai6 ub/dC69gcAW0Y0rhOEHPdMeGTl3Ft9Rc3+PnGEf3ZjHDpjEUhEdfSNiRQSooxSz8shON 9F8SUdbYYSStBjyY42PgFQkGtBdf1g06NunIHrgRC8pAoi43ZjEQzy5xZokJ3HJw+NCi t3hFMed+N4Y/1Hf54RFqAtcKWud/t1R2FwpBOOvevrYxLfVgRxvcr2BNJMWumRoTtlJU NWqw== X-Gm-Message-State: AKGB3mKybtuzzMapZPC28xJZO7uLlV6bmkooUTgwR9VTBGIAlXAnPKbS Rdt6IHQn7rPmJJ3e8AOnh5e0/Q25VsI= X-Received: by 10.28.55.82 with SMTP id e79mr6768652wma.60.1512861910706; Sat, 09 Dec 2017 15:25:10 -0800 (PST) Received: from localhost ([2.25.234.120]) by smtp.gmail.com with ESMTPSA id k19sm12830591wrk.88.2017.12.09.15.25.09 for (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Sat, 09 Dec 2017 15:25:09 -0800 (PST) From: Richard Sandiford To: gcc-patches@gcc.gnu.org Mail-Followup-To: gcc-patches@gcc.gnu.org, richard.sandiford@linaro.org Subject: [12/13] Use ssizetype selectors for autovectorised VEC_PERM_EXPRs References: <87indfmrgt.fsf@linaro.org> <877etvlc4g.fsf@linaro.org> Date: Sat, 09 Dec 2017 23:25:09 +0000 In-Reply-To: <877etvlc4g.fsf@linaro.org> (Richard Sandiford's message of "Sat, 09 Dec 2017 23:23:11 +0000") Message-ID: <87wp1vjxgq.fsf_-_@linaro.org> User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/25.3 (gnu/linux) MIME-Version: 1.0 The previous patches mean that there's no reason that constant VEC_PERM_EXPRs need to have the same shape as the data inputs. This patch makes the autovectoriser use ssizetype elements instead, so that indices don't get truncated for large or variable-length vectors. 2017-12-09 Richard Sandiford gcc/ * tree-cfg.c (verify_gimple_assign_ternary): Allow the size of the selector elements to be different from the data elements if the selector is a VECTOR_CST. * tree-vect-stmts.c (vect_gen_perm_mask_any): Use a vector of ssizetype for the selector. Index: gcc/tree-cfg.c =================================================================== --- gcc/tree-cfg.c 2017-12-09 22:47:07.103588314 +0000 +++ gcc/tree-cfg.c 2017-12-09 22:48:58.259216407 +0000 @@ -4300,8 +4300,11 @@ verify_gimple_assign_ternary (gassign *s } if (TREE_CODE (TREE_TYPE (rhs3_type)) != INTEGER_TYPE - || GET_MODE_BITSIZE (SCALAR_INT_TYPE_MODE (TREE_TYPE (rhs3_type))) - != GET_MODE_BITSIZE (SCALAR_TYPE_MODE (TREE_TYPE (rhs1_type)))) + || (TREE_CODE (rhs3) != VECTOR_CST + && (GET_MODE_BITSIZE (SCALAR_INT_TYPE_MODE + (TREE_TYPE (rhs3_type))) + != GET_MODE_BITSIZE (SCALAR_TYPE_MODE + (TREE_TYPE (rhs1_type)))))) { error ("invalid mask type in vector permute expression"); debug_generic_expr (lhs_type); Index: gcc/tree-vect-stmts.c =================================================================== --- gcc/tree-vect-stmts.c 2017-12-09 22:48:52.268015910 +0000 +++ gcc/tree-vect-stmts.c 2017-12-09 22:48:58.259216407 +0000 @@ -6518,11 +6518,12 @@ vectorizable_store (gimple *stmt, gimple tree vect_gen_perm_mask_any (tree vectype, const vec_perm_indices &sel) { - tree mask_elt_type, mask_type; + tree mask_type; - 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); + unsigned int nunits = sel.length (); + gcc_assert (nunits == TYPE_VECTOR_SUBPARTS (vectype)); + + mask_type = build_vector_type (ssizetype, nunits); return vec_perm_indices_to_tree (mask_type, sel); }