On 05/29/2015 10:23 AM, Richard Sandiford wrote:
> + /* Check whether the predicate accepts const scalar ints (which always
> + have a stored mode of VOIDmode, but logically have a real mode)
> + and whether it matches anything besides const scalar ints. */
> + bool matches_const_scalar_int_p = false;
> + bool matches_other_p = false;
> + for (int i = 0; i < NUM_RTX_CODE; ++i)
> + if (p->codes[i])
> + switch (i)
> + {
> + CASE_CONST_SCALAR_INT:
> + matches_const_scalar_int_p = true;
> + break;
> +
> + default:
> + matches_other_p = true;
> + break;
> + }
> +
> + /* There's no need for a mode check if the predicate only accepts
> + constant integers. The code checks in the predicate are enough
> + to establish that the mode is VOIDmode.
> +
> + Note that the predicate itself should check whether a scalar
> + integer is in range of the given mode. */
> + if (!matches_other_p && !p->codes[CONST_DOUBLE])
> + return;
I think perhaps it would be cleaner to not use CASE_CONST_SCALAR_INT,
and then do
switch (i)
{
case CONST_INT:
case CONST_WIDE_INT:
matches_const_scalar_int_p = true;
break;
case CONST_DOUBLE:
if (!TARGET_SUPPORTS_WIDE_INT)
matches_const_scalar_int_p = true;
matches_other_p = true;
break;
default:
matches_other_p = true;
break;
}
if (!matches_other_p)
return;
Otherwise ok.
r~