1
0
mirror of https://github.com/golang/go synced 2024-11-19 23:44:43 -07:00

cmd/6g: restore magic multiply for /=, %=.

Also enables turning /= 2 in a right shift.

Part of issue 2230.

R=rsc
CC=golang-dev, remy
https://golang.org/cl/6012049
This commit is contained in:
Rémy Oudompheng 2012-04-13 10:12:31 +02:00
parent 08f919f462
commit 061061e77c

View File

@ -389,7 +389,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;