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
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;