patch to plus_constant_wide
Joern Rennecke
amylaar@cygnus.co.uk
Tue Dec 8 14:37:00 GMT 1998
This patch fixes a problem that all_constant was ignored when processing PLUS:
Tue Dec 8 22:33:18 1998 J"orn Rennecke <amylaar@cygnus.co.uk>
* explow.c (plus_constant_wide): Don't immediately return with
result of recursive call.
Index: explow.c
===================================================================
RCS file: /egcs/carton/cvsfiles/egcs/gcc/explow.c,v
retrieving revision 1.18
diff -p -r1.18 explow.c
*** explow.c 1998/11/20 07:37:33 1.18
--- explow.c 1998/12/08 22:33:44
*************** plus_constant_wide (x, c)
*** 116,134 ****
integer. For a constant term that is not an explicit integer,
we cannot really combine, but group them together anyway.
! Use a recursive call in case the remaining operand is something
! that we handle specially, such as a SYMBOL_REF. */
if (GET_CODE (XEXP (x, 1)) == CONST_INT)
! return plus_constant (XEXP (x, 0), c + INTVAL (XEXP (x, 1)));
else if (CONSTANT_P (XEXP (x, 0)))
! return gen_rtx_PLUS (mode,
! plus_constant (XEXP (x, 0), c),
! XEXP (x, 1));
else if (CONSTANT_P (XEXP (x, 1)))
! return gen_rtx_PLUS (mode,
! XEXP (x, 0),
! plus_constant (XEXP (x, 1), c));
break;
default:
--- 116,147 ----
integer. For a constant term that is not an explicit integer,
we cannot really combine, but group them together anyway.
! Restart or use a recursive call in case the remaining operand is
! something that we handle specially, such as a SYMBOL_REF.
+ We may not immediately return from the recursive call here, lest
+ all_constant gets lost. */
+
if (GET_CODE (XEXP (x, 1)) == CONST_INT)
! {
! c += INTVAL (XEXP (x, 1));
! x = XEXP (x, 0);
! goto restart;
! }
else if (CONSTANT_P (XEXP (x, 0)))
! {
! x = gen_rtx_PLUS (mode,
! plus_constant (XEXP (x, 0), c),
! XEXP (x, 1));
! c = 0;
! }
else if (CONSTANT_P (XEXP (x, 1)))
! {
! x = gen_rtx_PLUS (mode,
! XEXP (x, 0),
! plus_constant (XEXP (x, 1), c));
! c = 0;
! }
break;
default:
More information about the Gcc-patches
mailing list