]> Cypherpunks repositories - gostls13.git/commitdiff
fix broken code produced for ominus
authorKai Backman <kaib@golang.org>
Fri, 23 Oct 2009 17:58:29 +0000 (10:58 -0700)
committerKai Backman <kaib@golang.org>
Fri, 23 Oct 2009 17:58:29 +0000 (10:58 -0700)
go/test: passes 89% (308/345)

R=rsc
APPROVED=rsc
DELTA=10  (5 added, 0 deleted, 5 changed)
OCL=36005
CL=36021

src/cmd/5g/cgen.c

index bba552f333e506364995c31d6c24ad6c0ddc793d..347a530f008de3401a6adb17bd25ab44648d40e8 100644 (file)
@@ -222,11 +222,16 @@ cgen(Node *n, Node *res)
                goto ret;
 
        case OMINUS:
-               nr = nl;
-               nl = &n1;
-               nodconst(nl, nr->type, 0);
-               a = optoas(OSUB, nr->type);
-               goto abop;
+               nodconst(&n3, nl->type, 0);
+               regalloc(&n2, nl->type, res);
+               regalloc(&n1, nl->type, N);
+               gmove(&n3, &n2);
+               cgen(nl, &n1);
+               gins(optoas(OSUB, nl->type), &n1, &n2);
+               gmove(&n2, res);
+               regfree(&n1);
+               regfree(&n2);
+               goto ret;
 
        // symmetric binary
        case OAND: