Commit 42601c63 by Georg-Johann Lay Committed by Georg-Johann Lay

re PR target/52506 ([avr]: XMEGA: Wrong order of save/restore of RAMPX/Y/Z/D…

re PR target/52506 ([avr]: XMEGA: Wrong order of save/restore of RAMPX/Y/Z/D SFRs in ISR pro-/epilogue)

	PR target/52506
	* gcc/config/avr/avr.c (expand_epilogue): Fix order of restoration
	to: RAMPZ, RAMPY, RAMPX, RAMPD.
	(expand_prologue): Only clear RAMPZ if it has effect on RAM-read.

From-SVN: r185032
parent 61108225
2012-03-07 Georg-Johann Lay <avr@gjlay.de> 2012-03-07 Georg-Johann Lay <avr@gjlay.de>
PR target/52506
* gcc/config/avr/avr.c (expand_epilogue): Fix order of restoration
to: RAMPZ, RAMPY, RAMPX, RAMPD.
(expand_prologue): Only clear RAMPZ if it has effect on RAM-read.
2012-03-07 Georg-Johann Lay <avr@gjlay.de>
PR target/52505 PR target/52505
* config/avr/avr.c (avr_out_xload): Don't read unintentionally * config/avr/avr.c (avr_out_xload): Don't read unintentionally
from RAM. from RAM.
......
...@@ -1123,11 +1123,11 @@ expand_prologue (void) ...@@ -1123,11 +1123,11 @@ expand_prologue (void)
emit_push_sfr (rampy_rtx, false /* frame-related */, true /* clr */); emit_push_sfr (rampy_rtx, false /* frame-related */, true /* clr */);
} }
if (AVR_HAVE_RAMPZ if (AVR_HAVE_RAMPZ
&& TEST_HARD_REG_BIT (set, REG_Z) && TEST_HARD_REG_BIT (set, REG_Z)
&& TEST_HARD_REG_BIT (set, REG_Z + 1)) && TEST_HARD_REG_BIT (set, REG_Z + 1))
{ {
emit_push_sfr (rampz_rtx, false /* frame-related */, true /* clr */); emit_push_sfr (rampz_rtx, false /* frame-related */, AVR_HAVE_RAMPD);
} }
} /* is_interrupt is_signal */ } /* is_interrupt is_signal */
...@@ -1347,12 +1347,12 @@ expand_epilogue (bool sibcall_p) ...@@ -1347,12 +1347,12 @@ expand_epilogue (bool sibcall_p)
/* Restore RAMPZ/Y/X/D using tmp_reg as scratch. /* Restore RAMPZ/Y/X/D using tmp_reg as scratch.
The conditions to restore them must be tha same as in prologue. */ The conditions to restore them must be tha same as in prologue. */
if (AVR_HAVE_RAMPX if (AVR_HAVE_RAMPZ
&& TEST_HARD_REG_BIT (set, REG_X) && TEST_HARD_REG_BIT (set, REG_Z)
&& TEST_HARD_REG_BIT (set, REG_X + 1)) && TEST_HARD_REG_BIT (set, REG_Z + 1))
{ {
emit_pop_byte (TMP_REGNO); emit_pop_byte (TMP_REGNO);
emit_move_insn (rampx_rtx, tmp_reg_rtx); emit_move_insn (rampz_rtx, tmp_reg_rtx);
} }
if (AVR_HAVE_RAMPY if (AVR_HAVE_RAMPY
...@@ -1364,12 +1364,12 @@ expand_epilogue (bool sibcall_p) ...@@ -1364,12 +1364,12 @@ expand_epilogue (bool sibcall_p)
emit_move_insn (rampy_rtx, tmp_reg_rtx); emit_move_insn (rampy_rtx, tmp_reg_rtx);
} }
if (AVR_HAVE_RAMPZ if (AVR_HAVE_RAMPX
&& TEST_HARD_REG_BIT (set, REG_Z) && TEST_HARD_REG_BIT (set, REG_X)
&& TEST_HARD_REG_BIT (set, REG_Z + 1)) && TEST_HARD_REG_BIT (set, REG_X + 1))
{ {
emit_pop_byte (TMP_REGNO); emit_pop_byte (TMP_REGNO);
emit_move_insn (rampz_rtx, tmp_reg_rtx); emit_move_insn (rampx_rtx, tmp_reg_rtx);
} }
if (AVR_HAVE_RAMPD) if (AVR_HAVE_RAMPD)
......
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