Improved caching of pointers and division
[fw/sdcc] / src / z80 / peeph-z80.def
index 6d43c9b2439c503ca1d660a50ee2256ddffc6695..a1299d443ec0fccadfaf17907bf9ed36c4ef360f 100644 (file)
@@ -62,9 +62,17 @@ replace restart {
        ld      a,%3 (%1)
 } by {
        ; peephole 0d loaded %2 into a directly instead of going through %1.
-       ld      a,(#%2+%3)
+       ld      a,(#%2 + %3)
 } if notUsed(%1)
 
+replace restart {
+       ld      hl,#%1 + %2
+       ld      a, (hl)
+} by {
+       ; peephole 0d' loaded %2 into a directly instead of going through %1.
+       ld      a, (#%1 + %2)
+} if notUsed('hl')
+
 replace restart {
        srl     %1
        ld      a,%1
@@ -403,13 +411,24 @@ replace restart {
 
 replace restart {
        ld      iy,#%1
-       ld      %2,%3 (%4)
+       ld      %2,%3 (iy)
 } by {
        ; peephole 0ze used hl instead of iy.
        ld      hl,#%1 + %3
        ld      %2,(hl)
 } if notUsed('iy'), notUsed('hl')
 
+replace restart {
+       ld      iy,#%1
+       ld      %2 (iy),%3
+       ld      l,%2 (iy)
+} by {
+       ; peephole 0ze' used hl instead of iy.
+       ld      hl,#%1 + %2
+       ld      (hl),%3
+       ld      l,(hl)
+} if notUsed('iy'), notUsed('h')
+
 replace restart {
        ld      iy,#%1
        ld      %2 (%3), %4