On Tue, Dec 14, 2021 at 09:37:03AM +0000, Joel Hutton via Gcc-patches wrote:
> Bootstrapped and regression tested on releases/gcc-11 on aarch64.
> 
> Ok for 11?
> 
> Previous commit broke build as it relied on directly_supported_p which
> is not in 11. This reworks to avoid using directly_supported_p.
> 
> gcc/ChangeLog:
> 
>               PR bootstrap/103688
>               * tree-vect-loop.c (vectorizable_induction): Rework to avoid
>     directly_supported_p

Missing . after directly_supported_p

--- a/gcc/tree-vect-loop.c
+++ b/gcc/tree-vect-loop.c
@@ -7997,8 +7997,14 @@ vectorizable_induction (loop_vec_info loop_vinfo,
   tree step_vectype = get_same_sized_vectype (TREE_TYPE (step_expr), vectype);
 
   /* Check for backend support of PLUS/MINUS_EXPR. */
-  if (!directly_supported_p (PLUS_EXPR, step_vectype)
-      || !directly_supported_p (MINUS_EXPR, step_vectype))
+  direct_optab ot_plus = optab_for_tree_code (tree_code (PLUS_EXPR),
+                                                step_vectype, optab_default);
+  direct_optab ot_minus = optab_for_tree_code (tree_code (MINUS_EXPR),
+                                                step_vectype, optab_default);

Why tree_code (PLUS_EXPR) instead of just PLUS_EXPR (ditto MINUS_EXPR)?
The formatting is off, step_vectype isn't aligned below tree_code.

+  if (ot_plus == unknown_optab
+      || ot_minus == unknown_optab
+      || optab_handler (ot_minus, TYPE_MODE (step_vectype)) == CODE_FOR_nothing
+      || optab_handler (ot_plus, TYPE_MODE (step_vectype)) == CODE_FOR_nothing)
     return false;

Won't optab_handler just return CODE_FOR_nothing for unknown_optab?

Anyway, I think best would be to write it as:
  if (!target_supports_op_p (step_vectype, PLUS_EXPR, optab_default)
      || !target_supports_op_p (step_vectype, MINUS_EXPR, optab_default))
    return false;

        Jakub

Reply via email to