| 1 | package opcodesextra |
| 2 | |
| 3 | import "github.com/mmcloughlin/avo/internal/inst" |
| 4 | |
| 5 | // gfni is the "Galois Field New Instructions" instruction set. |
| 6 | var gfni = []*inst.Instruction{ |
| 7 | // Reference: https://github.com/golang/go/blob/go1.19.3/src/cmd/internal/obj/x86/avx_optabs.go#L2250-L2269 |
| 8 | // |
| 9 | // {as: AVGF2P8AFFINEINVQB, ytab: _yvgf2p8affineinvqb, prefix: Pavx, op: opBytes{ |
| 10 | // avxEscape | vex128 | vex66 | vex0F3A | vexW1, 0xCF, |
| 11 | // avxEscape | vex256 | vex66 | vex0F3A | vexW1, 0xCF, |
| 12 | // avxEscape | evex128 | evex66 | evex0F3A | evexW1, evexN16 | evexBcstN8 | evexZeroingEnabled, 0xCF, |
| 13 | // avxEscape | evex256 | evex66 | evex0F3A | evexW1, evexN32 | evexBcstN8 | evexZeroingEnabled, 0xCF, |
| 14 | // avxEscape | evex512 | evex66 | evex0F3A | evexW1, evexN64 | evexBcstN8 | evexZeroingEnabled, 0xCF, |
| 15 | // }}, |
| 16 | // {as: AVGF2P8AFFINEQB, ytab: _yvgf2p8affineinvqb, prefix: Pavx, op: opBytes{ |
| 17 | // avxEscape | vex128 | vex66 | vex0F3A | vexW1, 0xCE, |
| 18 | // avxEscape | vex256 | vex66 | vex0F3A | vexW1, 0xCE, |
| 19 | // avxEscape | evex128 | evex66 | evex0F3A | evexW1, evexN16 | evexBcstN8 | evexZeroingEnabled, 0xCE, |
| 20 | // avxEscape | evex256 | evex66 | evex0F3A | evexW1, evexN32 | evexBcstN8 | evexZeroingEnabled, 0xCE, |
| 21 | // avxEscape | evex512 | evex66 | evex0F3A | evexW1, evexN64 | evexBcstN8 | evexZeroingEnabled, 0xCE, |
| 22 | // }}, |
| 23 | // {as: AVGF2P8MULB, ytab: _yvandnpd, prefix: Pavx, op: opBytes{ |
| 24 | // avxEscape | vex128 | vex66 | vex0F38 | vexW0, 0xCF, |
| 25 | // avxEscape | vex256 | vex66 | vex0F38 | vexW0, 0xCF, |
| 26 | // avxEscape | evex128 | evex66 | evex0F38 | evexW0, evexN16 | evexZeroingEnabled, 0xCF, |
| 27 | // avxEscape | evex256 | evex66 | evex0F38 | evexW0, evexN32 | evexZeroingEnabled, 0xCF, |
| 28 | // avxEscape | evex512 | evex66 | evex0F38 | evexW0, evexN64 | evexZeroingEnabled, 0xCF, |
| 29 | // |
| 30 | { |
| 31 | Opcode: "VGF2P8AFFINEQB", |
| 32 | Summary: "Galois Field Affine Transformation", |
| 33 | Forms: vgf2p8affineqb, |
| 34 | }, |
| 35 | { |
| 36 | Opcode: "VGF2P8AFFINEINVQB", |
| 37 | Summary: "Galois Field Affine Transformation Inverse", |
| 38 | Forms: vgf2p8affineqb, |
| 39 | }, |
| 40 | { |
| 41 | Opcode: "VGF2P8MULB", |
| 42 | Summary: "Galois Field Multiply Bytes", |
| 43 | Forms: vgf2p8mulb, |
| 44 | }, |
| 45 | } |
| 46 | |
| 47 | // VGF2P8AFFINEQB and VGF2P8AFFINEINVQB forms. |
| 48 | // |
| 49 | // See: https://www.felixcloutier.com/x86/gf2p8affineqb |
| 50 | // |
| 51 | // Reference: https://github.com/golang/go/blob/go1.19.3/src/cmd/internal/obj/x86/avx_optabs.go#L483-L492 |
| 52 | // |
| 53 | // var _yvgf2p8affineinvqb = []ytab{ |
| 54 | // {zcase: Zvex_i_rm_v_r, zoffset: 2, args: argList{Yu8, Yxm, Yxr, Yxr}}, |
| 55 | // {zcase: Zvex_i_rm_v_r, zoffset: 2, args: argList{Yu8, Yym, Yyr, Yyr}}, |
| 56 | // {zcase: Zevex_i_rm_v_r, zoffset: 0, args: argList{Yu8, YxmEvex, YxrEvex, YxrEvex}}, |
| 57 | // {zcase: Zevex_i_rm_v_k_r, zoffset: 3, args: argList{Yu8, YxmEvex, YxrEvex, Yknot0, YxrEvex}}, |
| 58 | // {zcase: Zevex_i_rm_v_r, zoffset: 0, args: argList{Yu8, YymEvex, YyrEvex, YyrEvex}}, |
| 59 | // {zcase: Zevex_i_rm_v_k_r, zoffset: 3, args: argList{Yu8, YymEvex, YyrEvex, Yknot0, YyrEvex}}, |
| 60 | // {zcase: Zevex_i_rm_v_r, zoffset: 0, args: argList{Yu8, Yzm, Yzr, Yzr}}, |
| 61 | // {zcase: Zevex_i_rm_v_k_r, zoffset: 3, args: argList{Yu8, Yzm, Yzr, Yknot0, Yzr}}, |
| 62 | // } |
| 63 | var vgf2p8affineqb = inst.Forms{ |
| 64 | // VEX.128.66.0F3A.W1 CE /r /ib VGF2P8AFFINEQB xmm1, xmm2, xmm3/m128, imm8 |
| 65 | { |
| 66 | Operands: []inst.Operand{ |
| 67 | {Type: "imm8", Action: inst.R}, |
| 68 | {Type: "xmm", Action: inst.R}, |
| 69 | {Type: "xmm", Action: inst.R}, |
| 70 | {Type: "xmm", Action: inst.W}, |
| 71 | }, |
| 72 | EncodingType: inst.EncodingTypeVEX, |
| 73 | ISA: []string{"AVX", "GFNI"}, |
| 74 | }, |
| 75 | { |
| 76 | Operands: []inst.Operand{ |
| 77 | {Type: "imm8", Action: inst.R}, |
| 78 | {Type: "m128", Action: inst.R}, |
| 79 | {Type: "xmm", Action: inst.R}, |
| 80 | {Type: "xmm", Action: inst.W}, |
| 81 | }, |
| 82 | EncodingType: inst.EncodingTypeVEX, |
| 83 | ISA: []string{"AVX", "GFNI"}, |
| 84 | }, |
| 85 | // VEX.256.66.0F3A.W1 CE /r /ib VGF2P8AFFINEQB ymm1, ymm2, ymm3/m256, imm8 |
| 86 | { |
| 87 | Operands: []inst.Operand{ |
| 88 | {Type: "imm8", Action: inst.R}, |
| 89 | {Type: "ymm", Action: inst.R}, |
| 90 | {Type: "ymm", Action: inst.R}, |
| 91 | {Type: "ymm", Action: inst.W}, |
| 92 | }, |
| 93 | EncodingType: inst.EncodingTypeVEX, |
| 94 | ISA: []string{"AVX", "GFNI"}, |
| 95 | }, |
| 96 | { |
| 97 | Operands: []inst.Operand{ |
| 98 | {Type: "imm8", Action: inst.R}, |
| 99 | {Type: "m256", Action: inst.R}, |
| 100 | {Type: "ymm", Action: inst.R}, |
| 101 | {Type: "ymm", Action: inst.W}, |
| 102 | }, |
| 103 | EncodingType: inst.EncodingTypeVEX, |
| 104 | ISA: []string{"AVX", "GFNI"}, |
| 105 | }, |
| 106 | // EVEX.128.66.0F3A.W1 CE /r /ib VGF2P8AFFINEQB xmm1{k1}{z}, xmm2, xmm3/m128/m64bcst, imm8 |
| 107 | { |
| 108 | Operands: []inst.Operand{ |
| 109 | {Type: "imm8", Action: inst.R}, |
| 110 | {Type: "xmm", Action: inst.R}, |
| 111 | {Type: "xmm", Action: inst.R}, |
| 112 | {Type: "xmm{k}{z}", Action: inst.W}, |
| 113 | }, |
| 114 | EncodingType: inst.EncodingTypeEVEX, |
| 115 | ISA: []string{"AVX512VL", "GFNI"}, |
| 116 | }, |
| 117 | { |
| 118 | Operands: []inst.Operand{ |
| 119 | {Type: "imm8", Action: inst.R}, |
| 120 | {Type: "m128/m64bcst", Action: inst.R}, |
| 121 | {Type: "xmm", Action: inst.R}, |
| 122 | {Type: "xmm{k}{z}", Action: inst.W}, |
| 123 | }, |
| 124 | EncodingType: inst.EncodingTypeEVEX, |
| 125 | ISA: []string{"AVX512VL", "GFNI"}, |
| 126 | }, |
| 127 | // EVEX.256.66.0F3A.W1 CE /r /ib VGF2P8AFFINEQB ymm1{k1}{z}, ymm2, ymm3/m256/m64bcst, imm8 |
| 128 | { |
| 129 | Operands: []inst.Operand{ |
| 130 | {Type: "imm8", Action: inst.R}, |
| 131 | {Type: "ymm", Action: inst.R}, |
| 132 | {Type: "ymm", Action: inst.R}, |
| 133 | {Type: "ymm{k}{z}", Action: inst.W}, |
| 134 | }, |
| 135 | EncodingType: inst.EncodingTypeEVEX, |
| 136 | ISA: []string{"AVX512VL", "GFNI"}, |
| 137 | }, |
| 138 | { |
| 139 | Operands: []inst.Operand{ |
| 140 | {Type: "imm8", Action: inst.R}, |
| 141 | {Type: "m256/m64bcst", Action: inst.R}, |
| 142 | {Type: "ymm", Action: inst.R}, |
| 143 | {Type: "ymm{k}{z}", Action: inst.W}, |
| 144 | }, |
| 145 | EncodingType: inst.EncodingTypeEVEX, |
| 146 | ISA: []string{"AVX512VL", "GFNI"}, |
| 147 | }, |
| 148 | // EVEX.512.66.0F3A.W1 CE /r /ib VGF2P8AFFINEQB zmm1{k1}{z}, zmm2, zmm3/m512/m64bcst, imm8 |
| 149 | { |
| 150 | Operands: []inst.Operand{ |
| 151 | {Type: "imm8", Action: inst.R}, |
| 152 | {Type: "zmm", Action: inst.R}, |
| 153 | {Type: "zmm", Action: inst.R}, |
| 154 | {Type: "zmm{k}{z}", Action: inst.W}, |
| 155 | }, |
| 156 | EncodingType: inst.EncodingTypeEVEX, |
| 157 | ISA: []string{"AVX512F", "GFNI"}, |
| 158 | }, |
| 159 | { |
| 160 | Operands: []inst.Operand{ |
| 161 | {Type: "imm8", Action: inst.R}, |
| 162 | {Type: "m512/m64bcst", Action: inst.R}, |
| 163 | {Type: "zmm", Action: inst.R}, |
| 164 | {Type: "zmm{k}{z}", Action: inst.W}, |
| 165 | }, |
| 166 | EncodingType: inst.EncodingTypeEVEX, |
| 167 | ISA: []string{"AVX512F", "GFNI"}, |
| 168 | }, |
| 169 | } |
| 170 | |
| 171 | // VGF2P8MULB forms. |
| 172 | // |
| 173 | // See: https://www.felixcloutier.com/x86/gf2p8mulb |
| 174 | // |
| 175 | // Reference: https://github.com/golang/go/blob/go1.19.3/src/cmd/internal/obj/x86/avx_optabs.go#L137-L146 |
| 176 | // |
| 177 | // var _yvandnpd = []ytab{ |
| 178 | // {zcase: Zvex_rm_v_r, zoffset: 2, args: argList{Yxm, Yxr, Yxr}}, |
| 179 | // {zcase: Zvex_rm_v_r, zoffset: 2, args: argList{Yym, Yyr, Yyr}}, |
| 180 | // {zcase: Zevex_rm_v_r, zoffset: 0, args: argList{YxmEvex, YxrEvex, YxrEvex}}, |
| 181 | // {zcase: Zevex_rm_v_k_r, zoffset: 3, args: argList{YxmEvex, YxrEvex, Yknot0, YxrEvex}}, |
| 182 | // {zcase: Zevex_rm_v_r, zoffset: 0, args: argList{YymEvex, YyrEvex, YyrEvex}}, |
| 183 | // {zcase: Zevex_rm_v_k_r, zoffset: 3, args: argList{YymEvex, YyrEvex, Yknot0, YyrEvex}}, |
| 184 | // {zcase: Zevex_rm_v_r, zoffset: 0, args: argList{Yzm, Yzr, Yzr}}, |
| 185 | // {zcase: Zevex_rm_v_k_r, zoffset: 3, args: argList{Yzm, Yzr, Yknot0, Yzr}}, |
| 186 | // } |
| 187 | var vgf2p8mulb = inst.Forms{ |
| 188 | // VEX.128.66.0F38.W0 CF /r VGF2P8MULB xmm1, xmm2, xmm3/m128 |
| 189 | { |
| 190 | Operands: []inst.Operand{ |
| 191 | {Type: "xmm", Action: inst.R}, |
| 192 | {Type: "xmm", Action: inst.R}, |
| 193 | {Type: "xmm", Action: inst.W}, |
| 194 | }, |
| 195 | EncodingType: inst.EncodingTypeVEX, |
| 196 | ISA: []string{"AVX", "GFNI"}, |
| 197 | }, |
| 198 | { |
| 199 | Operands: []inst.Operand{ |
| 200 | {Type: "m128", Action: inst.R}, |
| 201 | {Type: "xmm", Action: inst.R}, |
| 202 | {Type: "xmm", Action: inst.W}, |
| 203 | }, |
| 204 | EncodingType: inst.EncodingTypeVEX, |
| 205 | ISA: []string{"AVX", "GFNI"}, |
| 206 | }, |
| 207 | // VEX.256.66.0F38.W0 CF /r VGF2P8MULB ymm1, ymm2, ymm3/m256 |
| 208 | { |
| 209 | Operands: []inst.Operand{ |
| 210 | {Type: "ymm", Action: inst.R}, |
| 211 | {Type: "ymm", Action: inst.R}, |
| 212 | {Type: "ymm", Action: inst.W}, |
| 213 | }, |
| 214 | EncodingType: inst.EncodingTypeVEX, |
| 215 | ISA: []string{"AVX", "GFNI"}, |
| 216 | }, |
| 217 | { |
| 218 | Operands: []inst.Operand{ |
| 219 | {Type: "m256", Action: inst.R}, |
| 220 | {Type: "ymm", Action: inst.R}, |
| 221 | {Type: "ymm", Action: inst.W}, |
| 222 | }, |
| 223 | EncodingType: inst.EncodingTypeVEX, |
| 224 | ISA: []string{"AVX", "GFNI"}, |
| 225 | }, |
| 226 | // EVEX.128.66.0F38.W0 CF /r VGF2P8MULB xmm1{k1}{z}, xmm2, xmm3/m128 |
| 227 | { |
| 228 | Operands: []inst.Operand{ |
| 229 | {Type: "xmm", Action: inst.R}, |
| 230 | {Type: "xmm", Action: inst.R}, |
| 231 | {Type: "xmm{k}{z}", Action: inst.W}, |
| 232 | }, |
| 233 | EncodingType: inst.EncodingTypeEVEX, |
| 234 | ISA: []string{"AVX512VL", "GFNI"}, |
| 235 | }, |
| 236 | { |
| 237 | Operands: []inst.Operand{ |
| 238 | {Type: "m128", Action: inst.R}, |
| 239 | {Type: "xmm", Action: inst.R}, |
| 240 | {Type: "xmm{k}{z}", Action: inst.W}, |
| 241 | }, |
| 242 | EncodingType: inst.EncodingTypeEVEX, |
| 243 | ISA: []string{"AVX512VL", "GFNI"}, |
| 244 | }, |
| 245 | // EVEX.256.66.0F38.W0 CF /r VGF2P8MULB ymm1{k1}{z}, ymm2, ymm3/m256 |
| 246 | { |
| 247 | Operands: []inst.Operand{ |
| 248 | {Type: "ymm", Action: inst.R}, |
| 249 | {Type: "ymm", Action: inst.R}, |
| 250 | {Type: "ymm{k}{z}", Action: inst.W}, |
| 251 | }, |
| 252 | EncodingType: inst.EncodingTypeEVEX, |
| 253 | ISA: []string{"AVX512VL", "GFNI"}, |
| 254 | }, |
| 255 | { |
| 256 | Operands: []inst.Operand{ |
| 257 | {Type: "m256", Action: inst.R}, |
| 258 | {Type: "ymm", Action: inst.R}, |
| 259 | {Type: "ymm{k}{z}", Action: inst.W}, |
| 260 | }, |
| 261 | EncodingType: inst.EncodingTypeEVEX, |
| 262 | ISA: []string{"AVX512VL", "GFNI"}, |
| 263 | }, |
| 264 | // EVEX.512.66.0F38.W0 CF /r VGF2P8MULB zmm1{k1}{z}, zmm2, zmm3/m512 |
| 265 | { |
| 266 | Operands: []inst.Operand{ |
| 267 | {Type: "zmm", Action: inst.R}, |
| 268 | {Type: "zmm", Action: inst.R}, |
| 269 | {Type: "zmm{k}{z}", Action: inst.W}, |
| 270 | }, |
| 271 | EncodingType: inst.EncodingTypeEVEX, |
| 272 | ISA: []string{"AVX512F", "GFNI"}, |
| 273 | }, |
| 274 | { |
| 275 | Operands: []inst.Operand{ |
| 276 | {Type: "m512", Action: inst.R}, |
| 277 | {Type: "zmm", Action: inst.R}, |
| 278 | {Type: "zmm{k}{z}", Action: inst.W}, |
| 279 | }, |
| 280 | EncodingType: inst.EncodingTypeEVEX, |
| 281 | ISA: []string{"AVX512F", "GFNI"}, |
| 282 | }, |
| 283 | } |