]> Cypherpunks repositories - gostls13.git/commitdiff
liblink: shorter encoding for zeroing register
authorRui Ueyama <ruiu@google.com>
Wed, 6 Aug 2014 04:10:07 +0000 (21:10 -0700)
committerRui Ueyama <ruiu@google.com>
Wed, 6 Aug 2014 04:10:07 +0000 (21:10 -0700)
Encode MOV $0, %ax as XOR %eax, %eax instead of
XOR %rax, %rax. If an operand register does not
need REX.w bit (i.e. not one of R8-R15), it is
encoded in 2 bytes instead of 3 bytes.

LGTM=rsc
R=golang-codereviews, gobot, rsc
CC=golang-codereviews
https://golang.org/cl/115580044

src/liblink/asm6.c

index 454b30239a513f639e4aa3c9d964a70794e32e18..3fc3e01286fb4f90fb83fb1e12d5ed9d5c5f2371 100644 (file)
@@ -3066,6 +3066,7 @@ found:
                break;
 
        case Zclr:
+               ctxt->rexflag &= ~Pw;
                *ctxt->andptr++ = op;
                asmand(ctxt, &p->to, &p->to);
                break;