minor addition improvement
authorspth <spth@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 30 Dec 2008 22:29:12 +0000 (22:29 +0000)
committerspth <spth@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 30 Dec 2008 22:29:12 +0000 (22:29 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5311 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
src/z80/gen.c
src/z80/peeph-z80.def

index 34d809ca5ffdf1eaf9fa7e81daa3372574d6e93a..124f5e00dc24f3d4b4bd41ca84a54d1d989c18e1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,9 @@
+2008-12-30 Philipp Klaus Krause <pkk AT spth.de>
+
+       * src/z80/gen.c,
+         src/z80/peeph-z80.def:
+         Minor addition improvement.
+
 2008-12-30 Raphael Neider <rneider AT web.de>
 
        * as/link/hc08/lkelf.c, as/link/lkaomf51.c, as/link/lklibr.c,
index 817acecc230fa68f6aa29b5f22d73c2c628e9863..82117185c2cbba51fcaa3651f5085e5a147214fb 100644 (file)
@@ -3994,7 +3994,12 @@ genPlus (iCode * ic)
     {
       _moveA (aopGet (AOP (IC_LEFT (ic)), offset, FALSE));
       if (offset == 0)
-        emit2 ("add a,%s", aopGet (AOP (IC_RIGHT (ic)), offset, FALSE));
+      {
+        if(size == 0 && AOP_TYPE (IC_RIGHT (ic)) == AOP_LIT && ulFromVal (AOP (IC_RIGHT (ic))->aopu.aop_lit) == 1)
+         emit2 ("inc a");
+        else
+          emit2 ("add a,%s", aopGet (AOP (IC_RIGHT (ic)), offset, FALSE));
+      }
       else
         emit2 ("adc a,%s", aopGet (AOP (IC_RIGHT (ic)), offset, FALSE));
       aopPut (AOP (IC_RESULT (ic)), "a", offset++);
index ba83efff4dbc3e3fc7ac1c14559d66fa027cc948..6c258c09e468168acb30678f188cdd59c628ab02 100644 (file)
@@ -799,6 +799,36 @@ replace restart {
        //add   %3, %4
 }
 
+replace restart {
+       ld      l,%1 (ix)
+       ld      h,%2 (ix)
+       ld      a,(hl)
+       inc     a
+       ld      l,%1 (ix)
+       ld      h,%2 (ix)
+       ld      (hl),a
+} by {
+       ld      l,%1 (ix)
+       ld      h,%2 (ix)
+       inc     (hl)
+       ; peephole 42c incremented in (hl) instead of going through a.
+} if notUsed('a')
+
+replace restart {
+       ld      l,%1 (ix)
+       ld      h,%2 (ix)
+       ld      a,(hl)
+       dec     a
+       ld      l,%1 (ix)
+       ld      h,%2 (ix)
+       ld      (hl),a
+} by {
+       ld      l,%1 (ix)
+       ld      h,%2 (ix)
+       dec     (hl)
+       ; peephole 42d decremented in (hl) instead of going through a.
+} if notUsed('a')
+
 replace restart {
        ld      %1,a
        ld      a,%2