### Install Xbyak using vcpkg Source: https://github.com/herumi/xbyak/blob/master/doc/install.md Commands to clone the vcpkg repository and install the Xbyak port. ```bash git clone https://github.com/Microsoft/vcpkg.git cd vcpkg ./bootstrap-vcpkg.sh ./vcpkg integrate install ./vcpkg install xbyak ``` -------------------------------- ### Install Xbyak on Linux Source: https://github.com/herumi/xbyak/blob/master/doc/install.md Use the make utility to install Xbyak header files into the system include directory. ```bash make install ``` -------------------------------- ### Install Targets and Package Config Source: https://github.com/herumi/xbyak/blob/master/CMakeLists.txt Configures installation of the library, export targets, and package configuration files for find_package support. ```cmake install( TARGETS ${PROJECT_NAME} EXPORT ${PROJECT_NAME}-targets INCLUDES DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/${PROJECT_NAME} ) include(CMakePackageConfigHelpers) configure_package_config_file( cmake/config.cmake.in "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" INSTALL_DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} ) write_basic_package_version_file( "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake" COMPATIBILITY SameMajorVersion ) install( FILES "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config.cmake" "${CMAKE_CURRENT_BINARY_DIR}/${PROJECT_NAME}-config-version.cmake" DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} ) install( EXPORT ${PROJECT_NAME}-targets NAMESPACE ${PROJECT_NAME}:: DESTINATION ${CMAKE_INSTALL_LIBDIR}/cmake/${PROJECT_NAME} ) install( FILES ${headers} DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/xbyak ) ``` -------------------------------- ### Dot Product Instructions Source: https://github.com/herumi/xbyak/blob/master/test/dataset/old.txt Examples of various vpdp* dot product instructions. ```assembly vpdpbssd(xmm1, xmm2, xmm3); vpdpbssd(ymm1, ymm2, ptr [rax]); vpdpbssds(xmm1, xmm2, xmm3); vpdpbssds(ymm1, ymm2, ptr [rax]); vpdpbsud(xmm1, xmm2, xmm3); vpdpbsud(ymm1, ymm2, ptr [rax]); vpdpbsuds(xmm1, xmm2, xmm3); vpdpbsuds(ymm1, ymm2, ptr [rax]); vpdpbuud(xmm1, xmm2, xmm3); vpdpbuud(ymm1, ymm2, ptr [rax]); vpdpbuuds(xmm1, xmm2, xmm3); vpdpbuuds(ymm1, ymm2, ptr [rax]); vpdpwsud(xmm1, xmm2, xmm3); vpdpwsud(ymm1, ymm2, ptr [rax]); vpdpwsuds(xmm1, xmm2, xmm3); vpdpwsuds(ymm1, ymm2, ptr [rax]); vpdpwusd(xmm1, xmm2, xmm3); vpdpwusd(ymm1, ymm2, ptr [rax]); vpdpwusds(xmm1, xmm2, xmm3); vpdpwusds(ymm1, ymm2, ptr [rax]); vpdpwuud(xmm1, xmm2, xmm3); vpdpwuud(ymm1, ymm2, ptr [rax]); vpdpwuuds(xmm1, xmm2, xmm3); vpdpwuuds(ymm1, ymm2, ptr [rax]); ``` -------------------------------- ### Install C++ Standard Library Source: https://github.com/herumi/xbyak/blob/master/sample/readme.md Install the required C++ standard library development headers on Linux systems. ```bash sudo apt-get install libstdc++-dev ``` -------------------------------- ### Install Pthreads Development Headers Source: https://github.com/herumi/xbyak/blob/master/sample/readme.md Install pthreads development headers on Linux if undefined reference errors occur during linking. ```bash sudo apt-get install libpthread-stubs0-dev ``` -------------------------------- ### Configure CMake with custom options Source: https://github.com/herumi/xbyak/blob/master/sample/readme.md Example of passing build-time configuration flags to CMake. ```bash # Example with options cmake -DBUILD_32BIT_TARGETS=ON -DBUILD_PROFILER_VTUNE=ON .. ``` -------------------------------- ### Dot Product Instructions Source: https://github.com/herumi/xbyak/blob/master/test/dataset/old.txt Examples of vpdpbusd, vpdpbusds, and vpdpwssd instructions for dot product operations. ```Assembly vpdpbusd(xmm5|k3|T_z, xmm20, ptr [rax + 0x40]); vpdpbusd(ymm5|k3|T_z, ymm20, ptr [rax + 0x40]); vpdpbusd(zmm5|k3|T_z, zmm20, ptr [rax + 0x40]); vpdpbusd(xmm5|k3|T_z, xmm20, ptr_b [rax + 0x40]); vpdpbusd(ymm5|k3|T_z, ymm20, ptr_b [rax + 0x40]); vpdpbusd(zmm5|k3|T_z, zmm20, ptr_b [rax + 0x40]); vpdpbusds(xmm5|k3|T_z, xmm20, ptr [rax + 0x40]); vpdpbusds(ymm5|k3|T_z, ymm20, ptr [rax + 0x40]); vpdpbusds(zmm5|k3|T_z, zmm20, ptr [rax + 0x40]); vpdpbusds(xmm5|k3|T_z, xmm20, ptr_b [rax + 0x40]); vpdpbusds(ymm5|k3|T_z, ymm20, ptr_b [rax + 0x40]); vpdpbusds(zmm5|k3|T_z, zmm20, ptr_b [rax + 0x40]); vpdpwssd(xmm5|k3|T_z, xmm20, ptr [rax + 0x40]); vpdpwssd(ymm5|k3|T_z, ymm20, ptr [rax + 0x40]); vpdpwssd(zmm5|k3|T_z, zmm20, ptr [rax + 0x40]); ``` -------------------------------- ### BF16 Conversion and Dot Product Source: https://github.com/herumi/xbyak/blob/master/test/dataset/old.txt Examples of BFloat16 conversion and dot product instructions. ```cpp vcvtne2ps2bf16(xmm0 | k1, xmm1, ptr [rax + 64]); vcvtne2ps2bf16(ymm0 | k1 | T_z, ymm0, ptr [rax + 64]); vcvtne2ps2bf16(zmm0 | k1, zmm1, ptr [rax + 64]); vcvtneps2bf16(xmm0, xword [rax + 64]); vcvtneps2bf16(xmm0 | k1, yword [rax + 64]); vcvtneps2bf16(ymm0 | k1, zword [rax + 64]); vcvtneps2bf16(ymm0 | k1, ptr [rax + 64]); vdpbf16ps(xmm0 | k1, xmm1, ptr [rax + 64]); vdpbf16ps(ymm0 | k1, ymm1, ptr [rax + 64]); vdpbf16ps(zmm0 | k1, zmm1, ptr [rax + 64]); ``` -------------------------------- ### Comparison and Exchange Instructions Source: https://github.com/herumi/xbyak/blob/master/test/dataset/old.txt Examples of various cmp*xadd instructions. ```assembly cmpbexadd(ptr[rax+r10*4], rcx, rdx); cmpbxadd(ptr[rax+r10*4], rcx, rdx); cmplexadd(ptr[rax+r10*4], rcx, rdx); cmplxadd(ptr[rax+r10*4], rcx, rdx); cmpnbexadd(ptr[rax+r10*4], rcx, rdx); cmpnbxadd(ptr[rax+r10*4], rcx, rdx); cmpnlexadd(ptr[rax+r10*4], rcx, rdx); cmpnlxadd(ptr[rax+r10*4], rcx, rdx); cmpnoxadd(ptr[rax+r10*4], rcx, rdx); cmpnpxadd(ptr[rax+r10*4], rcx, rdx); cmpnsxadd(ptr[rax+r10*4], rcx, rdx); cmpnzxadd(ptr[rax+r10*4], rcx, rdx); cmpoxadd(ptr[rax+r10*4], rcx, rdx); cmppxadd(ptr[rax+r10*4], rcx, rdx); cmpsxadd(ptr[rax+r10*4], rcx, rdx); cmpzxadd(ptr[rax+r10*4], rcx, rdx); ``` -------------------------------- ### Vector Compression Source: https://github.com/herumi/xbyak/blob/master/test/dataset/old.txt Examples of vpcompressb and vpcompressw instructions for compressing vector data. ```Assembly vpcompressb(ptr[rax + 64], xmm1); vpcompressb(xmm30 | k5, xmm1); vpcompressb(ptr[rax + 64], ymm1); vpcompressb(ymm30 | k3 |T_z, ymm1); vpcompressb(ptr[rax + 64], zmm1); vpcompressb(zmm30 | k2 |T_z, zmm1); vpcompressw(ptr[rax + 64], xmm1); vpcompressw(xmm30 | k5, xmm1); vpcompressw(ptr[rax + 64], ymm1); vpcompressw(ymm30 | k3 |T_z, ymm1); vpcompressw(ptr[rax + 64], zmm1); vpcompressw(zmm30 | k2 |T_z, zmm1); ``` -------------------------------- ### Floating Point Conversion Instructions Source: https://github.com/herumi/xbyak/blob/master/test/dataset/old.txt Examples of vcvtps2ph, vcvtsh2usi, vcvttsh2si, vcvttsh2usi, and vcvttph2qq instructions. ```assembly vcvtps2ph(xmm1, xmm2, 0x1); vcvtps2ph(ptr [rax+0x40], xmm2, 0x2); vcvtps2ph(xmm1, ymm2, 0x3); vcvtps2ph(ptr [rax+0x40], ymm2, 0x4); vcvtps2ph(xmm1|k1|T_z, xmm2, 0x5); vcvtps2ph(ptr [rax+0x40]|k1, xmm3, 0x6); vcvtps2ph(xmm1|k2, ymm4, 0x7); vcvtps2ph(ptr [rax+0x40]|k2, ymm5, 0x8); vcvtps2ph(ymm1|k2|T_sae, zmm5, 0x9); vcvtps2ph(ptr [rax+0x40]|k5, zmm4, 0xa); vcvtsh2usi(ecx|T_rd_sae, xmm1); vcvtsh2usi(eax, ptr [rax+0x40]); vcvtsh2usi(r9|T_rd_sae, xmm1); vcvtsh2usi(r13, ptr [rax+0x40]); vcvttsh2si(ecx|T_sae, xmm1); vcvttsh2si(eax, ptr [rax+0x40]); vcvttsh2si(r9|T_sae, xmm1); vcvttsh2si(r13, ptr [rax+0x40]); vcvttsh2usi(ecx|T_sae, xmm1); vcvttsh2usi(eax, ptr [rax+0x40]); vcvttsh2usi(r9|T_sae, xmm1); vcvttsh2usi(r13, ptr [rax+0x40]); vcvttph2qq(xmm1, xmm5); vcvttph2qq(xmm1, ptr [rax+0x40]); vcvttph2qq(xmm1, ptr_b [rax+0x40]); vcvttph2qq(ymm1|k2|T_z, xmm5); vcvttph2qq(ymm1, ptr [rax+0x40]); vcvttph2qq(ymm1, ptr_b [rax+0x40]); vcvttph2qq(zmm1|k5|T_z|T_sae, xmm3); vcvttph2qq(zmm1|k5|T_z, ptr [rax+0x40]); vcvttph2qq(zmm1|k5|T_z, ptr_b [rax+0x40]); ``` -------------------------------- ### Cryptographic Instructions Source: https://github.com/herumi/xbyak/blob/master/test/dataset/old.txt Examples of SHA512, SM3, and SM4 cryptographic instructions. ```assembly vsha512msg1(ymm3, xmm5); vsha512msg2(ymm9, ymm10); vsha512rnds2(ymm1, ymm3, xmm2); vsm3msg1(xmm1, xmm2, xmm3); vsm3msg1(xmm1, xmm2, ptr [rax]); vsm3msg2(xmm5, xmm7, xmm3); vsm3msg2(xmm5, xmm6, ptr [rax]); vsm3rnds2(xmm5, xmm7, xmm3, 0x12); vsm3rnds2(xmm5, xmm7, ptr [rcx], 0x34); vsm4key4(xmm1, xmm2, xmm3); vsm4key4(xmm1, xmm2, ptr [rdx]); vsm4rnds4(xmm1, xmm2, xmm3); vsm4rnds4(xmm5, xmm6, ptr [rcx+rax*4]); ``` -------------------------------- ### Stack Operations Source: https://github.com/herumi/xbyak/blob/master/test/dataset/misc.txt Examples of push and pop operations for various registers. ```cpp push(rax); push(rcx); push(rdx); push(rbx); push(rsp); push(rbp); push(rsi); push(rdi); push(r8); push(r9); push(r10); push(r11); push(r12); push(r13); push(r14); push(r15); push(r16); push(r17); push(r18); push(r19); push(r20); push(r21); push(r22); push(r23); push(r24); push(r25); push(r26); push(r27); push(r28); push(r29); push(r30); push(r31); pop(rax); pop(rcx); pop(rdx); pop(rbx); pop(rsp); pop(rbp); pop(rsi); pop(rdi); pop(r8); pop(r9); pop(r10); pop(r11); pop(r12); pop(r13); pop(r14); pop(r15); pop(r16); pop(r17); pop(r18); pop(r19); pop(r20); pop(r21); pop(r22); pop(r23); pop(r24); pop(r25); pop(r26); pop(r27); pop(r28); pop(r29); pop(r30); pop(r31); ``` -------------------------------- ### Scalar Conversion Instructions Source: https://github.com/herumi/xbyak/blob/master/test/dataset/old.txt Examples of vcvtsi2sh and vcvtusi2sh instructions. ```assembly vcvtsi2sh(xmm1|T_rd_sae, xmm2, eax); vcvtsi2sh(xmm1, xmm2, dword [rax+0x40]); vcvtsi2sh(xmm1|T_rd_sae, xmm2, r9); vcvtsi2sh(xmm1, xmm2, qword [rax+0x40]); vcvtusi2sh(xmm1|T_rd_sae, xmm2, eax); vcvtusi2sh(xmm1, xmm2, dword [rax+0x40]); vcvtusi2sh(xmm1|T_rd_sae, xmm2, r9); vcvtusi2sh(xmm1, xmm2, qword [rax+0x40]); ``` -------------------------------- ### Configure Include Directories Source: https://github.com/herumi/xbyak/blob/master/CMakeLists.txt Sets up include paths for both build and installation environments using generator expressions. ```cmake target_include_directories( ${PROJECT_NAME} INTERFACE "$" "$" ) ``` -------------------------------- ### Vector Shift Instructions Source: https://github.com/herumi/xbyak/blob/master/test/dataset/old.txt Examples of vpshld and vpshrd instructions for shifting vector elements. ```Assembly vpshldw(xmm5|k3|T_z, xmm2, ptr [rax + 0x40], 5); vpshldw(ymm5|k3|T_z, ymm2, ptr [rax + 0x40], 5); vpshldw(zmm5|k3|T_z, zmm2, ptr [rax + 0x40], 5); vpshldd(xmm5|k3|T_z, xmm2, ptr [rax + 0x40], 5); vpshldd(ymm5|k3|T_z, ymm2, ptr [rax + 0x40], 5); vpshldd(zmm5|k3|T_z, zmm2, ptr [rax + 0x40], 5); vpshldq(xmm5|k3|T_z, xmm2, ptr [rax + 0x40], 5); vpshldq(ymm5|k3|T_z, ymm2, ptr [rax + 0x40], 5); vpshldq(zmm5|k3|T_z, zmm2, ptr [rax + 0x40], 5); vpshldvw(xmm5|k3|T_z, xmm2, ptr [rax + 0x40]); vpshldvw(ymm5|k3|T_z, ymm2, ptr [rax + 0x40]); vpshldvw(zmm5|k3|T_z, zmm2, ptr [rax + 0x40]); vpshldvd(xmm5|k3|T_z, xmm2, ptr [rax + 0x40]); vpshldvd(ymm5|k3|T_z, ymm2, ptr [rax + 0x40]); vpshldvd(zmm5|k3|T_z, zmm2, ptr [rax + 0x40]); vpshldvq(xmm5|k3|T_z, xmm2, ptr [rax + 0x40]); vpshldvq(ymm5|k3|T_z, ymm2, ptr [rax + 0x40]); vpshldvq(zmm5|k3|T_z, zmm2, ptr [rax + 0x40]); vpshrdw(xmm5|k3|T_z, xmm2, ptr [rax + 0x40], 5); vpshrdw(ymm5|k3|T_z, ymm2, ptr [rax + 0x40], 5); vpshrdw(zmm5|k3|T_z, zmm2, ptr [rax + 0x40], 5); vpshrdd(xmm5|k3|T_z, xmm2, ptr [rax + 0x40], 5); vpshrdd(ymm5|k3|T_z, ymm2, ptr [rax + 0x40], 5); vpshrdd(zmm5|k3|T_z, zmm2, ptr [rax + 0x40], 5); vpshrdq(xmm5|k3|T_z, xmm2, ptr [rax + 0x40], 5); vpshrdq(ymm5|k3|T_z, ymm2, ptr [rax + 0x40], 5); vpshrdq(zmm5|k3|T_z, zmm2, ptr [rax + 0x40], 5); vpshrdvw(xmm5|k3|T_z, xmm2, ptr [rax + 0x40]); vpshrdvw(ymm5|k3|T_z, ymm2, ptr [rax + 0x40]); vpshrdvw(zmm5|k3|T_z, zmm2, ptr [rax + 0x40]); vpshrdvd(xmm5|k3|T_z, xmm2, ptr [rax + 0x40]); vpshrdvd(ymm5|k3|T_z, ymm2, ptr [rax + 0x40]); vpshrdvd(zmm5|k3|T_z, zmm2, ptr [rax + 0x40]); vpshrdvq(xmm5|k3|T_z, xmm2, ptr [rax + 0x40]); vpshrdvq(ymm5|k3|T_z, ymm2, ptr [rax + 0x40]); vpshrdvq(zmm5|k3|T_z, zmm2, ptr [rax + 0x40]); vpshrdd(xmm5|k3|T_z, xmm2, ptr_b [rax + 0x40], 5); vpshrdd(ymm5|k3|T_z, ymm2, ptr_b [rax + 0x40], 5); vpshrdd(zmm5|k3|T_z, zmm2, ptr_b [rax + 0x40], 5); vpshrdq(xmm5|k3|T_z, xmm2, ptr_b [rax + 0x40], 5); vpshrdq(ymm5|k3|T_z, ymm2, ptr_b [rax + 0x40], 5); vpshrdq(zmm5|k3|T_z, zmm2, ptr_b [rax + 0x40], 5); vpshrdvd(xmm5|k3|T_z, xmm2, ptr_b [rax + 0x40]); vpshrdvd(ymm5|k3|T_z, ymm2, ptr_b [rax + 0x40]); vpshrdvd(zmm5|k3|T_z, zmm2, ptr_b [rax + 0x40]); vpshrdvq(xmm5|k3|T_z, xmm2, ptr_b [rax + 0x40]); vpshrdvq(ymm5|k3|T_z, ymm2, ptr_b [rax + 0x40]); vpshrdvq(zmm5|k3|T_z, zmm2, ptr_b [rax + 0x40]); ``` -------------------------------- ### Atomic Arithmetic and Logical Instructions Source: https://github.com/herumi/xbyak/blob/master/test/dataset/old.txt Examples of atomic add, and, or, and xor operations. ```assembly aadd(ptr[rax], ecx); aadd(ptr[eax], ecx); aadd(ptr[rax], r10); aand(ptr[rax], ecx); aand(ptr[eax], ecx); aand(ptr[rax], r10); aor(ptr[rax], ecx); aor(ptr[eax], ecx); aor(ptr[rax], r10); axor(ptr[rax], ecx); axor(ptr[eax], ecx); axor(ptr[rax], r10); ``` -------------------------------- ### Population Count Instructions Source: https://github.com/herumi/xbyak/blob/master/test/dataset/old.txt Examples of vpopcnt instructions for counting set bits in vector elements. ```Assembly vpopcntb(xmm5|k3|T_z, ptr [rax + 0x40]); vpopcntb(ymm5|k3|T_z, ptr [rax + 0x40]); vpopcntb(zmm5|k3|T_z, ptr [rax + 0x40]); vpopcntw(xmm5|k3|T_z, ptr [rax + 0x40]); vpopcntw(ymm5|k3|T_z, ptr [rax + 0x40]); vpopcntw(zmm5|k3|T_z, ptr [rax + 0x40]); vpopcntd(xmm5|k3|T_z, ptr [rax + 0x40]); vpopcntd(ymm5|k3|T_z, ptr [rax + 0x40]); vpopcntd(zmm5|k3|T_z, ptr [rax + 0x40]); vpopcntd(xmm5|k3|T_z, ptr_b [rax + 0x40]); vpopcntd(ymm5|k3|T_z, ptr_b [rax + 0x40]); vpopcntd(zmm5|k3|T_z, ptr_b [rax + 0x40]); vpopcntq(xmm5|k3|T_z, ptr [rax + 0x40]); vpopcntq(ymm5|k3|T_z, ptr [rax + 0x40]); vpopcntq(zmm5|k3|T_z, ptr [rax + 0x40]); vpopcntq(xmm5|k3|T_z, ptr_b [rax + 0x40]); vpopcntq(ymm5|k3|T_z, ptr_b [rax + 0x40]); vpopcntq(zmm5|k3|T_z, ptr_b [rax + 0x40]); ``` -------------------------------- ### Implement StackFrame in CodeGenerator Source: https://github.com/herumi/xbyak/blob/master/doc/usage.md Examples demonstrating the use of StackFrame for managing function parameters, temporary registers, and local stack space. ```cpp struct Code : Xbyak::CodeGenerator { Code() { // int func(int a, int b); StackFrame sf(this, 2, 1); // 2 params, 1 temp mov(sf.t[0], sf.p[0]); add(sf.t[0], sf.p[1]); mov(rax, sf.t[0]); } }; ``` ```cpp struct Code : Xbyak::CodeGenerator { Code() { // use rcx explicitly and 3 temps with local stack StackFrame sf(this, 0, 3 | UseRCX, 32); mov(rcx, ptr[rsp]); mov(sf.t[0], rcx); } }; ``` -------------------------------- ### AVX10 and VNNI Instructions Source: https://github.com/herumi/xbyak/blob/master/test/dataset/misc.txt Examples of AVX10 integer, FP16 VNNI, and media instructions using various register widths and memory operands. ```cpp vdpphps(xm1, xm2, xm3); vdpphps(xm1, xm2, ptr[rax+64]); vdpphps(xm1, xm2, ptr_b[rax+64]); vdpphps(ym1, ym2, ym3); vdpphps(ym1, ym2, ptr[rax+64]); vdpphps(ym1, ym2, ptr_b[rax+64]); vdpphps(zm1, zm2, zm3); vdpphps(zm1, zm2, ptr[rax+64]); vdpphps(zm1, zm2, ptr_b[rax+64]); ``` ```cpp vmpsadbw(xm1, xm3, xm15, 3); vmpsadbw(xm1|T_z, xm4, ptr[rax+64], 5); vmpsadbw(ym1|k4, ym3, ym15, 3); vmpsadbw(ym1, ym4, ptr[rax+64], 5); vmpsadbw(zm1|k4, zm3, zm15, 3); vmpsadbw(zm1, zm4, ptr[rax+64], 5); ``` ```cpp vpdpbssd(xm1, xm2, xm3); vpdpbssd(xm1, xm2, ptr[rax+64]); vpdpbssd(xm1, xm2, ptr_b[rax+64]); vpdpbssd(ym1, ym2, ym3); vpdpbssd(ym1, ym2, ptr[rax+64]); vpdpbssd(ym1, ym2, ptr_b[rax+64]); vpdpbssd(zm1, zm2, zm3); vpdpbssd(zm1, zm2, ptr[rax+64]); vpdpbssd(zm1, zm2, ptr_b[rax+64]); ``` ```cpp vpdpbssds(xm1, xm2, xm3); vpdpbssds(xm1, xm2, ptr[rax+64]); vpdpbssds(xm1, xm2, ptr_b[rax+64]); vpdpbssds(ym1, ym2, ym3); vpdpbssds(ym1, ym2, ptr[rax+64]); vpdpbssds(ym1, ym2, ptr_b[rax+64]); vpdpbssds(zm1, zm2, zm3); vpdpbssds(zm1, zm2, ptr[rax+64]); vpdpbssds(zm1, zm2, ptr_b[rax+64]); ``` ```cpp vpdpbsud(xm1, xm2, xm3); vpdpbsud(xm1, xm2, ptr[rax+64]); vpdpbsud(xm1, xm2, ptr_b[rax+64]); vpdpbsud(ym1, ym2, ym3); vpdpbsud(ym1, ym2, ptr[rax+64]); vpdpbsud(ym1, ym2, ptr_b[rax+64]); vpdpbsud(zm1, zm2, zm3); vpdpbsud(zm1, zm2, ptr[rax+64]); vpdpbsud(zm1, zm2, ptr_b[rax+64]); ``` ```cpp vpdpbsuds(xm1, xm2, xm3); vpdpbsuds(xm1, xm2, ptr[rax+64]); vpdpbsuds(xm1, xm2, ptr_b[rax+64]); vpdpbsuds(ym1, ym2, ym3); vpdpbsuds(ym1, ym2, ptr[rax+64]); vpdpbsuds(ym1, ym2, ptr_b[rax+64]); vpdpbsuds(zm1, zm2, zm3); vpdpbsuds(zm1, zm2, ptr[rax+64]); vpdpbsuds(zm1, zm2, ptr_b[rax+64]); ``` ```cpp vpdpbuud(xm1, xm2, xm3); vpdpbuud(xm1, xm2, ptr[rax+64]); vpdpbuud(xm1, xm2, ptr_b[rax+64]); vpdpbuud(ym1, ym2, ym3); vpdpbuud(ym1, ym2, ptr[rax+64]); vpdpbuud(ym1, ym2, ptr_b[rax+64]); vpdpbuud(zm1, zm2, zm3); vpdpbuud(zm1, zm2, ptr[rax+64]); vpdpbuud(zm1, zm2, ptr_b[rax+64]); ``` ```cpp vpdpbuuds(xm1, xm2, xm3); vpdpbuuds(xm1, xm2, ptr[rax+64]); vpdpbuuds(xm1, xm2, ptr_b[rax+64]); vpdpbuuds(ym1, ym2, ym3); vpdpbuuds(ym1, ym2, ptr[rax+64]); vpdpbuuds(ym1, ym2, ptr_b[rax+64]); vpdpbuuds(zm1, zm2, zm3); vpdpbuuds(zm1, zm2, ptr[rax+64]); vpdpbuuds(zm1, zm2, ptr_b[rax+64]); ``` ```cpp vpdpwsud(xm1, xm2, xm3); vpdpwsud(xm1, xm2, ptr[rax+64]); vpdpwsud(xm1, xm2, ptr_b[rax+64]); vpdpwsud(ym1, ym2, ym3); vpdpwsud(ym1, ym2, ptr[rax+64]); vpdpwsud(ym1, ym2, ptr_b[rax+64]); vpdpwsud(zm1, zm2, zm3); vpdpwsud(zm1, zm2, ptr[rax+64]); vpdpwsud(zm1, zm2, ptr_b[rax+64]); ``` ```cpp vpdpwsuds(xm1, xm2, xm3); vpdpwsuds(xm1, xm2, ptr[rax+64]); vpdpwsuds(xm1, xm2, ptr_b[rax+64]); vpdpwsuds(ym1, ym2, ym3); vpdpwsuds(ym1, ym2, ptr[rax+64]); vpdpwsuds(ym1, ym2, ptr_b[rax+64]); vpdpwsuds(zm1, zm2, zm3); vpdpwsuds(zm1, zm2, ptr[rax+64]); vpdpwsuds(zm1, zm2, ptr_b[rax+64]); ``` ```cpp vpdpwsud(xm1, xm2, xm3); vpdpwsud(xm1, xm2, ptr[rax+64]); vpdpwsud(xm1, xm2, ptr_b[rax+64]); vpdpwsud(ym1, ym2, ym3); vpdpwsud(ym1, ym2, ptr[rax+64]); vpdpwsud(ym1, ym2, ptr_b[rax+64]); vpdpwsud(zm1, zm2, zm3); vpdpwsud(zm1, zm2, ptr[rax+64]); vpdpwsud(zm1, zm2, ptr_b[rax+64]); ``` ```cpp vpdpwsuds(xm1, xm2, xm3); vpdpwsuds(xm1, xm2, ptr[rax+64]); vpdpwsuds(xm1, xm2, ptr_b[rax+64]); vpdpwsuds(ym1, ym2, ym3); vpdpwsuds(ym1, ym2, ptr[rax+64]); vpdpwsuds(ym1, ym2, ptr_b[rax+64]); vpdpwsuds(zm1, zm2, zm3); vpdpwsuds(zm1, zm2, ptr[rax+64]); vpdpwsuds(zm1, zm2, ptr_b[rax+64]); ``` ```cpp vpdpwuud(xm1, xm2, xm3); vpdpwuud(xm1, xm2, ptr[rax+64]); vpdpwuud(xm1, xm2, ptr_b[rax+64]); vpdpwuud(ym1, ym2, ym3); vpdpwuud(ym1, ym2, ptr[rax+64]); vpdpwuud(ym1, ym2, ptr_b[rax+64]); vpdpwuud(zm1, zm2, zm3); vpdpwuud(zm1, zm2, ptr[rax+64]); vpdpwuud(zm1, zm2, ptr_b[rax+64]); ``` ```cpp vpdpwuuds(xm1, xm2, xm3); vpdpwuuds(xm1, xm2, ptr[rax+64]); vpdpwuuds(xm1, xm2, ptr_b[rax+64]); vpdpwuuds(ym1, ym2, ym3); vpdpwuuds(ym1, ym2, ptr[rax+64]); vpdpwuuds(ym1, ym2, ptr_b[rax+64]); vpdpwuuds(zm1, zm2, zm3); vpdpwuuds(zm1, zm2, ptr[rax+64]); vpdpwuuds(zm1, zm2, ptr_b[rax+64]); ``` -------------------------------- ### Configure Boost Path for CMake Source: https://github.com/herumi/xbyak/blob/master/sample/readme.md Manually specify the Boost installation directory if CMake fails to detect it automatically. ```bash cmake -DBOOST_ROOT=/path/to/boost .. ``` -------------------------------- ### AES Instructions Source: https://github.com/herumi/xbyak/blob/master/test/dataset/old.txt Examples of AES encryption and decryption instructions using XMM, YMM, and ZMM registers. ```Assembly vaesdec(xmm20, xmm30, ptr [rcx + 64]); vaesdec(ymm1, ymm2, ptr [rcx + 64]); vaesdec(zmm1, zmm2, ptr [rcx + 64]); vaesdeclast(xmm20, xmm30, ptr [rax + 64]); vaesdeclast(ymm20, ymm30, ptr [rax + 64]); vaesdeclast(zmm20, zmm30, ptr [rax + 64]); vaesenc(xmm20, xmm30, ptr [rcx + 64]); vaesenc(ymm1, ymm2, ptr [rcx + 64]); vaesenc(zmm1, zmm2, ptr [rcx + 64]); vaesenclast(xmm20, xmm30, ptr [rax + 64]); vaesenclast(ymm20, ymm30, ptr [rax + 64]); vaesenclast(zmm20, zmm30, ptr [rax + 64]); ``` -------------------------------- ### AVX-512 Arithmetic Instructions Source: https://github.com/herumi/xbyak/blob/master/test/dataset/old.txt Examples of fused multiply-add and related arithmetic operations using Xbyak syntax. ```assembly vfmadd132ph(zmm1, zmm2, ptr_b [rax+0x40]); vfmadd132ph(zmm1|T_rd_sae, zmm2, zmm5); vfmsub231ph(xmm1, xmm2, ptr [rax+0x40]); vfmsub231ph(xmm1, xmm2, ptr_b [rax+0x40]); vfmsub231ph(ymm1, ymm2, ptr [rax+0x40]); vfmsub231ph(ymm1, ymm2, ptr_b [rax+0x40]); vfmsub231ph(zmm1, zmm2, ptr [rax+0x40]); vfmsub231ph(zmm1, zmm2, ptr_b [rax+0x40]); vfmsub231ph(zmm1|T_rd_sae, zmm2, zmm5); vfnmsub231ph(xmm1, xmm2, ptr [rax+0x40]); vfnmsub231ph(ymm1, ymm2, ptr_b [rax+0x40]); vfnmsub231ph(zmm1, zmm2, ptr_b [rax+0x40]); vfnmsub231ph(zmm1|T_rd_sae, zmm2, zmm5); vfmadd132sh(xmm1|k1|T_z|T_rd_sae, xmm2, xmm3); vfmadd132sh(xmm1, xmm2, ptr [rax+0x40]); vfnmadd132sh(xmm1|k1|T_z|T_rd_sae, xmm2, xmm3); vfnmadd132sh(xmm1, xmm2, ptr [rax+0x40]); vfmsub132sh(xmm1|k1|T_z|T_rd_sae, xmm2, xmm3); vfmsub132sh(xmm1, xmm2, ptr [rax+0x40]); vfnmsub132sh(xmm1|k1|T_z|T_rd_sae, xmm2, xmm3); vfnmsub132sh(xmm1, xmm2, ptr [rax+0x40]); ``` -------------------------------- ### Data Movement Instructions Source: https://github.com/herumi/xbyak/blob/master/test/dataset/misc.txt Examples of vmovd and vmovw instructions for moving data between registers and memory. ```cpp vmovd(xm10, xm20); vmovd(xm1, xm2); vmovd(xm10, ptr[rax+64]); vmovd(ptr[rax+64], xm30); ``` ```cpp vmovw(xm1, xm20); vmovw(xm1, xm2); vmovw(xm3, ptr [rax+0x40]); vmovw(ptr [rax+0x40], xm7); ``` -------------------------------- ### APX Instruction Examples Source: https://github.com/herumi/xbyak/blob/master/doc/usage.md Examples of using APX registers, three-operand instructions, and status flag suppression. ```cpp add(r20, r21); lea(r30, ptr[r29+r31]); add(r20, r21, r23); add(r20, ptr[rax + rcx * 8 + 0x1234], r23); add(r20|T_nf, r21, r23); imul(ax|T_zu, cx, 0x1234); imul(ax|T_zu|T_nf, cx, 0x1234); setb(r31b|T_zu); ``` -------------------------------- ### Execute sample binaries Source: https://github.com/herumi/xbyak/blob/master/sample/readme.md Platform-specific commands to run compiled sample executables. ```bash .\bin\Release\test_util64.exe .\bin\Release\test64.exe .\bin\Release\bf64.exe ``` ```bash ./bin/test_util64 ./bin/test64 ./bin/bf64 ``` -------------------------------- ### Build Xbyak samples with CMake Source: https://github.com/herumi/xbyak/blob/master/sample/readme.md Standard sequence for creating a build directory and compiling the project in Release mode. ```bash mkdir build cd build cmake .. cmake --build . --config Release ``` -------------------------------- ### Build Xbyak with Make Source: https://github.com/herumi/xbyak/blob/master/sample/readme.md Use standard make commands to build all targets, specific test targets, or clean the build directory on Linux and macOS. ```bash # Build all targets make # Build specific target make test64 make bf64 make test_util64 # Clean make clean ``` -------------------------------- ### Carry-less Multiplication Source: https://github.com/herumi/xbyak/blob/master/test/dataset/old.txt Examples of the vpclmulqdq instruction for carry-less multiplication. ```Assembly vpclmulqdq(xmm2, xmm3, ptr [rax + 64], 3); vpclmulqdq(ymm2, ymm3, ptr [rax + 64], 3); vpclmulqdq(zmm2, zmm3, ptr [rax + 64], 3); vpclmulqdq(xmm20, xmm3, ptr [rax + 64], 3); vpclmulqdq(ymm20, ymm3, ptr [rax + 64], 3); vpclmulqdq(zmm20, zmm3, ptr [rax + 64], 3); ``` -------------------------------- ### Print build configuration summary Source: https://github.com/herumi/xbyak/blob/master/sample/CMakeLists.txt Outputs the current build environment settings and status to the console. ```cmake message(STATUS "Xbyak Samples Configuration:") message(STATUS " Build type: ${CMAKE_BUILD_TYPE}") message(STATUS " Architecture: ${CMAKE_SIZEOF_VOID_P} bytes (${CMAKE_SIZEOF_VOID_P} * 8 = ${CMAKE_SYSTEM_PROCESSOR})") message(STATUS " Boost found: ${Boost_FOUND}") message(STATUS " Output directory: ${CMAKE_BINARY_DIR}/bin") ``` -------------------------------- ### Tile Configuration Instructions Source: https://github.com/herumi/xbyak/blob/master/test/dataset/amx.txt Instructions for loading and storing the tile configuration state. ```cpp ldtilecfg(ptr[rax + rcx * 4 + 64]); ldtilecfg(ptr [r30+r29*4+0x12]); ldtilecfg(ptr [rax]); sttilecfg(ptr[rsp + rax * 8 + 64]); sttilecfg(ptr [r30+r29*4+0x12]); sttilecfg(ptr [r30]); ``` -------------------------------- ### Configure 32-bit targets on Linux Source: https://github.com/herumi/xbyak/blob/master/sample/readme.md Prerequisites and configuration flags for building 32-bit binaries on 64-bit Linux systems. ```bash # Install multilib (Ubuntu/Debian) sudo apt-get install gcc-multilib g++-multilib # Configure with 32-bit targets enabled cmake -DBUILD_32BIT_TARGETS=ON .. cmake --build . --config Release ``` -------------------------------- ### Configure instruction encoding preferences Source: https://github.com/herumi/xbyak/blob/master/doc/usage.md Demonstrates how to specify encoding types for instructions like vpdpbusd and vmpsadbw, and how to update global defaults. ```cpp vpdpbusd(xm0, xm1, xm2); // default encoding: EVEX (AVX512-VNNI) vpdpbusd(xm0, xm1, xm2, EvexEncoding); // same as the above vpdpbusd(xm0, xm1, xm2, VexEncoding); // VEX (AVX-VNNI) setDefaultEncoding(VexEncoding); // change default encoding vpdpbusd(xm0, xm1, xm2); // VEX vmpsadbw(xm1, xm3, xm15, 3); // default encoding: AVX vmpsadbw(xm1, xm3, xm15, 3, PreAVX10v2Encoding); // same as the above vmpsadbw(xm1, xm3, xm15, 3, AVX10v2Encoding); // AVX10.2 setDefaultEncodingAVX10(AVX10v2Encoding); // change default encoding vmpsadbw(xm1, xm3, xm15, 3); // AVX10.2 ``` -------------------------------- ### Define Project and Interface Library Source: https://github.com/herumi/xbyak/blob/master/CMakeLists.txt Initializes the project and creates an interface library to handle header-only distribution. ```cmake cmake_minimum_required(VERSION 3.10) project(xbyak LANGUAGES CXX VERSION 7.37.4) file(GLOB headers xbyak/*.h) include(GNUInstallDirs) add_library(${PROJECT_NAME} INTERFACE) add_library(${PROJECT_NAME}::${PROJECT_NAME} ALIAS ${PROJECT_NAME}) ```