This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Further improve optimization/6585
- From: law at redhat dot com
- To: gcc-patches at gcc dot gnu dot org
- Date: Tue, 21 May 2002 19:57:39 -0600
- Subject: Further improve optimization/6585
- Reply-to: law at redhat dot com
This patch further improves optimization/6585 by avoiding the unnecessary
use of a SUBREG as an accumulator when expanding double-word multiplies.
Instead we use a new word-sized pseudo.
For Bruno's testcase it eliminates 8 bytes of unnecessary stack space and
more importantly accumulation of the cross products is done in registers
rather than in memory. Instead of 7 memory stores, we only do 5 memory stores.
We're still doing things that could be better, but the code is slowly
improving.
This has been bootstrapped and regression tested on x86-linux. Installed into
the mainline sources.
* optabs.c (expand_binop): For double-word integer multiplies,
do not compute intermediate results into something that is
not a register (such as a SUBREG or MEM).
Index: optabs.c
===================================================================
RCS file: /cvs/gcc/gcc/gcc/optabs.c,v
retrieving revision 1.132
diff -c -3 -p -r1.132 optabs.c
*** optabs.c 20 May 2002 08:30:03 -0000 1.132
--- optabs.c 22 May 2002 01:36:31 -0000
*************** expand_binop (mode, binoptab, op0, op1,
*** 1461,1466 ****
--- 1461,1469 ----
rtx temp = expand_binop (word_mode, binoptab, op0_low, op1_xhigh,
NULL_RTX, 0, OPTAB_DIRECT);
+ if (!REG_P (product_high))
+ product_high = force_reg (word_mode, product_high);
+
if (temp != 0)
temp = expand_binop (word_mode, add_optab, temp, product_high,
product_high, 0, next_methods);
*************** expand_binop (mode, binoptab, op0, op1,
*** 1479,1484 ****
--- 1482,1489 ----
if (temp != 0 && temp != product_high)
emit_move_insn (product_high, temp);
+
+ emit_move_insn (operand_subword (product, high, 1, mode), product_high);
if (temp != 0)
{