Skip to content

Commit

Permalink
vpdpw[su,us,uu]d[,s] support avx10.2
Browse files Browse the repository at this point in the history
  • Loading branch information
herumi committed Oct 13, 2024
1 parent f6c66cf commit 08f71ce
Show file tree
Hide file tree
Showing 5 changed files with 99 additions and 17 deletions.
2 changes: 1 addition & 1 deletion doc/usage.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ param|vnniEnc|avx10Enc
EvexEncoding|AVX512-VNNI|AVX10.2
VexEncoding|AVX-VNNI|AVX-VNNI-INT8
default|EvexEncoding|VexEncoding
mnemonic|vpdpbusd, vpdpbusds, vpdpwssd, vpdpwssds|vmpsadbw, vpdpbssd, vpdpbssds, vpdpbsud, vpdpbsuds, vpdpbuud, vpdpbuuds
mnemonic|vpdpbusd, vpdpbusds, vpdpwssd, vpdpwssds|vmpsadbw, vpdpbssd, vpdpbssds, vpdpbsud, vpdpbsuds, vpdpbuud, vpdpbuuds, vpdpwsud vpdpwsuds vpdpwusd vpdpwusds vpdpwuud, vpdpwuuds

### Remark
* `k1`, ..., `k7` are opmask registers.
Expand Down
14 changes: 10 additions & 4 deletions gen/gen_avx512.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -467,16 +467,22 @@ void putX_X_XM_IMM_AVX10()
int sel;
bool hasIMM;
} tbl[] = {
// vpdpb[su,uu,ss]d[,s]
{ 0x50, "vpdpbssd", T_F2|T_0F38|T_YMM, T_W0, T_EW0|T_B32, 1, false },
{ 0x51, "vpdpbssds", T_F2|T_0F38|T_YMM, T_W0, T_EW0|T_B32, 1, false },
{ 0x50, "vpdpbsud", T_F3|T_0F38|T_YMM, T_W0, T_EW0|T_B32, 1, false },
{ 0x51, "vpdpbsuds", T_F3|T_0F38|T_YMM, T_W0, T_EW0|T_B32, 1, false },
{ 0x50, "vpdpbuud", T_0F38|T_YMM, T_W0, T_EW0|T_B32, 1, false },
{ 0x51, "vpdpbuuds", T_0F38|T_YMM, T_W0, T_EW0|T_B32, 1, false },
#if 0
{ 0x50, "vpdpbuud", T_MUST_EVEX | T_YMM | T_0F38 | T_EW0 | T_B32, false },
{ 0x51, "vpdpbuuds", T_MUST_EVEX | T_YMM | T_0F38 | T_EW0 | T_B32, false },
#endif

// vpdpw[su,us,uu]d[,s]
{ 0xD2, "vpdpwsud", T_F3|T_0F38|T_YMM, T_W0, T_EW0|T_B32, 1, false },
{ 0xD3, "vpdpwsuds", T_F3|T_0F38|T_YMM, T_W0, T_EW0|T_B32, 1, false },
{ 0xD2, "vpdpwusd", T_66|T_0F38|T_YMM, T_W0, T_EW0|T_B32, 1, false },
{ 0xD3, "vpdpwusds", T_66|T_0F38|T_YMM, T_W0, T_EW0|T_B32, 1, false },
{ 0xD2, "vpdpwuud", T_0F38|T_YMM, T_W0, T_EW0|T_B32, 1, false },
{ 0xD3, "vpdpwuuds", T_0F38|T_YMM, T_W0, T_EW0|T_B32, 1, false },

{ 0x42, "vmpsadbw", T_0F3A|T_YMM, T_66|T_W0|T_YMM, T_F3|T_0F3A|T_EW0|T_B32, 1, true },
};
for (size_t i = 0; i < NUM_OF_ARRAY(tbl); i++) {
Expand Down
14 changes: 8 additions & 6 deletions gen/gen_code.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1901,6 +1901,7 @@ void put()
}
// avx-vnni-int8
// avx-vnni-int16
#if 0
{
const struct Tbl {
uint8_t code;
Expand All @@ -1914,19 +1915,20 @@ void put()
// { 0x50, "vpdpbuud", T_0F38 | T_W0 | T_YMM },
// { 0x51, "vpdpbuuds", T_0F38 | T_W0 | T_YMM },

{ 0xD2, "vpdpwsud", T_F3 | T_0F38 | T_W0 | T_YMM },
{ 0xD3, "vpdpwsuds", T_F3 | T_0F38 | T_W0 | T_YMM },
{ 0xD2, "vpdpwusd", T_66 | T_0F38 | T_W0 | T_YMM },
{ 0xD3, "vpdpwusds", T_66 | T_0F38 | T_W0 | T_YMM },
{ 0xD2, "vpdpwuud", T_0F38 | T_W0 | T_YMM },
{ 0xD3, "vpdpwuuds", T_0F38 | T_W0 | T_YMM },
// { 0xD2, "vpdpwsud", T_F3 | T_0F38 | T_W0 | T_YMM },
// { 0xD3, "vpdpwsuds", T_F3 | T_0F38 | T_W0 | T_YMM },
// { 0xD2, "vpdpwusd", T_66 | T_0F38 | T_W0 | T_YMM },
// { 0xD3, "vpdpwusds", T_66 | T_0F38 | T_W0 | T_YMM },
// { 0xD2, "vpdpwuud", T_0F38 | T_W0 | T_YMM },
// { 0xD3, "vpdpwuuds", T_0F38 | T_W0 | T_YMM },
};
for (size_t i = 0; i < NUM_OF_ARRAY(tbl); i++) {
const Tbl *p = &tbl[i];
std::string s = type2String(p->type);
printf("void %s(const Xmm& x1, const Xmm& x2, const Operand& op) { opAVX_X_X_XM(x1, x2, op, %s, 0x%02X); }\n", p->name, s.c_str(), p->code);
}
}
#endif
}

void put32()
Expand Down
74 changes: 74 additions & 0 deletions test/avx10/misc.txt
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,77 @@ vpdpbuuds(ym1, ym2, ptr_b[rax+128]);
vpdpbuuds(zm1, zm2, zm3);
vpdpbuuds(zm1, zm2, ptr[rax+128]);
vpdpbuuds(zm1, zm2, ptr_b[rax+128]);

//
vpdpwsud(xm1, xm2, xm3);
vpdpwsud(xm1, xm2, ptr[rax+128]);
vpdpwsud(xm1, xm2, ptr_b[rax+128]);

vpdpwsud(ym1, ym2, ym3);
vpdpwsud(ym1, ym2, ptr[rax+128]);
vpdpwsud(ym1, ym2, ptr_b[rax+128]);

vpdpwsud(zm1, zm2, zm3);
vpdpwsud(zm1, zm2, ptr[rax+128]);
vpdpwsud(zm1, zm2, ptr_b[rax+128]);
//
vpdpwsuds(xm1, xm2, xm3);
vpdpwsuds(xm1, xm2, ptr[rax+128]);
vpdpwsuds(xm1, xm2, ptr_b[rax+128]);

vpdpwsuds(ym1, ym2, ym3);
vpdpwsuds(ym1, ym2, ptr[rax+128]);
vpdpwsuds(ym1, ym2, ptr_b[rax+128]);

vpdpwsuds(zm1, zm2, zm3);
vpdpwsuds(zm1, zm2, ptr[rax+128]);
vpdpwsuds(zm1, zm2, ptr_b[rax+128]);
//
vpdpwsud(xm1, xm2, xm3);
vpdpwsud(xm1, xm2, ptr[rax+128]);
vpdpwsud(xm1, xm2, ptr_b[rax+128]);

vpdpwsud(ym1, ym2, ym3);
vpdpwsud(ym1, ym2, ptr[rax+128]);
vpdpwsud(ym1, ym2, ptr_b[rax+128]);

vpdpwsud(zm1, zm2, zm3);
vpdpwsud(zm1, zm2, ptr[rax+128]);
vpdpwsud(zm1, zm2, ptr_b[rax+128]);
//
vpdpwsuds(xm1, xm2, xm3);
vpdpwsuds(xm1, xm2, ptr[rax+128]);
vpdpwsuds(xm1, xm2, ptr_b[rax+128]);

vpdpwsuds(ym1, ym2, ym3);
vpdpwsuds(ym1, ym2, ptr[rax+128]);
vpdpwsuds(ym1, ym2, ptr_b[rax+128]);

vpdpwsuds(zm1, zm2, zm3);
vpdpwsuds(zm1, zm2, ptr[rax+128]);
vpdpwsuds(zm1, zm2, ptr_b[rax+128]);

//
vpdpwuud(xm1, xm2, xm3);
vpdpwuud(xm1, xm2, ptr[rax+128]);
vpdpwuud(xm1, xm2, ptr_b[rax+128]);

vpdpwuud(ym1, ym2, ym3);
vpdpwuud(ym1, ym2, ptr[rax+128]);
vpdpwuud(ym1, ym2, ptr_b[rax+128]);

vpdpwuud(zm1, zm2, zm3);
vpdpwuud(zm1, zm2, ptr[rax+128]);
vpdpwuud(zm1, zm2, ptr_b[rax+128]);
//
vpdpwuuds(xm1, xm2, xm3);
vpdpwuuds(xm1, xm2, ptr[rax+128]);
vpdpwuuds(xm1, xm2, ptr_b[rax+128]);

vpdpwuuds(ym1, ym2, ym3);
vpdpwuuds(ym1, ym2, ptr[rax+128]);
vpdpwuuds(ym1, ym2, ptr_b[rax+128]);

vpdpwuuds(zm1, zm2, zm3);
vpdpwuuds(zm1, zm2, ptr[rax+128]);
vpdpwuuds(zm1, zm2, ptr_b[rax+128]);
12 changes: 6 additions & 6 deletions xbyak/xbyak_mnemonic.h
Original file line number Diff line number Diff line change
Expand Up @@ -1423,12 +1423,6 @@ void vpdpbusd(const Xmm& x1, const Xmm& x2, const Operand& op, PreferredEncoding
void vpdpbusds(const Xmm& x1, const Xmm& x2, const Operand& op, PreferredEncoding encoding = DefaultEncoding) { opEncoding(x1, x2, op, T_66|T_0F38|T_EW0|T_YMM|T_SAE_Z|T_B32, 0x51, encoding); }
void vpdpwssd(const Xmm& x1, const Xmm& x2, const Operand& op, PreferredEncoding encoding = DefaultEncoding) { opEncoding(x1, x2, op, T_66|T_0F38|T_EW0|T_YMM|T_SAE_Z|T_B32, 0x52, encoding); }
void vpdpwssds(const Xmm& x1, const Xmm& x2, const Operand& op, PreferredEncoding encoding = DefaultEncoding) { opEncoding(x1, x2, op, T_66|T_0F38|T_EW0|T_YMM|T_SAE_Z|T_B32, 0x53, encoding); }
void vpdpwsud(const Xmm& x1, const Xmm& x2, const Operand& op) { opAVX_X_X_XM(x1, x2, op, T_F3|T_0F38|T_W0|T_YMM, 0xD2); }
void vpdpwsuds(const Xmm& x1, const Xmm& x2, const Operand& op) { opAVX_X_X_XM(x1, x2, op, T_F3|T_0F38|T_W0|T_YMM, 0xD3); }
void vpdpwusd(const Xmm& x1, const Xmm& x2, const Operand& op) { opAVX_X_X_XM(x1, x2, op, T_66|T_0F38|T_W0|T_YMM, 0xD2); }
void vpdpwusds(const Xmm& x1, const Xmm& x2, const Operand& op) { opAVX_X_X_XM(x1, x2, op, T_66|T_0F38|T_W0|T_YMM, 0xD3); }
void vpdpwuud(const Xmm& x1, const Xmm& x2, const Operand& op) { opAVX_X_X_XM(x1, x2, op, T_0F38|T_W0|T_YMM, 0xD2); }
void vpdpwuuds(const Xmm& x1, const Xmm& x2, const Operand& op) { opAVX_X_X_XM(x1, x2, op, T_0F38|T_W0|T_YMM, 0xD3); }
void vperm2f128(const Ymm& y1, const Ymm& y2, const Operand& op, uint8_t imm) { if (!(y1.isYMM() && y2.isYMM() && op.isYMEM())) XBYAK_THROW(ERR_BAD_COMBINATION) opVex(y1, &y2, op, T_0F3A | T_66 | T_W0 | T_YMM, 0x06, imm); }
void vperm2i128(const Ymm& y1, const Ymm& y2, const Operand& op, uint8_t imm) { if (!(y1.isYMM() && y2.isYMM() && op.isYMEM())) XBYAK_THROW(ERR_BAD_COMBINATION) opVex(y1, &y2, op, T_0F3A | T_66 | T_W0 | T_YMM, 0x46, imm); }
void vpermd(const Ymm& y1, const Ymm& y2, const Operand& op) { opAVX_X_X_XM(y1, y2, op, T_66|T_0F38|T_W0|T_EW0|T_YMM|T_EVEX|T_B32, 0x36); }
Expand Down Expand Up @@ -2451,6 +2445,12 @@ void vpdpbsud(const Xmm& x1, const Xmm& x2, const Operand& op, PreferredEncoding
void vpdpbsuds(const Xmm& x1, const Xmm& x2, const Operand& op, PreferredEncoding encoding = DefaultEncoding) { opEncoding(x1, x2, op, T_F3|T_0F38|T_YMM, 0x51, encoding, NONE, T_W0, T_EW0|T_B32, 1); }
void vpdpbuud(const Xmm& x1, const Xmm& x2, const Operand& op, PreferredEncoding encoding = DefaultEncoding) { opEncoding(x1, x2, op, T_0F38|T_YMM, 0x50, encoding, NONE, T_W0, T_EW0|T_B32, 1); }
void vpdpbuuds(const Xmm& x1, const Xmm& x2, const Operand& op, PreferredEncoding encoding = DefaultEncoding) { opEncoding(x1, x2, op, T_0F38|T_YMM, 0x51, encoding, NONE, T_W0, T_EW0|T_B32, 1); }
void vpdpwsud(const Xmm& x1, const Xmm& x2, const Operand& op, PreferredEncoding encoding = DefaultEncoding) { opEncoding(x1, x2, op, T_F3|T_0F38|T_YMM, 0xD2, encoding, NONE, T_W0, T_EW0|T_B32, 1); }
void vpdpwsuds(const Xmm& x1, const Xmm& x2, const Operand& op, PreferredEncoding encoding = DefaultEncoding) { opEncoding(x1, x2, op, T_F3|T_0F38|T_YMM, 0xD3, encoding, NONE, T_W0, T_EW0|T_B32, 1); }
void vpdpwusd(const Xmm& x1, const Xmm& x2, const Operand& op, PreferredEncoding encoding = DefaultEncoding) { opEncoding(x1, x2, op, T_66|T_0F38|T_YMM, 0xD2, encoding, NONE, T_W0, T_EW0|T_B32, 1); }
void vpdpwusds(const Xmm& x1, const Xmm& x2, const Operand& op, PreferredEncoding encoding = DefaultEncoding) { opEncoding(x1, x2, op, T_66|T_0F38|T_YMM, 0xD3, encoding, NONE, T_W0, T_EW0|T_B32, 1); }
void vpdpwuud(const Xmm& x1, const Xmm& x2, const Operand& op, PreferredEncoding encoding = DefaultEncoding) { opEncoding(x1, x2, op, T_0F38|T_YMM, 0xD2, encoding, NONE, T_W0, T_EW0|T_B32, 1); }
void vpdpwuuds(const Xmm& x1, const Xmm& x2, const Operand& op, PreferredEncoding encoding = DefaultEncoding) { opEncoding(x1, x2, op, T_0F38|T_YMM, 0xD3, encoding, NONE, T_W0, T_EW0|T_B32, 1); }
void vpermb(const Xmm& x1, const Xmm& x2, const Operand& op) { opAVX_X_X_XM(x1, x2, op, T_66|T_0F38|T_EW0|T_YMM|T_MUST_EVEX, 0x8D); }
void vpermi2b(const Xmm& x1, const Xmm& x2, const Operand& op) { opAVX_X_X_XM(x1, x2, op, T_66|T_0F38|T_EW0|T_YMM|T_MUST_EVEX, 0x75); }
void vpermi2d(const Xmm& x1, const Xmm& x2, const Operand& op) { opAVX_X_X_XM(x1, x2, op, T_66|T_0F38|T_EW0|T_YMM|T_MUST_EVEX|T_B32, 0x76); }
Expand Down

0 comments on commit 08f71ce

Please sign in to comment.