all: VBMI2 instructions (#363)
Adds the "Vector Bit Manipulation Instructions 2" instruction set. These new instructions are added via the `opcodesextra` mechanism #345, since they're missing from the opcodes database. Contributed by @vsivsi. Extracted from #349 with simplifications. Specifically, as prompted by the `dupl` linter we extract some common forms lists into a helper `forms.go` file. Co-authored-by: Vaughn Iverson <vsivsi@yahoo.com>
This commit is contained in:
committed by
GitHub
parent
05ed388d0f
commit
e2c0a40f50
@@ -1,7 +1,11 @@
|
||||
// Package opcodesextra provides curated extensions to the instruction database.
|
||||
package opcodesextra
|
||||
|
||||
import "github.com/mmcloughlin/avo/internal/inst"
|
||||
import (
|
||||
"sort"
|
||||
|
||||
"github.com/mmcloughlin/avo/internal/inst"
|
||||
)
|
||||
|
||||
// sets of extra instructions.
|
||||
var sets = [][]*inst.Instruction{
|
||||
@@ -12,6 +16,7 @@ var sets = [][]*inst.Instruction{
|
||||
vpclmulqdq,
|
||||
vpopcntdq,
|
||||
bitalg,
|
||||
vbmi2,
|
||||
}
|
||||
|
||||
// Instructions returns a list of extras to add to the instructions database.
|
||||
@@ -34,5 +39,15 @@ func Instructions() []*inst.Instruction {
|
||||
is = append(is, &c)
|
||||
}
|
||||
}
|
||||
|
||||
// Sort ISA lists. Similarly, this facilitates sharing helper functions for
|
||||
// building forms lists without worrying about whether the ISA list is in
|
||||
// the right order.
|
||||
for _, i := range is {
|
||||
for idx := range i.Forms {
|
||||
sort.Strings(i.Forms[idx].ISA)
|
||||
}
|
||||
}
|
||||
|
||||
return is
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user