From: Russ Cox Date: Fri, 22 Jan 2016 20:50:01 +0000 (-0500) Subject: cmd/internal/obj/x86: fix doubled REX byte in POPCNT, others X-Git-Tag: go1.6rc1~62 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=d3ff40fb1f4daae5b7ef4c54909a35d57e1ca753;p=gostls13.git cmd/internal/obj/x86: fix doubled REX byte in POPCNT, others Tests for this and many other instructions are in a separate followup CL. For #14068. Change-Id: I6955315996a34d7fb79369b9d9a0119d11745e85 Reviewed-on: https://go-review.googlesource.com/18849 Reviewed-by: Rob Pike --- diff --git a/src/cmd/internal/obj/x86/asm6.go b/src/cmd/internal/obj/x86/asm6.go index 41386ef6e0..f67dfa9449 100644 --- a/src/cmd/internal/obj/x86/asm6.go +++ b/src/cmd/internal/obj/x86/asm6.go @@ -3189,12 +3189,10 @@ func doasm(ctxt *obj.Link, p *obj.Prog) { ctxt.Andptr[0] = Pm ctxt.Andptr = ctxt.Andptr[1:] - case Pq3: /* 16 bit escape, Rex.w, and opcode escape */ + case Pq3: /* 16 bit escape and opcode escape + REX.W */ + ctxt.Rexflag |= Pw ctxt.Andptr[0] = Pe ctxt.Andptr = ctxt.Andptr[1:] - - ctxt.Andptr[0] = Pw - ctxt.Andptr = ctxt.Andptr[1:] ctxt.Andptr[0] = Pm ctxt.Andptr = ctxt.Andptr[1:] @@ -3206,12 +3204,10 @@ func doasm(ctxt *obj.Link, p *obj.Prog) { ctxt.Andptr[0] = Pm ctxt.Andptr = ctxt.Andptr[1:] - case Pfw: /* first escape, Rex.w, and second escape */ + case Pfw: /* xmm opcode escape + REX.W */ + ctxt.Rexflag |= Pw ctxt.Andptr[0] = Pf3 ctxt.Andptr = ctxt.Andptr[1:] - - ctxt.Andptr[0] = Pw - ctxt.Andptr = ctxt.Andptr[1:] ctxt.Andptr[0] = Pm ctxt.Andptr = ctxt.Andptr[1:]