* src/pic16/gen.c: applied patches :
authorborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 29 Jul 2008 18:47:55 +0000 (18:47 +0000)
committerborutr <borutr@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Tue, 29 Jul 2008 18:47:55 +0000 (18:47 +0000)
  2030306: [1/3] PIC16: fix failing rotate.c tests on 16-bit variables,
  2030307: [2/3] PIC16: fix failing rotate.c tests for 32-bit var (1),
  2030310: [3/3] PIC16: fix failing rotate.c tests for 32-bit var (2),
  thanks Mauro Giachero

git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@5200 4a8a32a2-be11-0410-ad9d-d568d2c75423

ChangeLog
src/pic16/gen.c

index 228c241dcc1449c078c695079fab9c961b734893..adc96c243e4d8c3d468cf5c4ce5854b2489556de 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,11 @@
+2008-06-12 Borut Razem <borut.razem AT siol.net>
+
+       * src/pic16/gen.c: applied patches :
+         2030306: [1/3] PIC16: fix failing rotate.c tests on 16-bit variables,
+         2030307: [2/3] PIC16: fix failing rotate.c tests for 32-bit var (1),
+         2030310: [3/3] PIC16: fix failing rotate.c tests for 32-bit var (2),
+         thanks Mauro Giachero
+
 2008-07-13 Philipp Klaus Krause <pkk AT spth.de>
        * src/port.h: Fixed typo in comment
 
index 7c4b705851c692f27296efa0feef0b8f12eb5add..062810bca1186837a7f9021d31aa966b27fd1d80 100644 (file)
@@ -9,6 +9,7 @@
              -  Vangelis Rokas <vrokas AT users.sourceforge.net> (2003-2006)
   Bug Fixes  -  Raphael Neider <rneider AT web.de> (2004,2005)
   Bug Fixes  -  Borut Razem <borut.razem AT siol.net> (2007)
+  Bug Fixes  -  Mauro Giachero <maurogiachero AT users.sourceforge.net> (2008)
 
   This program is free software; you can redistribute it and/or modify it
   under the terms of the GNU General Public License as published by the
@@ -6376,7 +6377,7 @@ static void genInline (iCode *ic)
 static void genRRC (iCode *ic)
 {
   operand *left , *result ;
-  int size, offset = 0, same;
+  int size, same;
 
   DEBUGpic16_emitcode ("; ***","%s  %d",__FUNCTION__,__LINE__);
 
@@ -6395,20 +6396,16 @@ static void genRRC (iCode *ic)
   DEBUGpic16_emitcode ("; ***","%s  %d size:%d same:%d",__FUNCTION__,__LINE__,size,same);
 
   /* get the lsb and put it into the carry */
-  pic16_emitpcode(POC_RRCFW, pic16_popGet(AOP(left),size-1));
-
-  offset = 0 ;
+  pic16_emitpcode(POC_RRCFW, pic16_popGet(AOP(left),0));
 
   while(size--) {
 
     if(same) {
-      pic16_emitpcode(POC_RRCF, pic16_popGet(AOP(left),offset));
+      pic16_emitpcode(POC_RRCF, pic16_popGet(AOP(left),size));
     } else {
-      pic16_emitpcode(POC_RRCFW, pic16_popGet(AOP(left),offset));
-      pic16_emitpcode(POC_MOVWF, pic16_popGet(AOP(result),offset));
+      pic16_emitpcode(POC_RRCFW, pic16_popGet(AOP(left),size));
+      pic16_emitpcode(POC_MOVWF, pic16_popGet(AOP(result),size));
     }
-
-    offset++;
   }
 
   pic16_freeAsmop(left,NULL,ic,TRUE);
@@ -7004,19 +7001,18 @@ static void shiftL2Left2Result (operand *left, int offl,
       }
       break;
     case 6:
-      pic16_emitpcode(POC_RRCFW, pic16_popGet(AOP(left),offl+MSB16));
-      pic16_emitpcode(POC_MOVWF,pic16_popGet(AOP(result),offr+MSB16));
-      pic16_emitpcode(POC_RRCFW, pic16_popGet(AOP(result),offl));
+      pic16_emitpcode(POC_RRNCFW, pic16_popGet(AOP(left),offl));
       pic16_emitpcode(POC_MOVWF,  pic16_popGet(AOP(result),offr));
-
-      pic16_emitpcode(POC_RRCF,  pic16_popGet(AOP(result),offr+MSB16));
-      pic16_emitpcode(POC_RRCF,  pic16_popGet(AOP(result),offr));
-      pic16_emitpcode(POC_RRCFW, pic16_popGet(AOP(result),offr+MSB16));
-      pic16_emitpcode(POC_ANDLW,pic16_popGetLit(0xc0));
-      pic16_emitpcode(POC_XORFW,pic16_popGet(AOP(result),offr));
-      pic16_emitpcode(POC_XORWF,pic16_popGet(AOP(result),offr));
-      pic16_emitpcode(POC_XORFW,pic16_popGet(AOP(result),offr));
-      pic16_emitpcode(POC_MOVWF,pic16_popGet(AOP(result),offr+MSB16));
+      pic16_emitpcode(POC_RRNCF,  pic16_popGet(AOP(result),offr));
+      pic16_emitpcode(POC_RRNCFW, pic16_popGet(AOP(left),offl+MSB16));
+      pic16_emitpcode(POC_MOVWF,  pic16_popGet(AOP(result),offr+MSB16));
+      pic16_emitpcode(POC_RRNCF,  pic16_popGet(AOP(result),offr+MSB16));
+      pic16_emitpcode(POC_MOVLW,  pic16_popGetLit(0xc0));
+      pic16_emitpcode(POC_ANDWF,  pic16_popGet(AOP(result),offr+MSB16));
+      pic16_emitpcode(POC_ANDFW,  pic16_popGet(AOP(result),offr));
+      pic16_emitpcode(POC_XORFW,  pic16_popGet(AOP(result),offr));
+      pic16_emitpcode(POC_IORWF,  pic16_popGet(AOP(result),offr+MSB16));
+      pic16_emitpcode(POC_XORWF,  pic16_popGet(AOP(result),offr));
       break;
     case 7:
       pic16_emitpcode(POC_RRCFW, pic16_popGet(AOP(left),offl+MSB16));
@@ -7265,7 +7261,7 @@ static void shiftLLong (operand *left, operand *result, int offr )
                         pic16_emitpcode(POC_MOVWF,pic16_popGet(AOP(left),i));
                 }
         } else {
-                pic16_emitpcode(POC_MOVFW,pic16_popGet(AOP(left),LSB+offr));
+                pic16_emitpcode(POC_MOVFW,pic16_popGet(AOP(left),LSB));
         }
 
     if (size > LSB+offr ){