]> Cypherpunks repositories - gostls13.git/commitdiff
fixed unary ^ opcode (bug082)
authorKen Thompson <ken@golang.org>
Sun, 10 Aug 2008 21:35:02 +0000 (14:35 -0700)
committerKen Thompson <ken@golang.org>
Sun, 10 Aug 2008 21:35:02 +0000 (14:35 -0700)
R=r
DELTA=11  (10 added, 1 deleted, 0 changed)
OCL=14047
CL=14047

src/cmd/6g/cgen.c

index 7b054dfb3f543a3bc7dcf7a9d13756411e85d9e7..bbd904d499300c4be0f02e59b8f26003074e0f82 100644 (file)
@@ -101,8 +101,17 @@ cgen(Node *n, Node *res)
                goto ret;
 
        // unary
-       case OMINUS:
        case OCOM:
+               a = optoas(OXOR, nl->type);
+               regalloc(&n1, nl->type, N);
+               cgen(nl, &n1);
+               nodconst(&n2, nl->type, -1);
+               gins(a, &n2, &n1);
+               gmove(&n1, res);
+               regfree(&n1);
+               goto ret;
+
+       case OMINUS:
                a = optoas(n->op, nl->type);
                goto uop;