]> Cypherpunks repositories - gostls13.git/commitdiff
shift bug
authorKen Thompson <ken@golang.org>
Thu, 30 Oct 2008 21:32:04 +0000 (14:32 -0700)
committerKen Thompson <ken@golang.org>
Thu, 30 Oct 2008 21:32:04 +0000 (14:32 -0700)
R=r
OCL=18166
CL=18166

src/cmd/6g/gen.c

index 39c9d6f38b1b7fe142e06a9b7f7e189cb1fed657..f4a15f2f208b8ad048ff2defe8eb0bef3c0b4655 100644 (file)
@@ -1047,13 +1047,16 @@ cgen_shift(int op, Node *nl, Node *nr, Node *res)
        regalloc(&n1, nr->type, &n1);
 
        // clean out the CL register
-       if(rcl && !samereg(res, &n1)) {
+       if(rcl) {
                regalloc(&n2, types[TINT64], N);
                gins(AMOVQ, &n1, &n2);
                regfree(&n1);
 
                reg[D_CX] = 0;
-               cgen_shift(op, nl, nr, res);
+               if(samereg(res, &n1))
+                       cgen_shift(op, nl, nr, &n2);
+               else
+                       cgen_shift(op, nl, nr, res);
                reg[D_CX] = rcl;
 
                gins(AMOVQ, &n2, &n1);