(movqi): For special case of moving byte to stack, push into low byte and then copy...
authorRichard Stallman <rms@gnu.org>
Sun, 7 Feb 1993 01:24:09 +0000 (01:24 +0000)
committerRichard Stallman <rms@gnu.org>
Sun, 7 Feb 1993 01:24:09 +0000 (01:24 +0000)
(movqi): For special case of moving byte
to stack, push into low byte and then copy to high byte.
For case of moving to/from address reg, exchange it with d0.

From-SVN: r3433

gcc/config/m68k/m68k.md

index 98e0b734525b84fcf2575d1033e3da575152cac8..5fac2b9b67fe87e78be1f103f5528946f6c09614 100644 (file)
       xoperands[2]
         = gen_rtx (MEM, QImode,
                   gen_rtx (PLUS, VOIDmode, stack_pointer_rtx, const1_rtx));
-      xoperands[3] = stack_pointer_rtx;
       /* Just pushing a byte puts it in the high byte of the halfword.  */
       /* We must put it in the low-order, high-numbered byte.  */
-      output_asm_insn (\"subq%.w %#2,%3\;move%.b %1,%2\", xoperands);
+      output_asm_insn (\"move%.b %1,%-\;move%.b %@,%2\", xoperands);
       return \"\";
     }
 
+  /* Moving a byte into an address register is not possible.  */
+  /* Use d0 as an intermediate, but don't clobber its contents.  */
   if (ADDRESS_REG_P (operands[0]) && GET_CODE (operands[1]) == MEM)
-    {
-      xoperands[1] = operands[1];
-      xoperands[2]
-        = gen_rtx (MEM, QImode,
-                  gen_rtx (PLUS, VOIDmode, stack_pointer_rtx, const1_rtx));
-      xoperands[3] = stack_pointer_rtx;
-      /* Just pushing a byte puts it in the high byte of the halfword.  */
-      /* We must put it in the low half, the second byte.  */
-      output_asm_insn (\"subq%.w %#2,%3\;move%.b %1,%2\", xoperands);
-      return \"move%.w %+,%0\";
-    }
+    return \"exg %/d0,%0\;move%.b %1,%/d0\;exg %/d0,%0\";
+  /* Likewise for moving from an address reg.  */
   if (ADDRESS_REG_P (operands[1]) && GET_CODE (operands[0]) == MEM)
-    {
-      xoperands[0] = operands[0];
-      xoperands[1] = operands[1];
-      xoperands[2]
-        = gen_rtx (MEM, QImode,
-                  gen_rtx (PLUS, VOIDmode, stack_pointer_rtx, const1_rtx));
-      xoperands[3] = stack_pointer_rtx;
-      output_asm_insn (\"move%.w %1,%-\;move%.b %2,%0\;addq%.w %#2,%3\", xoperands);
-      return \"\";
-    }
+    return \"exg %/d0,%1\;move%.b %/d0,%0\;exg %/d0,%1\";
+
   /* clr and st insns on 68000 read before writing.
      This isn't so on the 68010, but we have no alternative for it.  */
   if (TARGET_68020