From 061061e77c255202d01087e72fc3c370d2e21bdb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?R=C3=A9my=20Oudompheng?= Date: Fri, 13 Apr 2012 10:12:31 +0200 Subject: [PATCH] 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 --- src/cmd/6g/ggen.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/cmd/6g/ggen.c b/src/cmd/6g/ggen.c index 02e67d6d41..434ee32e35 100644 --- a/src/cmd/6g/ggen.c +++ b/src/cmd/6g/ggen.c @@ -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;