LEFT | RIGHT |
1 // Copyright 2009 The Go Authors. All rights reserved. | 1 // Copyright 2009 The Go Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style | 2 // Use of this source code is governed by a BSD-style |
3 // license that can be found in the LICENSE file. | 3 // license that can be found in the LICENSE file. |
4 | 4 |
5 #include <u.h> | 5 #include <u.h> |
6 #include <libc.h> | 6 #include <libc.h> |
7 #include "gg.h" | 7 #include "gg.h" |
8 | 8 |
9 /* | 9 /* |
10 * generate: | 10 * generate: |
(...skipping 1438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1449 } else { | 1449 } else { |
1450 // normal direction | 1450 // normal direction |
1451 if(q > 128) { | 1451 if(q > 128) { |
1452 gconreg(movptr, q, D_CX); | 1452 gconreg(movptr, q, D_CX); |
1453 gins(AREP, N, N); // repeat | 1453 gins(AREP, N, N); // repeat |
1454 gins(AMOVSQ, N, N); // MOVQ *(SI)+,*(DI)+ | 1454 gins(AMOVSQ, N, N); // MOVQ *(SI)+,*(DI)+ |
1455 } else if (q >= 4) { | 1455 } else if (q >= 4) { |
1456 p = gins(ADUFFCOPY, N, N); | 1456 p = gins(ADUFFCOPY, N, N); |
1457 p->to.type = D_ADDR; | 1457 p->to.type = D_ADDR; |
1458 p->to.sym = linksym(pkglookup("duffcopy", runtimepkg)); | 1458 p->to.sym = linksym(pkglookup("duffcopy", runtimepkg)); |
1459 » » » // 14 = magic constant: see ../../pkg/runtime/asm_amd64.
s | 1459 » » » // 14 and 128 = magic constants: see ../../pkg/runtime/a
sm_amd64.s |
1460 p->to.offset = 14*(128-q); | 1460 p->to.offset = 14*(128-q); |
1461 } else | 1461 } else |
1462 while(q > 0) { | 1462 while(q > 0) { |
1463 gins(AMOVSQ, N, N); // MOVQ *(SI)+,*(DI)+ | 1463 gins(AMOVSQ, N, N); // MOVQ *(SI)+,*(DI)+ |
1464 q--; | 1464 q--; |
1465 } | 1465 } |
1466 // copy the remaining c bytes | 1466 // copy the remaining c bytes |
1467 if(w < 4 || c <= 1 || (odst < osrc && osrc < odst+w)) { | 1467 if(w < 4 || c <= 1 || (odst < osrc && osrc < odst+w)) { |
1468 while(c > 0) { | 1468 while(c > 0) { |
1469 gins(AMOVSB, N, N); // MOVB *(SI)+,*(DI)+ | 1469 gins(AMOVSB, N, N); // MOVB *(SI)+,*(DI)+ |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1721 regfree(&nodl); | 1721 regfree(&nodl); |
1722 return 0; | 1722 return 0; |
1723 | 1723 |
1724 yes: | 1724 yes: |
1725 if(freer) | 1725 if(freer) |
1726 regfree(&nodr); | 1726 regfree(&nodr); |
1727 if(freel) | 1727 if(freel) |
1728 regfree(&nodl); | 1728 regfree(&nodl); |
1729 return 1; | 1729 return 1; |
1730 } | 1730 } |
LEFT | RIGHT |