struct decision_test *next;
/* These types are roughly in the order in which we'd like to test them. */
- enum decision_type {
- DT_mode, DT_code, DT_veclen,
- DT_elt_zero_int, DT_elt_one_int, DT_elt_zero_wide,
- DT_veclen_ge, DT_dup, DT_pred, DT_c_test,
- DT_accept_op, DT_accept_insn
- } type;
+ enum decision_type
+ {
+ DT_mode, DT_code, DT_veclen,
+ DT_elt_zero_int, DT_elt_one_int, DT_elt_zero_wide, DT_elt_zero_wide_safe,
+ DT_veclen_ge, DT_dup, DT_pred, DT_c_test,
+ DT_accept_op, DT_accept_insn
+ } type;
union
{
}
else if (fmt[i] == 'w')
{
+ /* If this value actually fits in an int, we can use a switch
+ statement here, so indicate that. */
+ enum decision_type type
+ = ((int) XWINT (pattern, i) == XWINT (pattern, i))
+ ? DT_elt_zero_wide_safe : DT_elt_zero_wide;
+
if (i != 0)
abort ();
- test = new_decision_test (DT_elt_zero_wide, &place);
+ test = new_decision_test (type, &place);
test->u.intval = XWINT (pattern, i);
}
else if (fmt[i] == 'E')
case DT_elt_zero_int:
case DT_elt_one_int:
case DT_elt_zero_wide:
+ case DT_elt_zero_wide_safe:
return d1->u.intval == d2->u.intval;
default:
case DT_elt_zero_int:
case DT_elt_one_int:
case DT_elt_zero_wide:
+ case DT_elt_zero_wide_safe:
return d1->u.intval == d2->u.intval;
case DT_accept_op:
&& type != DT_veclen
&& type != DT_elt_zero_int
&& type != DT_elt_one_int
- && type != DT_elt_zero_wide)
+ && type != DT_elt_zero_wide_safe)
continue;
/* If we'd been performing more than one test, create a new node
|| type == DT_veclen
|| type == DT_elt_zero_int
|| type == DT_elt_one_int
- || type == DT_elt_zero_wide)
+ || type == DT_elt_zero_wide_safe)
{
- /* The argument is casted to int. In case HOST_WIDE_INT is more exact,
- we can't safely construct switch statement over it. */
- if (type == DT_elt_zero_wide && HOST_BITS_PER_WIDE_INT > sizeof (int) * CHAR_BIT)
- return p;
printf (" switch (");
switch (type)
{
case DT_elt_one_int:
printf ("XINT (x%d, 1)", depth);
break;
- case DT_elt_zero_wide:
+ case DT_elt_zero_wide_safe:
/* Convert result of XWINT to int for portability since some C
compilers won't do it and some will. */
printf ("(int) XWINT (x%d, 0)", depth);
case DT_elt_zero_int:
case DT_elt_one_int:
case DT_elt_zero_wide:
+ case DT_elt_zero_wide_safe:
printf (HOST_WIDE_INT_PRINT_DEC, p->tests->u.intval);
break;
default:
break;
case DT_elt_zero_wide:
+ case DT_elt_zero_wide_safe:
printf ("XWINT (x%d, 0) == ", depth);
printf (HOST_WIDE_INT_PRINT_DEC, p->u.intval);
break;
fprintf (stderr, "elt0_w=");
fprintf (stderr, HOST_WIDE_INT_PRINT_DEC, test->u.intval);
break;
+ case DT_elt_zero_wide_safe:
+ fprintf (stderr, "elt0_ws=");
+ fprintf (stderr, HOST_WIDE_INT_PRINT_DEC, test->u.intval);
+ break;
case DT_veclen_ge:
fprintf (stderr, "veclen>=%d", test->u.veclen);
break;