1
0
mirror of https://github.com/golang/go synced 2024-11-20 03:24:41 -07:00

cmd/5g: improve shift code generation

This CL is a backport of 6012049 which improves code
generation for shift operations.

benchmark       old ns/op    new ns/op    delta
BenchmarkLSL            9            5  -49.67%
BenchmarkLSR            9            4  -50.00%

R=golang-dev, minux.ma, r, rsc
CC=golang-dev
https://golang.org/cl/6813045
This commit is contained in:
Dave Cheney 2012-11-04 20:06:37 +11:00
parent a906f9aa86
commit d8008a9eef

View File

@ -407,7 +407,9 @@ cgen_asop(Node *n)
hard:
n2.op = 0;
n1.op = 0;
if(nr->ullman >= nl->ullman || nl->addable) {
if(nr->op == OLITERAL) {
// don't allocate a register for literals.
} else if(nr->ullman >= nl->ullman || nl->addable) {
regalloc(&n2, nr->type, N);
cgen(nr, &n2);
nr = &n2;