diff options
author | Roger Sayle <roger@eyesopen.com> | 2003-06-04 04:40:26 +0000 |
---|---|---|
committer | Roger Sayle <sayle@gcc.gnu.org> | 2003-06-04 04:40:26 +0000 |
commit | 894207cf0ac9f0a841565779d78777cee2464e55 (patch) | |
tree | 67b5d6858fb39427830d82a836947e99546454e9 /gcc/optabs.c | |
parent | 1063147cc08d7f22bad9ad3bc0bf758b070611ca (diff) | |
download | gcc-894207cf0ac9f0a841565779d78777cee2464e55.zip gcc-894207cf0ac9f0a841565779d78777cee2464e55.tar.gz gcc-894207cf0ac9f0a841565779d78777cee2464e55.tar.bz2 |
optabs.c (expand_binop): Attempt to reuse pseudos for duplicate non-volatile operands of binary operations.
* optabs.c (expand_binop): Attempt to reuse pseudos for duplicate
non-volatile operands of binary operations.
(prepare_cmp_insn): Likewise.
From-SVN: r67417
Diffstat (limited to 'gcc/optabs.c')
-rw-r--r-- | gcc/optabs.c | 26 |
1 files changed, 22 insertions, 4 deletions
diff --git a/gcc/optabs.c b/gcc/optabs.c index b59f89c..171d13f 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 |