diff options
author | cinap_lenrek <cinap_lenrek@felloff.net> | 2017-01-08 17:41:10 +0100 |
---|---|---|
committer | cinap_lenrek <cinap_lenrek@felloff.net> | 2017-01-08 17:41:10 +0100 |
commit | c67d0c699f7b52da534f75d3620776997b1e8d52 (patch) | |
tree | 0e0ccb907b812f2e4831dea1735f6554f0eeb621 /sys/src | |
parent | 28089ee035e8502ed03225c3850070c0c2882ae6 (diff) |
6c: reverse register allocation order to avoid having to spill AX,DX and CX
allocating AX,CX,DX last improves 64-bit multiplication-add
chains like a*b + c*d as the multiplication does not need to save
and restore AX and DX registers in most cases. reserving CX for
shifts also helps.
Diffstat (limited to 'sys/src')
-rw-r--r-- | sys/src/cmd/6c/txt.c | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/sys/src/cmd/6c/txt.c b/sys/src/cmd/6c/txt.c index 861cdfde4..82045c168 100644 --- a/sys/src/cmd/6c/txt.c +++ b/sys/src/cmd/6c/txt.c @@ -343,9 +343,12 @@ regalloc(Node *n, Node *tn, Node *o) if(i >= D_AX && i <= D_R15) goto out; } - for(i=D_AX; i<=D_R15; i++) + for(i=D_AX; i<=D_R15; i++){ + i ^= 7; if(reg[i] == 0 && !resvreg[i]) goto out; + i ^= 7; + } diag(tn, "out of fixed registers"); goto err; |