The following fixes the logic in multi-step mask conversions with
respect to the case where we need to resort to the sbool variant
of the unpack optabs.  We were testing a wrong condition on when
that would apply in the multi-step case.

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

        PR tree-optimization/122723
        * tree-vect-stmts.cc (supportable_widening_operation):
        Correct optab to query in the multi-step case when it is
        supposed to hit the sbool case.
---
 gcc/tree-vect-stmts.cc | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/gcc/tree-vect-stmts.cc b/gcc/tree-vect-stmts.cc
index 2bc68e25b90..bc15ac9d085 100644
--- a/gcc/tree-vect-stmts.cc
+++ b/gcc/tree-vect-stmts.cc
@@ -14047,9 +14047,9 @@ supportable_widening_operation (vec_info *vinfo,
                                            TYPE_UNSIGNED (prev_type));
 
       if (VECTOR_BOOLEAN_TYPE_P (intermediate_type)
-         && VECTOR_BOOLEAN_TYPE_P (prev_type)
-         && intermediate_mode == prev_mode
-         && SCALAR_INT_MODE_P (prev_mode))
+         && VECTOR_BOOLEAN_TYPE_P (wide_vectype)
+         && intermediate_mode == TYPE_MODE (wide_vectype)
+         && SCALAR_INT_MODE_P (intermediate_mode))
        {
          /* If the input and result modes are the same, a different optab
             is needed where we pass in the number of units in vectype.  */
-- 
2.51.0

Reply via email to