Commit 6f8eec29 by J"orn Rennecke Committed by Kaz Kojima

re PR target/29746 (gcc fails to bootstrap on sh4-*-linux-gnu)

	PR target/29746
	* config/sh/sh.c (expand_cbranchdi4): Use scratch register
	properly.
	(sh_initialize_trampoline): Add parentheses to avoid a warning.


Co-Authored-By: Kaz Kojima <kkojima@gcc.gnu.org>

From-SVN: r121671
parent 89f8f30f
2007-02-06 J"orn Rennecke <joern.rennecke@arc.com>
Kaz Kojima <kkojima@gcc.gnu.org>
PR target/29746
* config/sh/sh.c (expand_cbranchdi4): Use scratch register
properly.
(sh_initialize_trampoline): Add parentheses to avoid a warning.
2007-02-06 Zdenek Dvorak <dvorakz@suse.cz> 2007-02-06 Zdenek Dvorak <dvorakz@suse.cz>
* doc/loop.texi: Document possibility not to perform disambiguation * doc/loop.texi: Document possibility not to perform disambiguation
......
...@@ -1488,6 +1488,7 @@ expand_cbranchdi4 (rtx *operands, enum rtx_code comparison) ...@@ -1488,6 +1488,7 @@ expand_cbranchdi4 (rtx *operands, enum rtx_code comparison)
int num_branches; int num_branches;
int prob, rev_prob; int prob, rev_prob;
int msw_taken_prob = -1, msw_skip_prob = -1, lsw_taken_prob = -1; int msw_taken_prob = -1, msw_skip_prob = -1, lsw_taken_prob = -1;
rtx scratch = operands[4];
comparison = prepare_cbranch_operands (operands, DImode, comparison); comparison = prepare_cbranch_operands (operands, DImode, comparison);
op1h = gen_highpart_mode (SImode, DImode, operands[1]); op1h = gen_highpart_mode (SImode, DImode, operands[1]);
...@@ -1539,7 +1540,7 @@ expand_cbranchdi4 (rtx *operands, enum rtx_code comparison) ...@@ -1539,7 +1540,7 @@ expand_cbranchdi4 (rtx *operands, enum rtx_code comparison)
return true; return true;
} }
msw_taken = NE; msw_taken = NE;
lsw_taken_prob = prob; msw_taken_prob = prob;
lsw_taken = NE; lsw_taken = NE;
lsw_taken_prob = 0; lsw_taken_prob = 0;
break; break;
...@@ -1611,6 +1612,13 @@ expand_cbranchdi4 (rtx *operands, enum rtx_code comparison) ...@@ -1611,6 +1612,13 @@ expand_cbranchdi4 (rtx *operands, enum rtx_code comparison)
operands[1] = op1h; operands[1] = op1h;
operands[2] = op2h; operands[2] = op2h;
operands[4] = NULL_RTX; operands[4] = NULL_RTX;
if (reload_completed
&& ! arith_reg_or_0_operand (op2h, SImode) && true_regnum (op1h)
&& (msw_taken != CODE_FOR_nothing || msw_skip != CODE_FOR_nothing))
{
emit_move_insn (scratch, operands[2]);
operands[2] = scratch;
}
if (msw_taken != CODE_FOR_nothing) if (msw_taken != CODE_FOR_nothing)
expand_cbranchsi4 (operands, msw_taken, msw_taken_prob); expand_cbranchsi4 (operands, msw_taken, msw_taken_prob);
if (msw_skip != CODE_FOR_nothing) if (msw_skip != CODE_FOR_nothing)
...@@ -1624,7 +1632,12 @@ expand_cbranchdi4 (rtx *operands, enum rtx_code comparison) ...@@ -1624,7 +1632,12 @@ expand_cbranchdi4 (rtx *operands, enum rtx_code comparison)
operands[1] = op1l; operands[1] = op1l;
operands[2] = op2l; operands[2] = op2l;
if (lsw_taken != CODE_FOR_nothing) if (lsw_taken != CODE_FOR_nothing)
expand_cbranchsi4 (operands, lsw_taken, lsw_taken_prob); {
if (reload_completed
&& ! arith_reg_or_0_operand (op2l, SImode) && true_regnum (op1l))
operands[4] = scratch;
expand_cbranchsi4 (operands, lsw_taken, lsw_taken_prob);
}
if (msw_skip != CODE_FOR_nothing) if (msw_skip != CODE_FOR_nothing)
emit_label (skip_label); emit_label (skip_label);
return true; return true;
...@@ -9600,7 +9613,7 @@ sh_initialize_trampoline (rtx tramp, rtx fnaddr, rtx cxt) ...@@ -9600,7 +9613,7 @@ sh_initialize_trampoline (rtx tramp, rtx fnaddr, rtx cxt)
if (TARGET_HARVARD) if (TARGET_HARVARD)
{ {
if (!TARGET_INLINE_IC_INVALIDATE if (!TARGET_INLINE_IC_INVALIDATE
|| !(TARGET_SH4A_ARCH || TARGET_SH4_300) && TARGET_USERMODE) || (!(TARGET_SH4A_ARCH || TARGET_SH4_300) && TARGET_USERMODE))
emit_library_call (function_symbol (NULL, "__ic_invalidate", emit_library_call (function_symbol (NULL, "__ic_invalidate",
FUNCTION_ORDINARY), FUNCTION_ORDINARY),
0, VOIDmode, 1, tramp, SImode); 0, VOIDmode, 1, tramp, SImode);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment