6c: conserve registers for floating point operations
for floating point operations, reuse the return register on the right hand side if it has higher complex number than the left hand side to conserve registers. this makes the following code compile, that was previously run out of floating point register: float f(float r[15]) { return (r[0] + (r[1] * (r[2] + r[3] * (r[4] + r[5] * (r[6] + r[7] * (r[8] + r[9] * (r[10] + r[11] * (r[12] + r[13] * r[14])))))))); } the downside is that this produces extra move operations.
This commit is contained in:
parent
380adf8b48
commit
e6634fbd0c
1 changed files with 2 additions and 2 deletions
|
@ -824,9 +824,9 @@ cgen(Node *n, Node *nn)
|
||||||
gopcode(o, n->type, r, &nod);
|
gopcode(o, n->type, r, &nod);
|
||||||
} else {
|
} else {
|
||||||
/* TO DO: could do better with r->addable >= INDEXED */
|
/* TO DO: could do better with r->addable >= INDEXED */
|
||||||
regalloc(&nod1, r, Z);
|
regalloc(&nod1, r, nn);
|
||||||
cgen(r, &nod1);
|
cgen(r, &nod1);
|
||||||
regalloc(&nod, l, nn);
|
regalloc(&nod, l, Z);
|
||||||
cgen(l, &nod);
|
cgen(l, &nod);
|
||||||
gopcode(o, n->type, &nod1, &nod);
|
gopcode(o, n->type, &nod1, &nod);
|
||||||
regfree(&nod1);
|
regfree(&nod1);
|
||||||
|
|
Loading…
Reference in a new issue