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

--- Comment #2 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
Or maybe we should try vector of QI mode for sizes larger than word_mode.
Like what is done for op_by_pieces_d.

```
  /* Use QI vector only if size is wider than a WORD.  */
  if (can_use_qi_vectors (op))
    {
      machine_mode mode;
      fixed_size_mode candidate;
      FOR_EACH_MODE_IN_CLASS (mode, MODE_VECTOR_INT)
        if (is_a<fixed_size_mode> (mode, &candidate)
            && GET_MODE_SIZE (candidate) > UNITS_PER_WORD
            && GET_MODE_INNER (candidate) == QImode)
          {
            if (GET_MODE_SIZE (candidate) >= size)
              break;
            if (by_pieces_mode_supported_p (candidate, op))
              result = candidate;
          }

      if (result != NARROWEST_INT_MODE)
        return result;
    }
```
can_use_qi_vectors returns true for COMPARE_BY_PIECES.
And by_pieces_mode_supported_p  is defined like:
```
static bool
by_pieces_mode_supported_p (fixed_size_mode mode, by_pieces_operation op)
{
  if (optab_handler (mov_optab, mode) == CODE_FOR_nothing)
    return false;

...

  if (op == COMPARE_BY_PIECES
      && !can_compare_p (EQ, mode, ccp_jump))
    return false;
```

Though for gimple level we should use:
  if (expand_vec_cmp_expr_p (TREE_TYPE (op0), type, code))
    return NULL_TREE;

Or:
get_vec_cmp_eq_icode (mode, TYPE_MODE (boolean_type_node)) != CODE_FOR_nothing

Reply via email to