]> git.gag.com Git - fw/sdcc/commitdiff
* src/mcs51/peeph.def: renamed rule 257 to 257.a, added 257.b
authorMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 27 Sep 2006 12:01:50 +0000 (12:01 +0000)
committerMaartenBrock <MaartenBrock@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Wed, 27 Sep 2006 12:01:50 +0000 (12:01 +0000)
* src/SDCCicode.c(geniCodeMultiply): small optimization

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

ChangeLog
src/SDCCicode.c
src/mcs51/peeph.def

index be3c04495f666fb0e8119891c9c90f9edef5f6bc..a3c0ca41a532eceea2e8cc31da85567a9cf5b3d2 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -2,6 +2,8 @@
 
        * device/include/mcs51/at89c51snd1c.h: fixed MSK_SREQ definition
          thanks Weston T. Schmidt for patch 1555221
+       * src/mcs51/peeph.def: renamed rule 257 to 257.a, added 257.b
+       * src/SDCCicode.c(geniCodeMultiply): small optimization
 
 2006-09-26 Maarten Brock <sourceforge.brock AT dse.nl>
 
index 4eeeab56a121f9dc2b255107bb942a74300313e4..1d4da0dfc53b3656b64b26e96c457c0412414310 100644 (file)
@@ -2130,11 +2130,19 @@ geniCodeMultiply (operand * left, operand * right, RESULT_TYPE resultType)
     }
   else
     {
-      ic = newiCode ('*', left, right);         /* normal multiplication */
       /* if the size left or right > 1 then support routine */
       if (getSize (ltype) > 1 || getSize (rtype) > 1)
-        ic->supportRtn = 1;
-
+        {
+          if (IS_LITERAL (retype))
+            ic = newiCode ('*', right, left); /* multiplication by support routine with one literal */
+          else
+            ic = newiCode ('*', left, right); /* multiplication by support routine */
+          ic->supportRtn = 1;
+        }
+      else
+        {
+          ic = newiCode ('*', left, right);   /* normal multiplication */
+        }
     }
   IC_RESULT (ic) = newiTempOperand (resType, 1);
 
index 96db036d26177b4da9572f2964faf8db7d7dee3e..8c8f01c848e389d5a35490a78c53607d36c10694 100644 (file)
@@ -3830,14 +3830,25 @@ replace {
 
 
 // unsigned char i=8; do{ } while(--i != 0);
-// this currently only applies if i is kept in a register
+// this applies if i is kept in a register
 replace {
        dec     %1
        cjne    %1,#0x00,%2
 } by {
-       ;       Peephole 257    optimized decrement with compare
+       ;       Peephole 257.a  optimized decrement with compare
        djnz    %1,%2
-} if notVolatile %1
+} if notVolatile(%1)
+
+// unsigned char i=8; do{ } while(--i != 0);
+// this applies if i is kept in data memory
+replace {
+       dec     %1
+       mov     a,%1
+       jnz     %2
+} by {
+       ;       Peephole 257.b  optimized decrement with compare
+       djnz    %1,%2
+} if notVolatile(%1), operandsNotRelated(%1 '@r0' '@r1')
 
 
 // in_byte<<=1; if(in_bit) in_byte|=1;