This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Fix for missed giv combinations
- To: egcs-patches at cygnus dot com
- Subject: Fix for missed giv combinations
- From: Bernd Schmidt <crux at pool dot informatik dot rwth-aachen dot de>
- Date: Tue, 20 Oct 1998 14:13:05 +0200 (MET DST)
Sometimes, the function express_from can return a non-canonical expression
of the form (plus (plus x const) y). This can cause it not to be recognized
as an addressing mode, while the canonical form (plus (plus x y) const)
would be recognized. This can cause combine_givs to miss possible
combinations.
Bernd
* loop.c (express_from): Make sure that when generating a PLUS of
a PLUS, any constant expression appears on the outermost PLUS.
Index: loop.c
===================================================================
RCS file: /usr/local/cvs/gcs/gcc/loop.c,v
retrieving revision 1.1.1.45
diff -u -p -r1.1.1.45 loop.c
--- loop.c 1998/10/15 13:29:35 1.1.1.45
+++ loop.c 1998/10/17 18:33:08
@@ -6230,7 +6225,18 @@ express_from (g1, g2)
if (add == const0_rtx)
return mult;
else
- return gen_rtx_PLUS (g2->mode, mult, add);
+ {
+ if (GET_CODE (add) == PLUS
+ && CONSTANT_P (XEXP (add, 1)))
+ {
+ rtx tem = XEXP (add, 1);
+ mult = gen_rtx_PLUS (g2->mode, mult, XEXP (add, 0));
+ add = tem;
+ }
+
+ return gen_rtx_PLUS (g2->mode, mult, add);
+ }
+
}
/* Return an rtx, if any, that expresses giv G2 as a function of the register