]> Cypherpunks repositories - gostls13.git/commitdiff
use register intermediate
authorKai Backman <kaib@golang.org>
Tue, 15 Sep 2009 23:12:47 +0000 (16:12 -0700)
committerKai Backman <kaib@golang.org>
Tue, 15 Sep 2009 23:12:47 +0000 (16:12 -0700)
R=rsc
APPROVED=rsc
DELTA=21  (7 added, 5 deleted, 9 changed)
OCL=34607
CL=34663

src/cmd/5g/cgen.c
src/cmd/5g/gsubr.c

index d9876adf98cc7753bdc81bfe237e727792c39053..0efeb5122161753828e67ec991259e0334e5b2d5 100644 (file)
@@ -697,11 +697,18 @@ bgen(Node *n, int true, Prog *to)
                if(n->addable == 0)
                        goto def;
                nodconst(&n1, n->type, 0);
-               gins(optoas(OCMP, n->type), n, &n1);
+               regalloc(&n2, n->type, N);
+               regalloc(&n3, n->type, N);
+               cgen(&n1, &n2);
+               cgen(n, &n3);
+               p1 = gins(optoas(OCMP, n->type), &n2, N);
+               p1->reg = n3.val.u.reg;
                a = ABNE;
                if(!true)
                        a = ABEQ;
                patch(gbranch(a, n->type), to);
+               regfree(&n2);
+               regfree(&n3);
                goto ret;
 
        case OANDAND:
index cfd21fcc9d6aa638c0f8106ea643d5cd8bda3914..4458256252362e5f68961524781e4f2e617f3a0e 100644 (file)
@@ -633,19 +633,14 @@ gmove(Node *f, Node *t)
        case CASE(TUINT64, TUINT64):
                split64(f, &flo, &fhi);
                split64(t, &tlo, &thi);
-               if(f->op == OLITERAL) {
-                       gins(AMOVW, &flo, &tlo);
-                       gins(AMOVW, &fhi, &thi);
-               } else {
-                       regalloc(&r1, flo.type, N);
-                       regalloc(&r2, fhi.type, N);
-                       gins(AMOVW, &flo, &r1);
-                       gins(AMOVW, &fhi, &r2);
-                       gins(AMOVW, &r1, &tlo);
-                       gins(AMOVW, &r2, &thi);
-                       regfree(&r1);
-                       regfree(&r2);
-               }
+               regalloc(&r1, flo.type, N);
+               regalloc(&r2, fhi.type, N);
+               gins(AMOVW, &flo, &r1);
+               gins(AMOVW, &fhi, &r2);
+               gins(AMOVW, &r1, &tlo);
+               gins(AMOVW, &r2, &thi);
+               regfree(&r1);
+               regfree(&r2);
                splitclean();
                splitclean();
                return;