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

--- Comment #3 from Richard Biener <rguenth at gcc dot gnu.org> ---
  vect__4.18_102 = MEM[(int *)vectp_b.17_73];
  vect_d_5.19_103 = vect__4.18_102 >> 1;
  vect_patt_13.20_104 = VEC_COND_EXPR <vect__4.18_102 < { 0, 0, 0, 0 }, { 1, 1,
1, 1 }, { 0, 0, 0, 0 }>;

late forwprop does this in forward_propagate_into_cond by dispatching to fold

  Replaced 'vect_d_5.19_103 != { 0, 0, 0, 0 }' with 'vect__4.18_102 < { 0, 0,
0, 0 }'
  Replaced 'vect_d_5.19_80 != { 0, 0, 0, 0 }' with 'vect__4.18_79 < { 0, 0, 0,
0 }'

I suppose via

      /* Fold (X >> C) != 0 into X < 0 if C is one less than the width
         of X.  Similarly fold (X >> C) == 0 into X >= 0.  */
      if (TREE_CODE (arg0) == RSHIFT_EXPR
          && integer_zerop (arg1)
          && TREE_CODE (TREE_OPERAND (arg0, 1)) == INTEGER_CST)
        {
          tree arg00 = TREE_OPERAND (arg0, 0);
          tree arg01 = TREE_OPERAND (arg0, 1);
          tree itype = TREE_TYPE (arg00);
          if (wi::eq_p (arg01, TYPE_PRECISION (itype) - 1))

which checks TYPE_VECTOR_SUBPARTS here ^^^^^^

            {
              if (TYPE_UNSIGNED (itype))
                {
                  itype = signed_type_for (itype);
                  arg00 = fold_convert_loc (loc, itype, arg00);
                }
              return fold_build2_loc (loc, code == EQ_EXPR ? GE_EXPR : LT_EXPR,
                                  type, arg00, build_zero_cst (itype));
            }
        }

a simple guard with INTEGRAL_TYPE_P (TREE_TYPE (arg0)) fixes this.

Or using element_precision.

Reply via email to