Commit 061061e7 authored by Rémy Oudompheng's avatar Rémy Oudompheng

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
parent 08f919f4
...@@ -389,7 +389,9 @@ cgen_asop(Node *n) ...@@ -389,7 +389,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