herumi / xbyak

A JIT assembler for x86/x64 architectures supporting MMX, SSE (1-4), AVX (1-2, 512), FPU, APX, and AVX10.2
BSD 3-Clause "New" or "Revised" License
2.05k stars 278 forks source link

Add support of Intel® AVX-VNNI instruction set #112

Closed akharito closed 4 years ago

akharito commented 4 years ago

Add support of Intel® AVX-VNNI instruction set described in updated Intel® Architecture Instruction Set Extensions Programming Reference

herumi commented 4 years ago

Thank you for the patch. Is preferred_encoding_t a flag to specify VEX or EVEX (default) as the following?

vpdpbusd(xmm1, xmm2, xmm3); // use EVEX
vpdpbusd(xmm1, xmm2, xmm3, VEX);

How about that CodeGenerator has the flag as the following?

CodeGenerator code;
vpdpbusd(xmm1, xmm2, xmm3); // use EVEX
code.setVEXencodingForVNNI();
vpdpbusd(xmm1, xmm2, xmm3); // use VEX
code.setVEXencodingForVNNI(false);
vpdpbusd(xmm1, xmm2, xmm3); // use EVEX
herumi commented 4 years ago

I tried to think again, it may be better to change encoding as you proposed because it is stateless.

herumi commented 4 years ago

I've tried some refactoring. https://github.com/herumi/xbyak/commit/f85b1100b571cb890e91c1940c20f78d5dd66f40 Is it okay?

Test is https://github.com/herumi/xbyak/commit/f85b1100b571cb890e91c1940c20f78d5dd66f40#diff-49ed38d2108d68e544b95993e3d03a76ad0ce7cfc9735b11219503a647728280 .

herumi commented 4 years ago

I modified that the default encoding is always evex even if XBYAK_DISABLE_AVX512 is defined. https://github.com/herumi/xbyak/commit/6b3eb9c1e46bfbb2081332c7a55cb6c73419a00e

akharito commented 4 years ago

@herumi , the variant after refactoring looks good to me! should I apply these changes in pull request branch?

herumi commented 4 years ago

@akharito Thank you for checking my code. No, you don't need it. I'll merge them to the master branch.