From 79c09794a4bf2dbc0d25d5dae5992871a16e5d85 Mon Sep 17 00:00:00 2001 From: kkojima Date: Mon, 18 May 2009 12:53:22 +0000 Subject: [PATCH] * 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. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@147661 138bc75d-0d04-0410-961f-82ee72b054a4 --- gcc/ChangeLog | 6 ++++++ gcc/config/sh/sh.c | 11 ++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/gcc/ChangeLog b/gcc/ChangeLog index b769bcc1dd4..575773f0618 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,9 @@ +2009-05-18 Kaz Kojima + + * 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 * config/s390/2064.md: Remove trailing whitespaces. diff --git a/gcc/config/sh/sh.c b/gcc/config/sh/sh.c index 79343bfdfd2..363934d74da 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) -- 2.11.0