Commit 79f5697b authored by Ken Thompson's avatar Ken Thompson

byte multiply

R=r
OCL=18830
CL=18830
parent dc78c64f
......@@ -1098,30 +1098,42 @@ ret:
void
cgen_bmul(int op, Node *nl, Node *nr, Node *res)
{
Node n1, n2;
Node n1, n2, n3;
Type *t;
int a;
t = types[TUINT16];
if(issigned[nl->type->etype])
t = types[TINT16];
if(nl->ullman >= nr->ullman) {
regalloc(&n1, t, nl);
regalloc(&n1, nl->type, res);
cgen(nl, &n1);
regalloc(&n2, t, nr);
regalloc(&n2, nr->type, N);
cgen(nr, &n2);
} else {
regalloc(&n2, t, nr);
regalloc(&n2, nr->type, N);
cgen(nr, &n2);
regalloc(&n1, t, nl);
regalloc(&n1, nl->type, res);
cgen(nl, &n1);
}
// copy to short registers
t = types[TUINT16];
if(issigned[nl->type->etype])
t = types[TINT16];
regalloc(&n3, t, &n2);
cgen(&n2, &n3);
regfree(&n3);
regalloc(&n3, t, &n1);
cgen(&n1, &n3);
a = optoas(op, t);
gins(a, &n2, &n1);
gmove(&n1, res);
cgen(&n3, &n1);
cgen(&n1, res);
regfree(&n1);
regfree(&n2);
regfree(&n3);
}
void
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment