This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: Yours (Richard Kenner's) patch to genrecog
- To: Richard Kenner <kenner at vlsi1 dot ultra dot nyu dot edu>
- Subject: Re: Yours (Richard Kenner's) patch to genrecog
- From: Jan Hubicka <jh at suse dot cz>
- Date: Sun, 28 Oct 2001 13:44:47 +0100
- Cc: jh at suse dot cz, gcc-bugs at gcc dot gnu dot org, gcc-patches at gcc dot gnu dot org, patches at x86-64 dot org
- References: <10110231556.AA01346@vlsi1.ultra.nyu.edu>
> Would putting a test for XWINT (...) == (int) XWINT (...) in front of
> the switch also fix it?
Here comes the patch. OK to install?
Sun Oct 28 15:49:20 CET 2001 Jan Hubicka <jh@suse.cz>
* genrecog.c (write_switch): Output if before switch for
DT_elt_zero_wide_safe.
*** genrecog.c.old Sun Oct 28 15:32:22 2001
--- genrecog.c Sun Oct 28 15:39:38 2001
*************** write_switch (start, depth)
*** 1909,1919 ****
|| type == DT_elt_one_int
|| type == DT_elt_zero_wide_safe)
{
/* Pmode may not be a compile-time constant. */
if (type == DT_mode && p->tests->u.mode == Pmode)
return p;
! printf (" switch (");
switch (type)
{
case DT_mode:
--- 1909,1927 ----
|| 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;
! /* 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:
*************** write_switch (start, depth)
*** 1936,1942 ****
default:
abort ();
}
! printf (")\n {\n");
do
{
--- 1944,1950 ----
default:
abort ();
}
! printf (")\n%s {\n", indent);
do
{
*************** write_switch (start, depth)
*** 1955,1961 ****
if (p != start && p->need_label && needs_label == NULL)
needs_label = p;
! printf (" case ");
switch (type)
{
case DT_mode:
--- 1963,1969 ----
if (p != start && p->need_label && needs_label == NULL)
needs_label = p;
! printf ("%s case ", indent);
switch (type)
{
case DT_mode:
*************** write_switch (start, depth)
*** 1973,1979 ****
default:
abort ();
}
! printf (":\n goto L%d;\n", p->success.first->number);
p->success.first->need_label = 1;
p = p->next;
--- 1981,1987 ----
default:
abort ();
}
! printf (":\n%s goto L%d;\n", indent, p->success.first->number);
p->success.first->need_label = 1;
p = p->next;
*************** write_switch (start, depth)
*** 1981,1987 ****
while (p && p->tests->type == type && !p->tests->next);
case_done:
! printf (" default:\n break;\n }\n");
return needs_label != NULL ? needs_label : p;
}
--- 1989,1996 ----
while (p && p->tests->type == type && !p->tests->next);
case_done:
! printf ("%s default:\n%s break;\n%s }\n",
! indent, indent, indent);
return needs_label != NULL ? needs_label : p;
}