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
{
test->u.pred.name = pred_name;
test->u.pred.mode = mode;
- /* See if we know about this predicate and save its number. If
- we do, and it only accepts one code, note that fact. The
- predicate `const_int_operand' only tests for a CONST_INT, so
- if we do so we can avoid calling it at all.
+ /* See if we know about this predicate and save its number.
+ If we do, and it only accepts one code, note that fact.
- Finally, if we know that the predicate does not allow
- CONST_INT, we know that the only way the predicate can match
- is if the modes match (here we use the kludge of relying on
- the fact that "address_operand" accepts CONST_INT; otherwise,
- it would have to be a special case), so we can test the mode
- (but we need not). This fact should considerably simplify the
- generated code. */
+ If we know that the predicate does not allow CONST_INT,
+ we know that the only way the predicate can match is if
+ the modes match (here we use the kludge of relying on the
+ fact that "address_operand" accepts CONST_INT; otherwise,
+ it would have to be a special case), so we can test the
+ mode (but we need not). This fact should considerably
+ simplify the generated code. */
for (i = 0; i < NUM_KNOWN_PREDS; i++)
if (! strcmp (preds[i].name, pred_name))
}
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)
{
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;