Fixed increase of a DWORD in registers
authormichaelh <michaelh@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 9 Apr 2000 18:16:00 +0000 (18:16 +0000)
committermichaelh <michaelh@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Sun, 9 Apr 2000 18:16:00 +0000 (18:16 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@230 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/z80/gen.c

index b0e206a98aa5287e96c0bbdf3f31fab6fc5f77fa..0313979b0bd721dc4afe1102345777b611510e45 100644 (file)
@@ -1786,17 +1786,21 @@ static bool genPlusIncr (iCode *ic)
 
     /* if increment 16 bits in register */
     if (sameRegs(AOP(IC_LEFT(ic)), AOP(IC_RESULT(ic))) &&
-        (size > 1) &&
-        (icount == 1)) {
-        symbol *tlbl = newiTempLabel(NULL);
-       emitcode("inc","%s",aopGet(AOP(IC_RESULT(ic)),LSB,FALSE));
-       emit2("!shortjp nz,!tlabel", tlbl->key+100);
-    
-       emitcode("inc","%s",aopGet(AOP(IC_RESULT(ic)),MSB16,FALSE));
-       if(size == 4) {
-           wassert(0);
+        size > 1 &&
+        icount == 1
+       ) {
+       int offset = 0;
+       symbol *tlbl = NULL;
+       while (size--) {
+           if (offset) {
+               emitLabel(tlbl->key+100);
+           }
+           emitcode("inc","%s",aopGet(AOP(IC_RESULT(ic)), offset++, FALSE));
+           if (size) {
+               tlbl = newiTempLabel(NULL);
+               emit2("!shortjp nz,!tlabel", tlbl->key+100);
+           }
        }
-       emitLabel(tlbl->key+100);
         return TRUE;
     }