Commit 250ec166 authored by Ken Thompson's avatar Ken Thompson

unsigned divide by fn()

R=r
OCL=18351
CL=18351
parent 6b055185
......@@ -907,7 +907,7 @@ void
dodiv(int op, Node *nl, Node *nr, Node *res, Node *ax, Node *dx)
{
int a;
Node n3;
Node n3, n4;
Type *t;
t = nl->type;
......@@ -919,25 +919,25 @@ dodiv(int op, Node *nl, Node *nr, Node *res, Node *ax, Node *dx)
}
a = optoas(op, t);
if(!issigned[t->etype]) {
nodconst(&n3, t, 0);
gmove(&n3, dx);
}
regalloc(&n3, nr->type, N);
if(nl->ullman >= nr->ullman) {
cgen(nl, ax);
if(issigned[t->etype])
if(!issigned[t->etype]) {
nodconst(&n4, t, 0);
gmove(&n4, dx);
} else
gins(optoas(OFOR, t), N, N);
cgen(nr, &n3);
gins(a, &n3, N);
} else {
cgen(nr, &n3);
cgen(nl, ax);
if(issigned[t->etype])
if(!issigned[t->etype]) {
nodconst(&n4, t, 0);
gmove(&n4, dx);
} else
gins(optoas(OFOR, t), N, N);
gins(a, &n3, N);
}
gins(a, &n3, N);
regfree(&n3);
if(op == ODIV)
......
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