OSDN Git Service

* genrecog.c (write_switch): Output if before switch for
authorhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 28 Oct 2001 16:00:22 +0000 (16:00 +0000)
committerhubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4>
Sun, 28 Oct 2001 16:00:22 +0000 (16:00 +0000)
DT_elt_zero_wide_safe.

git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46584 138bc75d-0d04-0410-961f-82ee72b054a4

gcc/ChangeLog
gcc/genrecog.c

index 3893206..dfbbf9d 100644 (file)
@@ -1,3 +1,8 @@
+Sun Oct 28 16:48:09 CET 2001  Jan Hubicka  <jh@suse.cz>
+
+       * genrecog.c (write_switch):  Output if before switch for
+       DT_elt_zero_wide_safe.
+
 2001-10-28  Kaveh R. Ghazi  <ghazi@caip.rutgers.edu>
 
        * Makefile.in (toplev.o, halfpic.o): Depend on halfpic.h
index b970c0a..49afac9 100644 (file)
@@ -1909,11 +1909,19 @@ write_switch (start, depth)
           || type == DT_elt_one_int
           || type == DT_elt_zero_wide_safe)
     {
+      const char *indent = "";
       /* Pmode may not be a compile-time constant.  */
       if (type == DT_mode && p->tests->u.mode == Pmode)
        return p;
 
-      printf ("  switch (");
+      /* We cast switch parameter to integer, so we must ensure that the value
+        fits.  */
+      if (type == DT_elt_zero_wide_safe)
+       {
+         indent = "  ";
+         printf("  if ((int) XWINT (x%d, 0) == XWINT (x%d, 0))\n", depth, depth);
+       }
+      printf ("%s  switch (", indent);
       switch (type)
        {
        case DT_mode:
@@ -1936,7 +1944,7 @@ write_switch (start, depth)
        default:
          abort ();
        }
-      printf (")\n    {\n");
+      printf (")\n%s    {\n", indent);
 
       do
        {
@@ -1955,7 +1963,7 @@ write_switch (start, depth)
          if (p != start && p->need_label && needs_label == NULL)
            needs_label = p;
 
-         printf ("    case ");
+         printf ("%s    case ", indent);
          switch (type)
            {
            case DT_mode:
@@ -1973,7 +1981,7 @@ write_switch (start, depth)
            default:
              abort ();
            }
-         printf (":\n      goto L%d;\n", p->success.first->number);
+         printf (":\n%s      goto L%d;\n", indent, p->success.first->number);
          p->success.first->need_label = 1;
 
          p = p->next;
@@ -1981,7 +1989,8 @@ write_switch (start, depth)
       while (p && p->tests->type == type && !p->tests->next);
 
     case_done:
-      printf ("    default:\n      break;\n    }\n");
+      printf ("%s    default:\n%s      break;\n%s    }\n",
+             indent, indent, indent);
 
       return needs_label != NULL ? needs_label : p;
     }