]> Cypherpunks repositories - gostls13.git/commitdiff
cmd/9g: note suboptimal copy code
authorAustin Clements <austin@google.com>
Fri, 30 Jan 2015 16:18:24 +0000 (11:18 -0500)
committerAustin Clements <austin@google.com>
Mon, 2 Feb 2015 19:32:42 +0000 (19:32 +0000)
9g generates needlessly complex code for small copies.  There are a
few other things that need to be improved about the copy code, so for
now just note the problem.

Change-Id: I0f1de4b2f9197a2635e27cc4b91ecf7a6c11f457
Reviewed-on: https://go-review.googlesource.com/3665
Reviewed-by: Russ Cox <rsc@golang.org>
src/cmd/9g/cgen.c

index d1f1976ce8eff508df2686ae4592cb63beed0e64..2d761335432141ec9ef6b20727cdc975ba054ad3 100644 (file)
@@ -1506,6 +1506,11 @@ sgen(Node *n, Node *ns, int64 w)
                patch(gbranch(ABNE, T, 0), ploop);
                regfree(&nend);
        } else {
+               // TODO(austin): Instead of generating ADD $-8,R8; ADD
+               // $-8,R7; n*(MOVDU 8(R8),R9; MOVDU R9,8(R7);) just
+               // generate the offsets directly and eliminate the
+               // ADDs.  That will produce shorter, more
+               // pipeline-able code.
                while(c-- > 0) {
                        p = gins(op, &src, &tmp);
                        p->from.type = TYPE_MEM;