https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105394

Richard Biener <rguenth at gcc dot gnu.org> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
          Component|tree-optimization           |target
           Assignee|rguenth at gcc dot gnu.org         |unassigned at gcc dot 
gnu.org
             Status|ASSIGNED                    |NEW
                 CC|                            |rguenth at gcc dot gnu.org,
                   |                            |rsandifo at gcc dot gnu.org

--- Comment #4 from Richard Biener <rguenth at gcc dot gnu.org> ---
I see for arm B4Imode as inner mode of V4BI but on aarch64 the VNxMBI modes all
have BImode as inner mode.  They'd of course still run into this issue if we
ever have to lower SVE ops.

But maybe that we run into this for MVE is also just because of missing
patterns in the machine description.

diff --git a/gcc/tree-vect-generic.cc b/gcc/tree-vect-generic.cc
index 8b7227e8b58..1258cc48b16 100644
--- a/gcc/tree-vect-generic.cc
+++ b/gcc/tree-vect-generic.cc
@@ -1034,6 +1034,7 @@ expand_vector_condition (gimple_stmt_iterator *gsi,
bitmap dce_ssa_names)
   tree a2 = NULL_TREE;
   bool a_is_comparison = false;
   bool a_is_scalar_bitmask = false;
+  unsigned bitmask_elwidth = 0;
   tree b = gimple_assign_rhs2 (stmt);
   tree c = gimple_assign_rhs3 (stmt);
   vec<constructor_elt, va_gc> *v;
@@ -1111,14 +1112,12 @@ expand_vector_condition (gimple_stmt_iterator *gsi,
bitmap dce_ssa_names)

   if (!a_is_comparison
       && VECTOR_BOOLEAN_TYPE_P (TREE_TYPE (a))
-      && SCALAR_INT_MODE_P (TYPE_MODE (TREE_TYPE (a)))
-      && known_lt (GET_MODE_BITSIZE (TYPE_MODE (TREE_TYPE (a))),
-                  TYPE_VECTOR_SUBPARTS (TREE_TYPE (a))
-                  * GET_MODE_BITSIZE (SCALAR_TYPE_MODE
-                                               (TREE_TYPE (TREE_TYPE (a))))))
+      && (SCALAR_INT_MODE_P (TYPE_MODE (TREE_TYPE (a)))
+         || GET_MODE_CLASS (TYPE_MODE (TREE_TYPE (a))) == MODE_VECTOR_BOOL))
     {
       a_is_scalar_bitmask = true;
-      int prec = GET_MODE_PRECISION (SCALAR_TYPE_MODE (TREE_TYPE (a)));
+      bitmask_elwidth = TYPE_PRECISION (TREE_TYPE (TREE_TYPE (a)));
+      int prec = GET_MODE_PRECISION (TYPE_MODE (TREE_TYPE (a))).to_constant
();
       tree atype = build_nonstandard_integer_type (prec, 1);
       a = gimplify_build1 (gsi, VIEW_CONVERT_EXPR, atype, a);
     }
@@ -1141,7 +1140,8 @@ expand_vector_condition (gimple_stmt_iterator *gsi,
bitmap dce_ssa_names)
        }
       else if (a_is_scalar_bitmask)
        {
-         wide_int w = wi::set_bit_in_zero (i, TYPE_PRECISION (TREE_TYPE (a)));
+         wide_int w = wi::shifted_mask (i * bitmask_elwidth, bitmask_elwidth,
+                                        false, TYPE_PRECISION (TREE_TYPE
(a)));
          result = gimplify_build2 (gsi, BIT_AND_EXPR, TREE_TYPE (a),
                                    a, wide_int_to_tree (TREE_TYPE (a), w));
          aa = build2 (NE_EXPR, boolean_type_node, result,

Reply via email to