On Mon, Mar 23, 2020 at 06:00:06PM -0600, Jeff Law via Gcc-patches wrote: > +/* Return true if CODE is valid for comparisons of mode MODE, false > + otherwise. > + > + It is always safe to return false, even if the code was valid for the > + given mode as that will merely suppress optimizations. */ > + > +static bool > +comparison_code_valid_for_mode (enum rtx_code code, enum machine_mode mode) > +{ > + switch (code) > + { > + /* These are valid for integral, floating and vector modes. */ > + case NE: > + case EQ: > + case GE: > + case GT: > + case LE: > + case LT: > + return (INTEGRAL_MODE_P (mode) > + || FLOAT_MODE_P (mode) > + || VECTOR_MODE_P (mode));
I'm not sure I understand the VECTOR_MODE_P cases. INTEGRAL_MODE_P or FLOAT_MODE_P already do include vector modes with the corresponding element types. And if you want the {,u}{fract,accum} modes for some of these, shouldn't they apply to both scalar and vector modes thereof? So, either drop the || VECTOR_MODE_P (mode), or use || ALL_FRACT_MODE_P (mode) || ALL_ACCUM_MODE_P (mode) instead? > + > + /* These are valid for floating point modes. */ > + case LTGT: > + case UNORDERED: > + case ORDERED: > + case UNEQ: > + case UNGE: > + case UNGT: > + case UNLE: > + case UNLT: > + return FLOAT_MODE_P (mode); This will do the right thing, i.e. allow it for both floating scalar and vector modes. > + /* These are filtered out in simplify_logical_operation, but > + we check for them too as a matter of safety. They are valid > + for integral and vector modes. */ > + case GEU: > + case GTU: > + case LEU: > + case LTU: > + return INTEGRAL_MODE_P (mode) || VECTOR_MODE_P (mode); This doesn't look right. I don't know what the fract/accum modes want, but you don't want to return true for GET_MODE_CLASS (mode) == MODE_VECTOR_FLOAT, do you? Jakub