+2004-06-25 Richard Sandiford <rsandifo@redhat.com>
+
+ PR target/16176
+ * config/mips/mips.c (mips_expand_unaligned_load): Use a temporary
+ register for the destination of the lwl or ldl.
+
2004-06-25 Richard Kenner <kenner@vlsi1.ultra.nyu.edu>
* tree-cfg.c (verify_expr): Add macro CHECK_OK.
bool
mips_expand_unaligned_load (rtx dest, rtx src, unsigned int width, int bitpos)
{
- rtx left, right;
+ rtx left, right, temp;
/* If TARGET_64BIT, the destination of a 32-bit load will be a
paradoxical word_mode subreg. This is the only case in which
if (!mips_get_unaligned_mem (&src, width, bitpos, &left, &right))
return false;
+ temp = gen_reg_rtx (GET_MODE (dest));
if (GET_MODE (dest) == DImode)
{
- emit_insn (gen_mov_ldl (dest, src, left));
- emit_insn (gen_mov_ldr (copy_rtx (dest), copy_rtx (src),
- right, copy_rtx (dest)));
+ emit_insn (gen_mov_ldl (temp, src, left));
+ emit_insn (gen_mov_ldr (dest, copy_rtx (src), right, temp));
}
else
{
- emit_insn (gen_mov_lwl (dest, src, left));
- emit_insn (gen_mov_lwr (copy_rtx (dest), copy_rtx (src),
- right, copy_rtx (dest)));
+ emit_insn (gen_mov_lwl (temp, src, left));
+ emit_insn (gen_mov_lwr (dest, copy_rtx (src), right, temp));
}
return true;
}
--- /dev/null
+/* From PR target/16176 */
+struct __attribute__ ((packed)) s { struct s *next; };
+
+struct s * __attribute__ ((noinline))
+maybe_next (struct s *s, int t)
+{
+ if (t)
+ s = s->next;
+ return s;
+}
+
+int main ()
+{
+ struct s s1, s2;
+
+ s1.next = &s2;
+ if (maybe_next (&s1, 1) != &s2)
+ abort ();
+ exit (0);
+}