Make vectorizable_operation punt early on codes it doesn't handle
authorRichard Sandiford <richard.sandiford@arm.com>
Fri, 29 Nov 2019 14:47:28 +0000 (14:47 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Fri, 29 Nov 2019 14:47:28 +0000 (14:47 +0000)
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.

From-SVN: r278848

gcc/ChangeLog
gcc/tree-vect-stmts.c

index 92c7622..e557946 100644 (file)
@@ -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,
index d5f8031..49dcde4 100644 (file)
@@ -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);