diff options
author | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-10-28 16:00:22 +0000 |
---|---|---|
committer | hubicka <hubicka@138bc75d-0d04-0410-961f-82ee72b054a4> | 2001-10-28 16:00:22 +0000 |
commit | 7abd96cdd970b179f8a2549fb632b799e837aaa0 (patch) | |
tree | ff7b2325a411f5f6f92dcd4cfcad353cb3997764 /gcc/genrecog.c | |
parent | bdb2fc627067f78881820f2479c3998f5dc11592 (diff) | |
download | gcc-7abd96cdd970b179f8a2549fb632b799e837aaa0.tar.gz |
* genrecog.c (write_switch): Output if before switch for
DT_elt_zero_wide_safe.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@46584 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/genrecog.c')
-rw-r--r-- | gcc/genrecog.c | 19 |
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; } |