]> git.gag.com Git - fw/sdcc/commitdiff
(genMultOneByte): help peephole 105
authorfrief <frief@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 28 Nov 2003 21:54:44 +0000 (21:54 +0000)
committerfrief <frief@4a8a32a2-be11-0410-ad9d-d568d2c75423>
Fri, 28 Nov 2003 21:54:44 +0000 (21:54 +0000)
git-svn-id: https://sdcc.svn.sourceforge.net/svnroot/sdcc/trunk/sdcc@3035 4a8a32a2-be11-0410-ad9d-d568d2c75423

src/mcs51/gen.c

index 8cad6c3c944a2d1f174a4d24c10f20baea1963f2..83790a8528820978ebda6fd0b5fc6b4101a3a0fc 100644 (file)
@@ -3642,8 +3642,16 @@ genMultOneByte (operand * left,
     // just an unsigned 8*8=8/16 multiply
     //emitcode (";","unsigned");
     // TODO: check for accumulator clash between left & right aops?
-    emitcode ("mov", "b,%s", aopGet (AOP (right), 0, FALSE, FALSE));
-    MOVA (aopGet (AOP (left), 0, FALSE, FALSE));
+  
+    if( AOP_TYPE(right)==AOP_LIT ){
+      // moving to accumulator first helps peepholes 
+      MOVA (aopGet (AOP (left), 0, FALSE, FALSE));
+      emitcode ("mov", "b,%s", aopGet (AOP (right), 0, FALSE, FALSE));
+    } else {
+      emitcode ("mov", "b,%s", aopGet (AOP (right), 0, FALSE, FALSE));
+      MOVA (aopGet (AOP (left), 0, FALSE, FALSE));
+    }
+    
     emitcode ("mul", "ab");
     aopPut (AOP (result), "a", 0, isOperandVolatile (result, FALSE));
     if (size==2) {