summaryrefslogtreecommitdiff
path: root/gcc/optabs.c
diff options
context:
space:
mode:
authorsayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2003-06-04 04:40:26 +0000
committersayle <sayle@138bc75d-0d04-0410-961f-82ee72b054a4>2003-06-04 04:40:26 +0000
commit1d37ed9887a8e72c1d2a9faf049d1bbadc749426 (patch)
tree67b5d6858fb39427830d82a836947e99546454e9 /gcc/optabs.c
parent5e8603b7b6936d6b2dc38729a31bf077ad0c9268 (diff)
downloadgcc-1d37ed9887a8e72c1d2a9faf049d1bbadc749426.tar.gz
* optabs.c (expand_binop): Attempt to reuse pseudos for duplicate
non-volatile operands of binary operations. (prepare_cmp_insn): Likewise. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@67417 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r--gcc/optabs.c26
1 files changed, 22 insertions, 4 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c
index b59f89ca8c0..171d13f2d6e 100644
--- a/gcc/optabs.c
+++ b/gcc/optabs.c
@@ -700,8 +700,17 @@ expand_binop (mode, binoptab, op0, op1, target, unsignedp, methods)
if (flag_force_mem)
{
- op0 = force_not_mem (op0);
- op1 = force_not_mem (op1);
+ /* Load duplicate non-volatile operands once. */
+ if (rtx_equal_p (op0, op1) && ! volatile_refs_p (op0))
+ {
+ op0 = force_not_mem (op0);
+ op1 = op0;
+ }
+ else
+ {
+ op0 = force_not_mem (op0);
+ op1 = force_not_mem (op1);
+ }
}
/* If subtracting an integer constant, convert this into an addition of
@@ -3587,8 +3596,17 @@ prepare_cmp_insn (px, py, pcomparison, size, pmode, punsignedp, purpose)
if (mode != BLKmode && flag_force_mem)
{
- x = force_not_mem (x);
- y = force_not_mem (y);
+ /* Load duplicate non-volatile operands once. */
+ if (rtx_equal_p (x, y) && ! volatile_refs_p (x))
+ {
+ x = force_not_mem (x);
+ y = x;
+ }
+ else
+ {
+ x = force_not_mem (x);
+ y = force_not_mem (y);
+ }
}
/* If we are inside an appropriately-short loop and one operand is an