aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2019-11-29 14:47:28 +0000
committerRichard Sandiford <richard.sandiford@arm.com>2019-11-29 14:47:28 +0000
commit4b27adda50dbe576a70b9b0429bb01589829e6ca (patch)
tree543524ce049aecc3249f46a208b26abd8c6b0642
parentbfff80124c9ffde4d8a448092003da8c3667ae5c (diff)
Make vectorizable_operation punt early on codes it doesn't handle
vectorizable_operation returned false for codes that are handled by vectorizable_shift, but only after it had already done a lot of work. Checking earlier should be more efficient and avoid polluting the logs with duplicate info. Also, there was no such early-out for comparisons or COND_EXPRs. Fixing that avoids a false scan-tree-dump hit with a later patch. 2019-11-29 Richard Sandiford <richard.sandiford@arm.com> gcc/ * tree-vect-stmts.c (vectorizable_operation): Punt early on codes that are handled elsewhere. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@278848 138bc75d-0d04-0410-961f-82ee72b054a4
-rw-r--r--gcc/ChangeLog5
-rw-r--r--gcc/tree-vect-stmts.c20
2 files changed, 20 insertions, 5 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 92c7622e30b..e557946f697 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,5 +1,10 @@
2019-11-29 Richard Sandiford <richard.sandiford@arm.com>
+ * tree-vect-stmts.c (vectorizable_operation): Punt early
+ on codes that are handled elsewhere.
+
+2019-11-29 Richard Sandiford <richard.sandiford@arm.com>
+
* doc/sourcebuild.texi (vect_bool_cmp): Document.
* tree-vect-patterns.c (search_type_for_mask_1): If neither
operand to a boolean comparison is a natural vector mask,
diff --git a/gcc/tree-vect-stmts.c b/gcc/tree-vect-stmts.c
index d5f8031b408..49dcde43b74 100644
--- a/gcc/tree-vect-stmts.c
+++ b/gcc/tree-vect-stmts.c
@@ -5944,6 +5944,21 @@ vectorizable_operation (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
orig_code = code = gimple_assign_rhs_code (stmt);
+ /* Shifts are handled in vectorizable_shift. */
+ if (code == LSHIFT_EXPR
+ || code == RSHIFT_EXPR
+ || code == LROTATE_EXPR
+ || code == RROTATE_EXPR)
+ return false;
+
+ /* Comparisons are handled in vectorizable_comparison. */
+ if (TREE_CODE_CLASS (code) == tcc_comparison)
+ return false;
+
+ /* Conditions are handled in vectorizable_condition. */
+ if (code == COND_EXPR)
+ return false;
+
/* For pointer addition and subtraction, we should use the normal
plus and minus for the vector operation. */
if (code == POINTER_PLUS_EXPR)
@@ -6068,11 +6083,6 @@ vectorizable_operation (stmt_vec_info stmt_info, gimple_stmt_iterator *gsi,
gcc_assert (ncopies >= 1);
- /* Shifts are handled in vectorizable_shift (). */
- if (code == LSHIFT_EXPR || code == RSHIFT_EXPR || code == LROTATE_EXPR
- || code == RROTATE_EXPR)
- return false;
-
/* Supportable by target? */
vec_mode = TYPE_MODE (vectype);