| 1 | // Package opcodesextra provides curated extensions to the instruction database. |
| 2 | package opcodesextrascip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/internal/opcodesextra`/ |
| 3 | |
| 4 | import ( |
| 5 | "sortscip-go gomod github.com/golang/go/src go1.18 sort/" |
| 6 | |
| 7 | "github.com/mmcloughlin/avo/internal/instscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/internal/inst`/" |
| 8 | ) |
| 9 | |
| 10 | // sets of extra instructions. |
| 11 | var setsscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/internal/opcodesextra`/sets. = [][]*instscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/internal/inst`/.Instructionscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/internal/inst`/Instruction#{ |
| 12 | movlqzxscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/internal/opcodesextra`/movlqzx., |
| 13 | gfniscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/internal/opcodesextra`/gfni., |
| 14 | vaesscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/internal/opcodesextra`/vaes., |
| 15 | vnniscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/internal/opcodesextra`/vnni., |
| 16 | vpclmulqdqscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/internal/opcodesextra`/vpclmulqdq., |
| 17 | vpopcntdqscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/internal/opcodesextra`/vpopcntdq., |
| 18 | bitalgscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/internal/opcodesextra`/bitalg., |
| 19 | vbmi2scip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/internal/opcodesextra`/vbmi2., |
| 20 | } |
| 21 | |
| 22 | // Instructions returns a list of extras to add to the instructions database. |
| 23 | // |
| 24 | // Note that instructions returned are expected to be injected into the loading |
| 25 | // process, as if they had been read out of the Opcodes database. As such, they |
| 26 | // are not expected to be in the final form required for the instruction |
| 27 | // database. For example, AVX-512 instruction form transformations do not need |
| 28 | // to be applied, and operand types such as xmm{k}{z} or m256/m64bcst may be |
| 29 | // used for brevity. |
| 30 | func Instructionsscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/internal/opcodesextra`/Instructions().() []*instscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/internal/inst`/.Instructionscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/internal/inst`/Instruction# { |
| 31 | // Concatenate and clone the instruction lists. It can be convenient for |
| 32 | // forms lists and other data structures to be shared in the curated lists, |
| 33 | // but we want to return distinct copies here to avoid subtle bugs in |
| 34 | // consumers. |
| 35 | var is []*instscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/internal/inst`/.Instructionscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/internal/inst`/Instruction# |
| 36 | for _, set := range setsscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/internal/opcodesextra`/sets. { |
| 37 | for _, i := range set { |
| 38 | c := i.Clonescip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/internal/inst`/Instruction#Clone().() |
| 39 | is = append(is, &c) |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | // Sort ISA lists. Similarly, this facilitates sharing helper functions for |
| 44 | // building forms lists without worrying about whether the ISA list is in |
| 45 | // the right order. |
| 46 | for _, i := range is { |
| 47 | for idx := range i.Formsscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/internal/inst`/Instruction#Forms. { |
| 48 | sortscip-go gomod github.com/golang/go/src go1.18 sort/.Stringsscip-go gomod github.com/golang/go/src go1.18 sort/Strings().(i.Formsscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/internal/inst`/Instruction#Forms.[idx].ISAscip-go gomod github.com/mmcloughlin/avo . `github.com/mmcloughlin/avo/internal/inst`/Form#ISA.) |
| 49 | } |
| 50 | } |
| 51 | |
| 52 | return is |
| 53 | } |