On Tue, 27 Jun 2023, Robin Dapp wrote:

> > Yeah, the optab should already have the fallback of WIDENing here?
> > So why does that fail?
> 
> We reach
>  if (CLASS_HAS_WIDER_MODES_P (mclass))
> which returns false because mclass == MODE_VECTOR_FLOAT.
> CLASS_HAS_WIDER_MODES_P only handles non-vector classes?
> Same for FOR_EACH_WIDER_MODE that follows.

Oh, so this is about vector modes.  So yes, for vectors we need to
perform this test.  In other places we do

        && (!VECTOR_MODE_P (TYPE_MODE (type))
            || (VECTOR_MODE_P (TYPE_MODE (itype))
                && optab_handler (and_optab,
                                  TYPE_MODE (itype)) != 
CODE_FOR_nothing)))

so I suggest to do a similar VECTOR_MODE_P check and your original test.
So

      && (!VECTOR_MODE_P (TYPE_MODE (newtype))
          || target_supports_op_p (newtype, op, optab_default))

OK with that change.

Thanks,
Richard.

Reply via email to