* src/mcs51/peeph.def: renamed rule 257 to 257.a, added 257.b
[fw/sdcc] / src / SDCCicode.c
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);