summaryrefslogtreecommitdiff
path: root/gcc/config
diff options
context:
space:
mode:
authorrask <rask@138bc75d-0d04-0410-961f-82ee72b054a4>2007-11-26 13:20:19 +0000
committerrask <rask@138bc75d-0d04-0410-961f-82ee72b054a4>2007-11-26 13:20:19 +0000
commit39d50e809cdefce7021b37deb5e107777274efae (patch)
tree6f58da5b15fd0a15696502ec57a557360598571b /gcc/config
parent5c6565d058f8bdc273b4a9031ceada2c489137cb (diff)
downloadgcc-39d50e809cdefce7021b37deb5e107777274efae.tar.gz
PR target/34174
* config/fr30/fr30.c (fr30_move_double): Sanitize mem->reg case. Copy the address before it is clobbered. testsuite/ * gcc.dg/torture/pr34174-1.c: New. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@130438 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'gcc/config')
-rw-r--r--gcc/config/fr30/fr30.c48
1 files changed, 12 insertions, 36 deletions
diff --git a/gcc/config/fr30/fr30.c b/gcc/config/fr30/fr30.c
index 343dd02ba09..8c523567bb9 100644
--- a/gcc/config/fr30/fr30.c
+++ b/gcc/config/fr30/fr30.c
@@ -828,47 +828,23 @@ fr30_move_double (rtx * operands)
{
rtx addr = XEXP (src, 0);
int dregno = REGNO (dest);
- rtx dest0;
- rtx dest1;
+ rtx dest0 = operand_subword (dest, 0, TRUE, mode);;
+ rtx dest1 = operand_subword (dest, 1, TRUE, mode);;
rtx new_mem;
- /* If the high-address word is used in the address, we
- must load it last. Otherwise, load it first. */
- int reverse = (refers_to_regno_p (dregno, dregno + 1, addr, 0) != 0);
-
gcc_assert (GET_CODE (addr) == REG);
- dest0 = operand_subword (dest, reverse, TRUE, mode);
- dest1 = operand_subword (dest, !reverse, TRUE, mode);
-
- if (reverse)
- {
- emit_insn (gen_rtx_SET (VOIDmode, dest1,
- adjust_address (src, SImode, 0)));
- emit_insn (gen_rtx_SET (SImode, dest0,
- gen_rtx_REG (SImode, REGNO (addr))));
- emit_insn (gen_rtx_SET (SImode, dest0,
- plus_constant (dest0, UNITS_PER_WORD)));
-
- new_mem = gen_rtx_MEM (SImode, dest0);
- MEM_COPY_ATTRIBUTES (new_mem, src);
-
- emit_insn (gen_rtx_SET (VOIDmode, dest0, new_mem));
- }
- else
- {
- emit_insn (gen_rtx_SET (VOIDmode, dest0,
- adjust_address (src, SImode, 0)));
- emit_insn (gen_rtx_SET (SImode, dest1,
- gen_rtx_REG (SImode, REGNO (addr))));
- emit_insn (gen_rtx_SET (SImode, dest1,
- plus_constant (dest1, UNITS_PER_WORD)));
-
- new_mem = gen_rtx_MEM (SImode, dest1);
- MEM_COPY_ATTRIBUTES (new_mem, src);
+ /* Copy the address before clobbering it. See PR 34174. */
+ emit_insn (gen_rtx_SET (SImode, dest1, addr));
+ emit_insn (gen_rtx_SET (VOIDmode, dest0,
+ adjust_address (src, SImode, 0)));
+ emit_insn (gen_rtx_SET (SImode, dest1,
+ plus_constant (dest1, UNITS_PER_WORD)));
+
+ new_mem = gen_rtx_MEM (SImode, dest1);
+ MEM_COPY_ATTRIBUTES (new_mem, src);
- emit_insn (gen_rtx_SET (VOIDmode, dest1, new_mem));
- }
+ emit_insn (gen_rtx_SET (VOIDmode, dest1, new_mem));
}
else if (src_code == CONST_INT || src_code == CONST_DOUBLE)
{