shithub: mc

Download patch

ref: 258ebf372f0e64f10b42dbc537417a33b2bad60d
parent: e38fc0611c203ddddb93adcf372e296de157130f
author: Ori Bernstein <[email protected]>
date: Wed Jun 6 21:25:17 EDT 2012

Use the correct mode for mul/div.

--- a/8/isel.c
+++ b/8/isel.c
@@ -530,7 +530,8 @@
             a = selexpr(s, args[0]);
             b = selexpr(s, args[1]);
             b = inr(s, b);
-            g(s, Imov, &a, &eax, NULL);
+            c = coreg(eax, mode(n));
+            g(s, Imov, &a, &c, NULL);
             g(s, Imul, &b, NULL);
             freereg(s, Redx);
             r = eax;
@@ -543,8 +544,9 @@
             a = selexpr(s, args[0]);
             b = selexpr(s, args[1]);
             b = inr(s, b);
+            c = coreg(eax, mode(n));
             g(s, Ixor, &edx, &edx, NULL);
-            g(s, Imov, &a, &eax, NULL);
+            g(s, Imov, &a, &c, NULL);
             g(s, Idiv, &b, NULL);
             freereg(s, Redx);
             if (exprop(n) == Odiv)