Commit d8008a9e authored by Dave Cheney's avatar Dave Cheney

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
parent a906f9aa
...@@ -407,7 +407,9 @@ cgen_asop(Node *n) ...@@ -407,7 +407,9 @@ cgen_asop(Node *n)
hard: hard:
n2.op = 0; n2.op = 0;
n1.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); regalloc(&n2, nr->type, N);
cgen(nr, &n2); cgen(nr, &n2);
nr = &n2; nr = &n2;
......
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