OSDN Git Service

* aclocal.m4: Fixed typo.
[pf3gnuchains/gcc-fork.git] / gcc / genrecog.c
index 5d64378..00f425b 100644 (file)
@@ -84,12 +84,13 @@ struct decision_test
   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
   {
@@ -841,18 +842,16 @@ add_to_sequence (pattern, last, position, insn_type, top)
            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))
@@ -956,10 +955,16 @@ add_to_sequence (pattern, last, position, insn_type, top)
        }
       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')
@@ -1055,6 +1060,7 @@ maybe_both_true_2 (d1, d2)
        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:
@@ -1278,6 +1284,7 @@ nodes_identical_1 (d1, d2)
     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:
@@ -1488,7 +1495,7 @@ factor_tests (head)
          && 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
@@ -1858,7 +1865,7 @@ write_switch (start, depth)
           || 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)
@@ -1875,7 +1882,7 @@ write_switch (start, depth)
        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);
@@ -1910,6 +1917,7 @@ write_switch (start, 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:
@@ -1966,6 +1974,7 @@ write_cond (p, depth, subroutine_type)
       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;
@@ -2738,6 +2747,10 @@ debug_decision_2 (test)
       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;