This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -freduce-all-givs and fortran
- To: Toon Moene <toon at moene dot indiv dot nluug dot nl>
- Subject: Re: -freduce-all-givs and fortran
- From: Richard Henderson <rth at redhat dot com>
- Date: Thu, 6 Sep 2001 14:47:20 -0700
- Cc: Toon Moene <moene at knmi dot nl>, aj at suse dot de, jh at suse dot de, gcc-patches at gcc dot gnu dot org, gcc at gcc dot gnu dot org
- References: <3B979A4B.3886AC01@knmi.nl> <3B97DC58.486C683D@moene.indiv.nluug.nl>
On Thu, Sep 06, 2001 at 10:28:08PM +0200, Toon Moene wrote:
> Somehow, the giv-combine code doesn't examine the base addresses of
> these arrays [quoting swim.f.11.loop]:
[...]
> Giv 80: insn 40 src reg 69 benefit 4 lifetime 8 replaceable
> mult (4)
> add (const (plus (symbol_ref ("com_")) (-4)))
> Giv 88: insn 51 src reg 69 benefit 4 lifetime 3 replaceable
> mult (4)
> add (const (plus (symbol_ref ("com_")) (396)))
Whee.
r~
Index: simplify-rtx.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/simplify-rtx.c,v
retrieving revision 1.41.2.3
diff -c -p -d -r1.41.2.3 simplify-rtx.c
*** simplify-rtx.c 2001/04/05 00:52:19 1.41.2.3
--- simplify-rtx.c 2001/09/06 21:45:16
*************** simplify_binary_operation (code, mode, o
*** 1110,1115 ****
--- 1110,1137 ----
return simplify_gen_binary (AND, mode, op0,
gen_rtx_NOT (mode, XEXP (op1, 0)));
}
+
+ /* Simplify operations with constants containing embedded offsets. */
+ if (GET_CODE (op0) == CONST)
+ {
+ tem = simplify_binary_operation (code, mode, XEXP (op0, 0), op1);
+ if (tem)
+ {
+ if (CONSTANT_P (op1) && ! CONSTANT_P (tem))
+ tem = gen_rtx_CONST (mode, tem);
+ return tem;
+ }
+ }
+ if (GET_CODE (op1) == CONST)
+ {
+ tem = simplify_binary_operation (code, mode, op0, XEXP (op1, 0));
+ if (tem)
+ {
+ if (CONSTANT_P (op0) && ! CONSTANT_P (tem))
+ tem = gen_rtx_CONST (mode, tem);
+ return tem;
+ }
+ }
break;
case MULT: