From: Richard Sandiford <richard.sandiford@linaro.org>
To: gcc-patches@gcc.gnu.org
Subject: [12/13] Use ssizetype selectors for autovectorised VEC_PERM_EXPRs
Date: Sat, 09 Dec 2017 23:25:00 -0000 [thread overview]
Message-ID: <87wp1vjxgq.fsf_-_@linaro.org> (raw)
In-Reply-To: <877etvlc4g.fsf@linaro.org> (Richard Sandiford's message of "Sat, 09 Dec 2017 23:23:11 +0000")
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 <richard.sandiford@linaro.org>
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);
}
next prev parent reply other threads:[~2017-12-09 23:25 UTC|newest]
Thread overview: 46+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-12-09 23:06 [00/13] Make VEC_PERM_EXPR work for variable-length vectors Richard Sandiford
2017-12-09 23:08 ` [01/13] Add a qimode_for_vec_perm helper function Richard Sandiford
2017-12-18 13:34 ` Richard Biener
2017-12-09 23:09 ` [02/13] Pass vec_perm_indices by reference Richard Sandiford
2017-12-12 14:23 ` Richard Biener
2017-12-09 23:11 ` [03/13] Split can_vec_perm_p into can_vec_perm_{var,const}_p Richard Sandiford
2017-12-12 14:25 ` Richard Biener
2017-12-09 23:13 ` [04/13] Refactor expand_vec_perm Richard Sandiford
2017-12-12 15:17 ` Richard Biener
2017-12-09 23:17 ` [05/13] Remove vec_perm_const optab Richard Sandiford
2017-12-12 15:26 ` Richard Biener
2017-12-20 13:42 ` Richard Sandiford
2017-12-09 23:18 ` [06/13] Check whether a vector of QIs can store all indices Richard Sandiford
2017-12-12 15:27 ` Richard Biener
2017-12-09 23:20 ` [07/13] Make vec_perm_indices use new vector encoding Richard Sandiford
2017-12-12 15:32 ` Richard Biener
2017-12-12 15:47 ` Richard Sandiford
2017-12-14 10:37 ` Richard Biener
2017-12-20 13:48 ` Richard Sandiford
2018-01-02 13:15 ` Richard Biener
2018-01-02 18:30 ` Richard Sandiford
2017-12-09 23:20 ` [08/13] Add a vec_perm_indices_to_tree helper function Richard Sandiford
2017-12-18 13:34 ` Richard Biener
2017-12-09 23:21 ` [09/13] Use explicit encodings for simple permutes Richard Sandiford
2017-12-19 20:37 ` Richard Sandiford
2018-01-02 13:07 ` Richard Biener
2017-12-09 23:23 ` [10/13] Rework VEC_PERM_EXPR folding Richard Sandiford
2017-12-09 23:24 ` [11/13] Use vec_perm_builder::series_p in shift_amt_for_vec_perm_mask Richard Sandiford
2017-12-19 20:37 ` Richard Sandiford
2018-01-02 13:08 ` Richard Biener
2017-12-09 23:25 ` Richard Sandiford [this message]
2017-12-19 20:37 ` [12/13] Use ssizetype selectors for autovectorised VEC_PERM_EXPRs Richard Sandiford
2018-01-02 13:09 ` Richard Biener
2017-12-19 20:37 ` [10/13] Rework VEC_PERM_EXPR folding Richard Sandiford
2018-01-02 13:08 ` Richard Biener
2017-12-09 23:27 ` [13/13] [AArch64] Use vec_perm_indices helper routines Richard Sandiford
2017-12-19 20:37 ` Richard Sandiford
2018-01-04 11:28 ` Richard Sandiford
2018-01-09 12:18 ` James Greenhalgh
2018-01-09 16:24 ` RFA: Expand vec_perm_indices::series_p comment Richard Sandiford
2018-01-29 20:56 ` Ping: " Richard Sandiford
2018-01-30 7:20 ` Jeff Law
2017-12-12 14:12 ` [00/13] Make VEC_PERM_EXPR work for variable-length vectors Richard Biener
2017-12-12 15:32 ` Richard Sandiford
2017-12-12 15:38 ` Richard Biener
2017-12-12 15:57 ` Richard Sandiford
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87wp1vjxgq.fsf_-_@linaro.org \
--to=richard.sandiford@linaro.org \
--cc=gcc-patches@gcc.gnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).