The following tries to finish building proper GIMPLE COND_EXPRs
in vectorizer pattern recognition.

Bootstrapped and tested on x86_64-unknown-linux-gnu.

        * tree-vect-patterns.cc (vect_recog_divmod_pattern): Build
        separate comparion pattern for the condition of a COND_EXPR
        pattern.
---
 gcc/tree-vect-patterns.cc | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/gcc/tree-vect-patterns.cc b/gcc/tree-vect-patterns.cc
index d4c7793bb5a..d9fe4937858 100644
--- a/gcc/tree-vect-patterns.cc
+++ b/gcc/tree-vect-patterns.cc
@@ -4933,8 +4933,11 @@ vect_recog_divmod_pattern (vec_info *vinfo,
          return pattern_stmt;
        }
 
-      cond = build2 (LT_EXPR, boolean_type_node, oprnd0,
-                    build_int_cst (itype, 0));
+      cond = vect_recog_temp_ssa_var (boolean_type_node, NULL);
+      def_stmt = gimple_build_assign (cond, LT_EXPR, oprnd0,
+                                     build_int_cst (itype, 0));
+      append_pattern_def_seq (vinfo, stmt_vinfo, def_stmt,
+                             truth_type_for (vectype), itype);
       if (rhs_code == TRUNC_DIV_EXPR
          || rhs_code == EXACT_DIV_EXPR)
        {
-- 
2.43.0

Reply via email to