2001-10-21 Michael Hope <michaelh@juju.net.nz>
[fw/sdcc] / src / z80 / peeph.def
index 4ef4a4b743eb98fba3a0e70afcf0bc21f50a5e3c..5090d4b8f45c3d20fd4b3461426eab013995c83c 100644 (file)
@@ -1,7 +1,12 @@
-replace restart {
+replace {
+       ld (hl),(hl)
+} by {
+       ERROR - peephole - caught (hl),(hl)
+}
+replace {
        ld %1,%1
 } by {
-       ; Removed redundent load
+        ; Removed redundent load
 }
 replace restart {
        xor a,a
@@ -9,7 +14,6 @@ replace restart {
        or a,a
        jp %2,%3
 } by {
-       ; Removed redundent or a,a
        xor     a,a
        or      a,%1
        jp      %2,%3
@@ -18,7 +22,6 @@ replace restart {
        cp a,#0x00
        jp nz,%1
 } by {
-       ; Rule 3
        or      a,a
        jp      nz,%1
 }
@@ -29,7 +32,6 @@ replace restart {
        jp      %3
 %2:
 } by {
-       ; Rule 4
        jp      z,%2
 %1:
        jp      %3
@@ -40,7 +42,6 @@ replace restart {
        jp      %2
 %1:
 } by {
-       ; Rule 5
        jp      z,%2
 %1:
 }
@@ -49,16 +50,61 @@ replace restart {
        jp      %2
 %1:
 } by {
-       ; Rule 6
        jp      nz,%2
 %1:
 }
 replace restart {
-       ld      a,%1
-       or      a,%2
+       or      a,%1
        or      a,a
 } by {
-       ; Rule 8
+       or      a,%1
+}
+replace restart {
+       or      a,%1)
+        or      a,a
+} by {
+       or      a,%1)
+}
+replace restart {
+       xor     a,a
+       or      a,%1
+       jp      nz,%2
+       xor     a,a
+       or      a,%3
+       jp      z,%2
+} by {
+       xor     a,a
+       or      a,%1
+       jp      nz,%2
+       or      a,%3
+       jp      z,%2
+}
+replace restart {
+       jp      nz,%1
+       inc     %3)
+%1:
+       jp      %2
+} by {
+       jp      nz,%2
+       inc     %3)
+%1:
+       jp      %2
+}
+replace restart {
+       xor     a,a
+       ld      a,#0x00
+} by {
+        xor     a,a
+}
+replace restart {
+        ld      e,#0x00
+        ld      d,#0x00
+} by {
+        ld      de,#0x0000
+}
+replace restart {
+       ld      %1,a
        ld      a,%1
-       or      a,%2
+} by {
+        ld     %1,a
 }