tree-optimization/103948 - detect vector vec_cmp in expand_vector_condition
authorUros Bizjak <ubizjak@gmail.com>
Mon, 10 Jan 2022 19:39:35 +0000 (20:39 +0100)
committerUros Bizjak <ubizjak@gmail.com>
Mon, 10 Jan 2022 19:40:22 +0000 (20:40 +0100)
Currently, expand_vector_condition detects only vcondMN and vconduMN
named RTX patterns.  Teach it to also consider vec_cmpMN and vec_cmpuMN
RTX patterns when all ones vector is returned for true and all zeros vector
is returned for false.

2022-01-10  Richard Biener  <rguenther@suse.de>

gcc/ChangeLog:

PR tree-optimization/103948
* tree-vect-generic.c (expand_vector_condition): Return true if
all ones vector is returned for true, all zeros vector for false
and the target defines corresponding vec_cmp{,u}MN named RTX pattern.

gcc/tree-vect-generic.c

index 6afb699..5814a71 100644 (file)
@@ -1052,7 +1052,9 @@ expand_vector_condition (gimple_stmt_iterator *gsi, bitmap dce_ssa_names)
        }
     }
 
-  if (expand_vec_cond_expr_p (type, TREE_TYPE (a1), code))
+  if (expand_vec_cond_expr_p (type, TREE_TYPE (a1), code)
+      || (integer_all_onesp (b) && integer_zerop (c)
+         && expand_vec_cmp_expr_p (type, TREE_TYPE (a1), code)))
     {
       gcc_assert (TREE_CODE (a) == SSA_NAME || TREE_CODE (a) == VECTOR_CST);
       return true;