shithub: mc

Download patch

ref: 64968bcc3b6f03415aac19c8cdfff83c9e3f424e
parent: 781d516f7d1c081f2d90b9f94b30b3400f7abd5f
parent: c6fc10168fccc31d8986abfbb7cd87eba5cc4a50
author: Ori Bernstein <[email protected]>
date: Thu Dec 19 12:04:40 EST 2013

Merge branch 'master' of git+ssh://git.eigenstate.org/git/ori/mc

--- a/6/insns.def
+++ b/6/insns.def
@@ -32,6 +32,7 @@
 Insn(Iadd,      "\tadd%t %x,%r\n",              Use(.l={1,2}),                  Def(.l={2}))
 Insn(Isub,      "\tsub%t %x,%r\n",              Use(.l={1,2}),                  Def(.l={2}))
 Insn(Iimul,     "\timul%t %x,%r\n",             Use(.l={1,2}),                  Def(.l={2}))
+Insn(Iimul_r,   "\timul%t %r\n",                Use(.l={1},.r={Ral}),           Def(.r={Rax}))
 Insn(Imul,      "\tmul%t %r\n",                 Use(.l={1},.r={Reax}),          Def(.r={Reax,Redx}))
 Insn(Idiv,      "\tdiv%t %r\n",                 Use(.l={1},.r={Reax,Redx}),     Def(.r={Reax,Redx}))
 Insn(Ineg,      "\tneg%t %r\n",                 Use(.l={1}),                    Def(.l={1}))
--- a/6/isel.c
+++ b/6/isel.c
@@ -461,8 +461,18 @@
         case Omul:      
             if (floattype(exprtype(n)))
                 r = binop(s, Ifmul, args[0], args[1]);
-            else
+            else if (size(args[0]) == 1) {
+                a = selexpr(s, args[0]);
+                b = selexpr(s, args[1]);
+
+		c = locphysreg(Ral);
+                r = locreg(a->mode);
+                g(s, Imov, a, c, NULL);
+                g(s, Iimul_r, b, NULL);
+                g(s, Imov, c, r, NULL);
+	    } else {
                 r = binop(s, Iimul, args[0], args[1]);
+	    }
             break;
         case Odiv:
         case Omod:
--- a/parse/tok.c
+++ b/parse/tok.c
@@ -344,6 +344,8 @@
         len = 3;
     else if ((c & 0xf8) == 0xf0)
         len = 4;
+    else
+        fatal(line, "Invalid utf8 encoded character constant");
 
     val = c & ((1 << (8 - len)) - 1);
     append(buf, buflen, sz, c);
--- a/test/tests
+++ b/test/tests
@@ -22,6 +22,7 @@
 B splitline     E       3
 B add		E	53
 B mul		E	42
+B mul8		E	18
 B div		E	42
 B mod		E	6
 B bsr		E	5