From 24db88168997d650e8274dd2e84e8a56bf8d95b9 Mon Sep 17 00:00:00 2001 From: Rui Ueyama Date: Tue, 5 Aug 2014 21:10:07 -0700 Subject: [PATCH] liblink: shorter encoding for zeroing register 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 | 1 + 1 file changed, 1 insertion(+) diff --git a/src/liblink/asm6.c b/src/liblink/asm6.c index 454b30239a..3fc3e01286 100644 --- a/src/liblink/asm6.c +++ b/src/liblink/asm6.c @@ -3066,6 +3066,7 @@ found: break; case Zclr: + ctxt->rexflag &= ~Pw; *ctxt->andptr++ = op; asmand(ctxt, &p->to, &p->to); break;