aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaz Kojima <kkojima@gcc.gnu.org>2009-05-18 12:53:22 +0000
committerKaz Kojima <kkojima@gcc.gnu.org>2009-05-18 12:53:22 +0000
commit99052692869f6b6b69812de102b2c7f6e105ed38 (patch)
treeaba1a238f5d6edfe3bc0b8afee3403a4cc17a199
parentf4aa38482cd7374e7fd6e0ff968f6c84e0823a0a (diff)
downloadgcc-99052692869f6b6b69812de102b2c7f6e105ed38.zip
gcc-99052692869f6b6b69812de102b2c7f6e105ed38.tar.gz
gcc-99052692869f6b6b69812de102b2c7f6e105ed38.tar.bz2
sh.c (expand_cbranchdi4): Use a scratch register for the none zero constant operand except for EQ and NE...
* config/sh/sh.c (expand_cbranchdi4): Use a scratch register for the none zero constant operand except for EQ and NE comprisons even when the first operand is R0. From-SVN: r147661
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/sh/sh.c11
2 files changed, 14 insertions, 3 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index b769bcc..575773f 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2009-05-18 Kaz Kojima <kkojima@gcc.gnu.org>
+
+ * config/sh/sh.c (expand_cbranchdi4): Use a scratch register
+ for the none zero constant operand except for EQ and NE
+ comprisons even when the first operand is R0.
+
2009-05-18 Andreas Krebbel <krebbel1@de.ibm.com>
* config/s390/2064.md: Remove trailing whitespaces.
diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c
index 79343bf..363934d 100644
--- a/gcc/config/sh/sh.c
+++ b/gcc/config/sh/sh.c
@@ -1632,7 +1632,8 @@ expand_cbranchdi4 (rtx *operands, enum rtx_code comparison)
operands[2] = op2h;
operands[4] = NULL_RTX;
if (reload_completed
- && ! arith_reg_or_0_operand (op2h, SImode) && true_regnum (op1h)
+ && ! arith_reg_or_0_operand (op2h, SImode)
+ && (true_regnum (op1h) || (comparison != EQ && comparison != NE))
&& (msw_taken != LAST_AND_UNUSED_RTX_CODE
|| msw_skip != LAST_AND_UNUSED_RTX_CODE))
{
@@ -1662,8 +1663,12 @@ expand_cbranchdi4 (rtx *operands, enum rtx_code comparison)
if (lsw_taken != LAST_AND_UNUSED_RTX_CODE)
{
if (reload_completed
- && ! arith_reg_or_0_operand (op2l, SImode) && true_regnum (op1l))
- operands[4] = scratch;
+ && ! arith_reg_or_0_operand (op2l, SImode)
+ && (true_regnum (op1l) || (lsw_taken != EQ && lsw_taken != NE)))
+ {
+ emit_move_insn (scratch, operands[2]);
+ operands[2] = scratch;
+ }
expand_cbranchsi4 (operands, lsw_taken, lsw_taken_prob);
}
if (msw_skip != LAST_AND_UNUSED_RTX_CODE)