(movqi): In address reg case, if d0
authorRichard Stallman <rms@gnu.org>
Sat, 20 Mar 1993 06:54:26 +0000 (06:54 +0000)
committerRichard Stallman <rms@gnu.org>
Sat, 20 Mar 1993 06:54:26 +0000 (06:54 +0000)
appears in the address, use d1 instead as intermediate reg.

From-SVN: r3797

gcc/config/m68k/m68k.md

index dc8c45a..c31ba9b 100644 (file)
   /* 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)
-    return \"exg %/d0,%0\;move%.b %1,%/d0\;exg %/d0,%0\";
+    {
+      /* If the address of operand 1 uses d0, choose d1 as intermediate.  */
+      if (refers_to_regno_p (0, 1, operands[1], NULL_RTX))
+       return \"exg %/d1,%0\;move%.b %1,%/d1\;exg %/d1,%0\";
+      /* Otherwise d0 is usable.
+        (An effective address on the 68k can't use two d-regs.)  */
+      else
+       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)
-    return \"exg %/d0,%1\;move%.b %/d0,%0\;exg %/d0,%1\";
+    {
+      if (refers_to_regno_p (0, 1, operands[0], NULL_RTX))
+        return \"exg %/d1,%1\;move%.b %/d1,%0\;exg %/d1,%1\";
+      else
+        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.  */