aboutsummaryrefslogtreecommitdiff
path: root/gcc/genrecog.c
diff options
context:
space:
mode:
authorJan Hubicka <jh@suse.cz>2001-10-28 16:00:22 +0000
committerJan Hubicka <jh@suse.cz>2001-10-28 16:00:22 +0000
commit38839134c96e61d8ea27b7e3678d9858ae995817 (patch)
treeff7b2325a411f5f6f92dcd4cfcad353cb3997764 /gcc/genrecog.c
parent87b77d8c4771fcbede79aec18a84fa23511b1868 (diff)
* genrecog.c (write_switch): Output if before switch for
DT_elt_zero_wide_safe. git-svn-id: https://gcc.gnu.org/svn/gcc/trunk@46584 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/genrecog.c')
-rw-r--r--gcc/genrecog.c19
1 files changed, 14 insertions, 5 deletions
diff --git a/gcc/genrecog.c b/gcc/genrecog.c
index b970c0ab4f7..49afac9bb91 100644
--- a/gcc/genrecog.c
+++ b/gcc/genrecog.c
@@ -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;
}