diff options
author | Georg-Johann Lay <avr@gjlay.de> | 2012-03-07 10:38:25 +0000 |
---|---|---|
committer | Georg-Johann Lay <gjl@gcc.gnu.org> | 2012-03-07 10:38:25 +0000 |
commit | 42601c633c7cf0c9617c3dfb5e9334527ca9d5c4 (patch) | |
tree | 44328b3e4e663e7c2f142753cab701d61b37d86f /gcc/config/avr/avr.c | |
parent | 611082257d0365f045685d125954cb5294a8c7b8 (diff) | |
download | gcc-42601c633c7cf0c9617c3dfb5e9334527ca9d5c4.tar.gz |
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
Diffstat (limited to 'gcc/config/avr/avr.c')
-rw-r--r-- | gcc/config/avr/avr.c | 20 |
1 files changed, 10 insertions, 10 deletions
diff --git a/gcc/config/avr/avr.c b/gcc/config/avr/avr.c index 87b7e0953da..0fcec0dff1a 100644 --- a/gcc/config/avr/avr.c +++ b/gcc/config/avr/avr.c @@ -1123,11 +1123,11 @@ expand_prologue (void) 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 + 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 */ @@ -1347,12 +1347,12 @@ expand_epilogue (bool sibcall_p) /* Restore RAMPZ/Y/X/D using tmp_reg as scratch. The conditions to restore them must be tha same as in prologue. */ - if (AVR_HAVE_RAMPX - && TEST_HARD_REG_BIT (set, REG_X) - && TEST_HARD_REG_BIT (set, REG_X + 1)) + if (AVR_HAVE_RAMPZ + && TEST_HARD_REG_BIT (set, REG_Z) + && TEST_HARD_REG_BIT (set, REG_Z + 1)) { 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 @@ -1364,12 +1364,12 @@ expand_epilogue (bool sibcall_p) emit_move_insn (rampy_rtx, tmp_reg_rtx); } - if (AVR_HAVE_RAMPZ - && TEST_HARD_REG_BIT (set, REG_Z) - && TEST_HARD_REG_BIT (set, REG_Z + 1)) + if (AVR_HAVE_RAMPX + && TEST_HARD_REG_BIT (set, REG_X) + && TEST_HARD_REG_BIT (set, REG_X + 1)) { 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) |