diff options
author | Richard Sandiford <richard.sandiford@arm.com> | 2020-11-11 11:42:45 +0000 |
---|---|---|
committer | Richard Sandiford <richard.sandiford@arm.com> | 2020-11-11 11:42:45 +0000 |
commit | e29dd0eb733f4b9ae03e44322c7fbe8b51eff0a4 (patch) | |
tree | aed14aaf95c4b6801b834767bea500336c7016f7 /gcc | |
parent | 0ebaea3b6677ef8edfa5638800304db1a4f7c2f8 (diff) | |
download | gcc-e29dd0eb733f4b9ae03e44322c7fbe8b51eff0a4.zip gcc-e29dd0eb733f4b9ae03e44322c7fbe8b51eff0a4.tar.gz gcc-e29dd0eb733f4b9ae03e44322c7fbe8b51eff0a4.tar.bz2 |
vect: Allow vconds between different vector sizes
The vcond code requires the compared vectors and the selected
vectors to have both the same size and the same number of elements
as each other. But the operation makes logical sense even for
different vector sizes. E.g. you could compare two V4SIs and
use the result to select between two V4DIs.
The underlying optab already allows the compared mode and the selected
mode to be specified separately. Since the vectoriser now also
supports mixed vector sizes, I think we can simply remove the
equal-size check and just keep the equal-lanes check. It's then
up to the target to decide which (if any) mixtures of sizes it
supports.
gcc/
* optabs-tree.c (expand_vec_cond_expr_p): Allow the compared values
and the selected values to have different mode sizes.
* gimple-isel.cc (gimple_expand_vec_cond_expr): Likewise.
Diffstat (limited to 'gcc')
-rw-r--r-- | gcc/gimple-isel.cc | 5 | ||||
-rw-r--r-- | gcc/optabs-tree.c | 3 |
2 files changed, 3 insertions, 5 deletions
diff --git a/gcc/gimple-isel.cc b/gcc/gimple-isel.cc index 9186ff5..b5362cc 100644 --- a/gcc/gimple-isel.cc +++ b/gcc/gimple-isel.cc @@ -199,9 +199,8 @@ gimple_expand_vec_cond_expr (gimple_stmt_iterator *gsi, unsignedp = TYPE_UNSIGNED (TREE_TYPE (op0a)); - gcc_assert (known_eq (GET_MODE_SIZE (mode), GET_MODE_SIZE (cmp_op_mode)) - && known_eq (GET_MODE_NUNITS (mode), - GET_MODE_NUNITS (cmp_op_mode))); + gcc_assert (known_eq (GET_MODE_NUNITS (mode), + GET_MODE_NUNITS (cmp_op_mode))); icode = get_vcond_icode (mode, cmp_op_mode, unsignedp); if (icode == CODE_FOR_nothing) diff --git a/gcc/optabs-tree.c b/gcc/optabs-tree.c index badd30b..4dfda75 100644 --- a/gcc/optabs-tree.c +++ b/gcc/optabs-tree.c @@ -377,8 +377,7 @@ expand_vec_cond_expr_p (tree value_type, tree cmp_op_type, enum tree_code code) TYPE_MODE (cmp_op_type)) != CODE_FOR_nothing) return true; - if (maybe_ne (GET_MODE_SIZE (value_mode), GET_MODE_SIZE (cmp_op_mode)) - || maybe_ne (GET_MODE_NUNITS (value_mode), GET_MODE_NUNITS (cmp_op_mode))) + if (maybe_ne (GET_MODE_NUNITS (value_mode), GET_MODE_NUNITS (cmp_op_mode))) return false; if (TREE_CODE_CLASS (code) != tcc_comparison) |