Commit 7f620a57 authored by Russ Cox's avatar Russ Cox

cmd/asm: add x86 POPCNTW, POPCNTL

Fixes #4816.

Change-Id: Ibeaa69f57b7519d56df4ea357edf8d9dc2102ffe
Reviewed-on: https://go-review.googlesource.com/18851Reviewed-by: default avatarRob Pike <r@golang.org>
Run-TryBot: Russ Cox <rsc@golang.org>
TryBot-Result: Gobot Gobot <gobot@golang.org>
parent 659c6328
...@@ -4145,22 +4145,22 @@ TEXT asmtest(SB),7,$0 ...@@ -4145,22 +4145,22 @@ TEXT asmtest(SB),7,$0
POPQ DX // 8fc2 or 5a POPQ DX // 8fc2 or 5a
PUSHQ AX PUSHQ AX
POPQ R11 // 418fc3 or 415b POPQ R11 // 418fc3 or 415b
//TODO: POPCNTW (BX), DX // 66f30fb813 POPCNTW (BX), DX // 66f30fb813
//TODO: POPCNTW (R11), DX // 66f3410fb813 POPCNTW (R11), DX // 66f3410fb813
//TODO: POPCNTW DX, DX // 66f30fb8d2 POPCNTW DX, DX // 66f30fb8d2
//TODO: POPCNTW R11, DX // 66f3410fb8d3 POPCNTW R11, DX // 66f3410fb8d3
//TODO: POPCNTW (BX), R11 // 66f3440fb81b POPCNTW (BX), R11 // 66f3440fb81b
//TODO: POPCNTW (R11), R11 // 66f3450fb81b POPCNTW (R11), R11 // 66f3450fb81b
//TODO: POPCNTW DX, R11 // 66f3440fb8da POPCNTW DX, R11 // 66f3440fb8da
//TODO: POPCNTW R11, R11 // 66f3450fb8db POPCNTW R11, R11 // 66f3450fb8db
//TODO: POPCNTL (BX), DX // f30fb813 POPCNTL (BX), DX // f30fb813
//TODO: POPCNTL (R11), DX // f3410fb813 POPCNTL (R11), DX // f3410fb813
//TODO: POPCNTL DX, DX // f30fb8d2 POPCNTL DX, DX // f30fb8d2
//TODO: POPCNTL R11, DX // f3410fb8d3 POPCNTL R11, DX // f3410fb8d3
//TODO: POPCNTL (BX), R11 // f3440fb81b POPCNTL (BX), R11 // f3440fb81b
//TODO: POPCNTL (R11), R11 // f3450fb81b POPCNTL (R11), R11 // f3450fb81b
//TODO: POPCNTL DX, R11 // f3440fb8da POPCNTL DX, R11 // f3440fb8da
//TODO: POPCNTL R11, R11 // f3450fb8db POPCNTL R11, R11 // f3450fb8db
POPCNTQ (BX), DX // f3480fb813 POPCNTQ (BX), DX // f3480fb813
POPCNTQ (R11), DX // f3490fb813 POPCNTQ (R11), DX // f3490fb813
POPCNTQ DX, DX // f3480fb8d2 POPCNTQ DX, DX // f3480fb8d2
......
...@@ -219,6 +219,7 @@ const ( ...@@ -219,6 +219,7 @@ const (
Pb = 0xfe /* byte operands */ Pb = 0xfe /* byte operands */
Pf2 = 0xf2 /* xmm escape 1: f2 0f */ Pf2 = 0xf2 /* xmm escape 1: f2 0f */
Pf3 = 0xf3 /* xmm escape 2: f3 0f */ Pf3 = 0xf3 /* xmm escape 2: f3 0f */
Pef3 = 0xf5 /* xmm escape 2 with 16-bit prefix: 66 f3 0f */
Pq3 = 0x67 /* xmm escape 3: 66 48 0f */ Pq3 = 0x67 /* xmm escape 3: 66 48 0f */
Pfw = 0xf4 /* Pf3 with Rex.w: f3 48 0f */ Pfw = 0xf4 /* Pf3 with Rex.w: f3 48 0f */
Pvex1 = 0xc5 /* 66.0f escape, vex encoding */ Pvex1 = 0xc5 /* 66.0f escape, vex encoding */
...@@ -1208,6 +1209,8 @@ var optab = ...@@ -1208,6 +1209,8 @@ var optab =
{APMULULQ, ymm, Py1, [23]uint8{0xf4, Pe, 0xf4}}, {APMULULQ, ymm, Py1, [23]uint8{0xf4, Pe, 0xf4}},
{APOPAL, ynone, P32, [23]uint8{0x61}}, {APOPAL, ynone, P32, [23]uint8{0x61}},
{APOPAW, ynone, Pe, [23]uint8{0x61}}, {APOPAW, ynone, Pe, [23]uint8{0x61}},
{APOPCNTW, yml_rl, Pef3, [23]uint8{0xb8}},
{APOPCNTL, yml_rl, Pf3, [23]uint8{0xb8}},
{APOPCNTQ, yml_rl, Pfw, [23]uint8{0xb8}}, {APOPCNTQ, yml_rl, Pfw, [23]uint8{0xb8}},
{APOPFL, ynone, P32, [23]uint8{0x9d}}, {APOPFL, ynone, P32, [23]uint8{0x9d}},
{APOPFQ, ynone, Py, [23]uint8{0x9d}}, {APOPFQ, ynone, Py, [23]uint8{0x9d}},
...@@ -3204,6 +3207,14 @@ func doasm(ctxt *obj.Link, p *obj.Prog) { ...@@ -3204,6 +3207,14 @@ func doasm(ctxt *obj.Link, p *obj.Prog) {
ctxt.Andptr[0] = Pm ctxt.Andptr[0] = Pm
ctxt.Andptr = ctxt.Andptr[1:] ctxt.Andptr = ctxt.Andptr[1:]
case Pef3:
ctxt.Andptr[0] = Pe
ctxt.Andptr = ctxt.Andptr[1:]
ctxt.Andptr[0] = Pf3
ctxt.Andptr = ctxt.Andptr[1:]
ctxt.Andptr[0] = Pm
ctxt.Andptr = ctxt.Andptr[1:]
case Pfw: /* xmm opcode escape + REX.W */ case Pfw: /* xmm opcode escape + REX.W */
ctxt.Rexflag |= Pw ctxt.Rexflag |= Pw
ctxt.Andptr[0] = Pf3 ctxt.Andptr[0] = Pf3
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment