This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [patch] Fix PR middle-end/22239 (take 2)
- From: "John David Anglin" <dave at hiauly1 dot hia dot nrc dot ca>
- To: rth at redhat dot com (Richard Henderson)
- Cc: gcc-patches at gcc dot gnu dot org, rearnsha at gcc dot gnu dot org
- Date: Sat, 9 Jul 2005 12:49:28 -0400 (EDT)
- Subject: Re: [patch] Fix PR middle-end/22239 (take 2)
> Conceptually just as broken as what's there. We shouldn't be
> creating raw PLUS/MINUS without recognizing them. That would
> have caught this problem, and would also catch targets that
> need extra clobbers for this arithmetic.
I guess I was warned. It seems that the failback fails on arm-elf
and possibly s390, so we need to try harder to handle non-replaceable
PLUSs. Is the following ok?
I tested the change with a full bootstrap and check on i686-pc-linux-gnu
and hppa-unknown-linux-gnu with no observed regressions:
<http://gcc.gnu.org/ml/gcc-testresults/2005-07/msg00492.html>
<http://gcc.gnu.org/ml/gcc-testresults/2005-07/msg00494.html>.
The testcase that Richard sent now assembles successfully.
> I won't press the point, however, since the Real Fix is to
> eliminate loop.c.
If that happens in the next few days, I'll withdraw my patch ;)
Dave
--
J. David Anglin dave.anglin@nrc-cnrc.gc.ca
National Research Council of Canada (613) 990-0752 (FAX: 952-6602)
2005-07-09 John David Anglin <dave.anglin@nrc-cnrc.gc.ca>
PR middle-end/22239
PR target/20126
* loop.c (loop_givs_rescan): Use expand_simple_binop instead of
gen_rtx_MINUS to handle non-replaceable (plus ((x) (const)).
Index: loop.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/loop.c,v
retrieving revision 1.535
diff -u -3 -p -r1.535 loop.c
--- loop.c 7 Jul 2005 22:53:28 -0000 1.535
+++ loop.c 9 Jul 2005 03:25:45 -0000
@@ -5496,14 +5496,18 @@ loop_givs_rescan (struct loop *loop, str
v->new_reg));
else if (GET_CODE (*v->location) == PLUS
&& REG_P (XEXP (*v->location, 0))
- && REG_P (v->new_reg)
&& CONSTANT_P (XEXP (*v->location, 1)))
- loop_insn_emit_before (loop, 0, v->insn,
- gen_move_insn (XEXP (*v->location, 0),
- gen_rtx_MINUS
- (GET_MODE (*v->location),
- v->new_reg,
- XEXP (*v->location, 1))));
+ {
+ rtx tem;
+ start_sequence ();
+ tem = expand_simple_binop (GET_MODE (*v->location), MINUS,
+ v->new_reg, XEXP (*v->location, 1),
+ NULL_RTX, 0, OPTAB_LIB_WIDEN);
+ emit_move_insn (XEXP (*v->location, 0), tem);
+ tem = get_insns ();
+ end_sequence ();
+ loop_insn_emit_before (loop, 0, v->insn, tem);
+ }
else
{
/* If it wasn't a reg, create a pseudo and use that. */