2001-10-21 Michael Hope <michaelh@juju.net.nz>
[fw/sdcc] / src / SDCCopt.c
index 1fd2e6cb408cea90fc46989949c547e84dfad4c4..9d39029259c7eb62a2078041f0725e51c376e474 100644 (file)
@@ -464,10 +464,21 @@ convertToFcall (eBBlock ** ebbs, int count)
          /* if long / int mult or divide or mod */
          if (ic->op == '*' || ic->op == '/' || ic->op == '%')
            {
-             sym_link *type = operandType (IC_LEFT (ic));
-             if (IS_INTEGRAL (type) && getSize (type) > port->support.muldiv)
+             sym_link *leftType = operandType (IC_LEFT (ic));
+
+             if (IS_INTEGRAL (leftType) && getSize (leftType) > port->support.muldiv)
                 {
-                  convilong (ic, ebbs[i], type, ic->op);
+                  sym_link *rightType = operandType (IC_RIGHT (ic));
+
+                  if (port->hasNativeMulFor != NULL &&
+                      port->hasNativeMulFor (ic, leftType, rightType))
+                    {
+                      /* Leave as native */
+                    }
+                  else
+                    {
+                      convilong (ic, ebbs[i], leftType, ic->op);
+                    }
                 }
            }