mirror of
https://git.suyu.dev/suyu/dynarmic.git
synced 2026-01-04 21:55:06 +01:00
Squashed 'externals/xbyak/' changes from 73ac5866..0140eeff
0140eeff Merge branch 'dev' 1efe14b2 change the original behavior of SetError 83c89c7a rename and fix indent 8be7ca93 Merge branch 'sbogusev-master' into dev 070b4c09 make l_err() inline with block scope static TLS l_error 9a4e6579 v5.97 d0ced1bc XBYAK_ONLY_CLASS_CPU is for only util::Cpu bb967ae7 replace uint32 with uint32_t etc. c306b8e5 update to v5.95 605e4224 use noexcept if C++11 or later 7a17c2c8 remove warning 5dfa4462 use constexpr if c++14 or later 18c9caaa Merge branch 'densamoilov-fix-mov-interface' into dev 3966ba9d fix mov interface be492be1 change the behavior of push((byte|word), imm) to cast imm to int8_t/int16_t d9696b54 Merge pull request #102 from igorsafo/master ea73267f Cpu: make getNumCores constant ff0b10e9 Merge pull request #101 from densamoilov/use-thread_local-when-supported 0c4eafc3 use thread_local for XBYAK_TLS when supported c1aea35e CodeGenerator::reset() calls ClearError() b4df97b1 Merge branch 'cursey-no-winsock2-header' 6a47bb0e v5.94 9a1749e6 define WIN32_LEAN_AND_MEAN for including winsock2.h after xbyak.h 42dddb74 Remove #include <winsock2.h> 615b85fa update doc 9cd796a9 rename XBYAK_NOEXCEPTION to XBYAK_NO_EXCEPTION 7cdf227f use static to avoid multiple instance 38a28dec test_nm.bat supports noexcept 0fdffc6b XBYAK_NOEXCEPTION for -fno-exceptions eda6e2a3 v5.92 5c26c8bb mov(rax, imm64) on 32-bit env with XBYAK64 6208e3ae throw exception if not supported amx sibmem 2 c6737d14 mov amx insts from avx512 34ea5c16 throw exception if not supported amx sibmem 6f93fe35 fix test of sizeof(Operand) 5b89c3b2 remove T_TMM 5ce32858 gen_amx.cpp is merged into gen_avx512.cpp fe4f965f remove my alias for tmm registers 92f904d8 bit_ contains 8192 98b51da9 extend mnemonics with Intel(R) AMX ISA 8d1b4c9e add generation of Intel(R) AMX ISA mnemonics 8ded45d1 add support of Intel(R) AMX ISA b23c4b02 v5.912 ffe32a60 Merge branch 'rsdubtso-master' e7b7fd2f use MAP_JIT on macOS regardless of Xcode version 82b70e66 v5.911 ; XBYAK_USE_MMAP_ALLOCATOR is defined 2f6d9e34 fix test for mac a7d10a1e add link to GitHub Sponsor 96076265 accept k0 mask register (it means no mask) 7e3167e4 kmov{b,w,d,q} throws for unsupported reg f487d7b7 Merge pull request #91 from marcelotrevisani/patch-1 dc9e6a79 Possibility to specify a different PREFIX 5fc69fc8 remove warning of test e69e0b42 fix typo of type of Zmi 34f797e8 perf does not recognize too short function name 6cc0f4df Consider max defined as a macro on Windows 5722393d fix for zeroed-out 0xb leaf 6a4459a8 Merge branch 'tyfkda-feature/fix-segfault-in-calc' 47922ed9 Fix segmentation fault in calc sample 8f696e93 add test_avx512 to bat 00114d79 add .travis.yml a29fa27b refactor test 508b543c fix error of vfpclasspd 0d54f1b1 fix for windows 4da8fd4e add setDefaultJmpNEAR da7f7317 revert to the behavior before v5.84 if -fno-operator-names is defined 7dac9f61 update to v5.85 fe639332 enable MAP_JIT only if mojave or later 4443d791 specify MAP_JIT mmap flag on macOS 20ee4c2d update doc ca0e8395 [changed] XBYAK_NO_OP_NAMES is defined f32836da remove exit(1) a1e9adf2 v5.82 08b8b1ba Support AMD Zen New Instructions. 2501ba9a remove *.user and *.vcproj 5c2ea988 Merge branch 'jrmwng-feature/upgrade-to-vs2017/jrmwng' 35847f7a Merge branch 'feature/upgrade-to-vs2017/jrmwng' of https://github.com/jrmwng/xbyak into jrmwng-feature/upgrade-to-vs2017/jrmwng ef267775 address "warning LNK4075: ignoring '/EDITANDCONTINUE' due to '/SAFESEH' specification" 4a6c59bb address a conflict of sharing intermediate directory by different projects 9577cbf3 inherit "some output locations" from parent or project defaults 6c5f7186 upgrade projects from VS2018 to VS2017 4ca0434b v5.81 72b4e95d add lds/lss/les/lfs/lgs cc8f037c fix ; move ERR_INTERNAL to the end 9e9ec1c3 add repe, repne, repne, prez eea0edc3 add some fpu mnemonics 06235fa6 add loop/loope/loopne 7fc0c2bb add enter/leave 9fa2ef3c add in_, out_ df208648 add lods{b,w,d,q}, outs{b,w,d} 4672d2cb add int3, int_, into 431977cb add pushfq, popfq 81c4749f syscall, sysenter, sysexit, sysret 1f1b53c4 add clflushopt, fldenv, fnstw b765db33 Profiler uses append mode 44dc3546 add Profiler class 42949334 update version to v5.802 91cb919b Merge branch 'vpirogov-master' a6452f82 fixed avx512_bf16 detection f41da5aa tweak ; vcvtneps2bf16 calls opCvt2 b12460ba [sample] fix typo of quantize.cpp b22f5881 add set_opt.bat for test on Windows f402faad add vp2intersectd/vp2intersectq 4cfd5208 add avx512_bf16 4033564c fix vcmppd/vcmpps for ptr_b git-subtree-dir: externals/xbyak git-subtree-split: 0140eeff1fffcf5069dea3abb57095695320971c
This commit is contained in:
parent
76768f9083
commit
8042dc93e8
48 changed files with 3852 additions and 3816 deletions
340
test/make_nm.cpp
340
test/make_nm.cpp
|
|
@ -1,5 +1,4 @@
|
|||
#include <stdio.h>
|
||||
#define XBYAK_NO_OP_NAMES
|
||||
#include "xbyak/xbyak.h"
|
||||
#include "xbyak/xbyak_bin2hex.h"
|
||||
#include <stdlib.h>
|
||||
|
|
@ -11,111 +10,111 @@ using namespace Xbyak;
|
|||
|
||||
const int bitEnd = 64;
|
||||
|
||||
const uint64 MMX = 1ULL << 0;
|
||||
const uint64 _XMM = 1ULL << 1;
|
||||
const uint64 _MEM = 1ULL << 2;
|
||||
const uint64 _REG32 = 1ULL << 3;
|
||||
const uint64 EAX = 1ULL << 4;
|
||||
const uint64 IMM32 = 1ULL << 5;
|
||||
const uint64 IMM8 = 1ULL << 6;
|
||||
const uint64 _REG8 = 1ULL << 7;
|
||||
const uint64 _REG16 = 1ULL << 8;
|
||||
const uint64 NEG8 = 1ULL << 9;
|
||||
const uint64 IMM16 = 1ULL << 10;
|
||||
const uint64 NEG16 = 1ULL << 11;
|
||||
const uint64 AX = 1ULL << 12;
|
||||
const uint64 AL = 1ULL << 13;
|
||||
const uint64 IMM_1 = 1ULL << 14;
|
||||
const uint64 MEM8 = 1ULL << 15;
|
||||
const uint64 MEM16 = 1ULL << 16;
|
||||
const uint64 MEM32 = 1ULL << 17;
|
||||
const uint64 ONE = 1ULL << 19;
|
||||
const uint64 CL = 1ULL << 20;
|
||||
const uint64 MEM_ONLY_DISP = 1ULL << 21;
|
||||
const uint64 NEG32 = 1ULL << 23;
|
||||
const uint64 _YMM = 1ULL << 24;
|
||||
const uint64 VM32X_32 = 1ULL << 39;
|
||||
const uint64 VM32X_64 = 1ULL << 40;
|
||||
const uint64 VM32Y_32 = 1ULL << 41;
|
||||
const uint64 VM32Y_64 = 1ULL << 42;
|
||||
const uint64_t MMX = 1ULL << 0;
|
||||
const uint64_t _XMM = 1ULL << 1;
|
||||
const uint64_t _MEM = 1ULL << 2;
|
||||
const uint64_t _REG32 = 1ULL << 3;
|
||||
const uint64_t EAX = 1ULL << 4;
|
||||
const uint64_t IMM32 = 1ULL << 5;
|
||||
const uint64_t IMM8 = 1ULL << 6;
|
||||
const uint64_t _REG8 = 1ULL << 7;
|
||||
const uint64_t _REG16 = 1ULL << 8;
|
||||
const uint64_t NEG8 = 1ULL << 9;
|
||||
const uint64_t IMM16 = 1ULL << 10;
|
||||
const uint64_t NEG16 = 1ULL << 11;
|
||||
const uint64_t AX = 1ULL << 12;
|
||||
const uint64_t AL = 1ULL << 13;
|
||||
const uint64_t IMM_1 = 1ULL << 14;
|
||||
const uint64_t MEM8 = 1ULL << 15;
|
||||
const uint64_t MEM16 = 1ULL << 16;
|
||||
const uint64_t MEM32 = 1ULL << 17;
|
||||
const uint64_t ONE = 1ULL << 19;
|
||||
const uint64_t CL = 1ULL << 20;
|
||||
const uint64_t MEM_ONLY_DISP = 1ULL << 21;
|
||||
const uint64_t NEG32 = 1ULL << 23;
|
||||
const uint64_t _YMM = 1ULL << 24;
|
||||
const uint64_t VM32X_32 = 1ULL << 39;
|
||||
const uint64_t VM32X_64 = 1ULL << 40;
|
||||
const uint64_t VM32Y_32 = 1ULL << 41;
|
||||
const uint64_t VM32Y_64 = 1ULL << 42;
|
||||
#ifdef XBYAK64
|
||||
const uint64 _MEMe = 1ULL << 25;
|
||||
const uint64 REG32_2 = 1ULL << 26; // r8d, ...
|
||||
const uint64 REG16_2 = 1ULL << 27; // r8w, ...
|
||||
const uint64 REG8_2 = 1ULL << 28; // r8b, ...
|
||||
const uint64 REG8_3 = 1ULL << 29; // spl, ...
|
||||
const uint64 _REG64 = 1ULL << 30; // rax, ...
|
||||
const uint64 _REG64_2 = 1ULL << 31; // r8, ...
|
||||
const uint64 RAX = 1ULL << 32;
|
||||
const uint64 _XMM2 = 1ULL << 33;
|
||||
const uint64 _YMM2 = 1ULL << 34;
|
||||
const uint64 VM32X = VM32X_32 | VM32X_64;
|
||||
const uint64 VM32Y = VM32Y_32 | VM32Y_64;
|
||||
const uint64_t _MEMe = 1ULL << 25;
|
||||
const uint64_t REG32_2 = 1ULL << 26; // r8d, ...
|
||||
const uint64_t REG16_2 = 1ULL << 27; // r8w, ...
|
||||
const uint64_t REG8_2 = 1ULL << 28; // r8b, ...
|
||||
const uint64_t REG8_3 = 1ULL << 29; // spl, ...
|
||||
const uint64_t _REG64 = 1ULL << 30; // rax, ...
|
||||
const uint64_t _REG64_2 = 1ULL << 31; // r8, ...
|
||||
const uint64_t RAX = 1ULL << 32;
|
||||
const uint64_t _XMM2 = 1ULL << 33;
|
||||
const uint64_t _YMM2 = 1ULL << 34;
|
||||
const uint64_t VM32X = VM32X_32 | VM32X_64;
|
||||
const uint64_t VM32Y = VM32Y_32 | VM32Y_64;
|
||||
#else
|
||||
const uint64 _MEMe = 0;
|
||||
const uint64 REG32_2 = 0;
|
||||
const uint64 REG16_2 = 0;
|
||||
const uint64 REG8_2 = 0;
|
||||
const uint64 REG8_3 = 0;
|
||||
const uint64 _REG64 = 0;
|
||||
const uint64 _REG64_2 = 0;
|
||||
const uint64 RAX = 0;
|
||||
const uint64 _XMM2 = 0;
|
||||
const uint64 _YMM2 = 0;
|
||||
const uint64 VM32X = VM32X_32;
|
||||
const uint64 VM32Y = VM32Y_32;
|
||||
const uint64_t _MEMe = 0;
|
||||
const uint64_t REG32_2 = 0;
|
||||
const uint64_t REG16_2 = 0;
|
||||
const uint64_t REG8_2 = 0;
|
||||
const uint64_t REG8_3 = 0;
|
||||
const uint64_t _REG64 = 0;
|
||||
const uint64_t _REG64_2 = 0;
|
||||
const uint64_t RAX = 0;
|
||||
const uint64_t _XMM2 = 0;
|
||||
const uint64_t _YMM2 = 0;
|
||||
const uint64_t VM32X = VM32X_32;
|
||||
const uint64_t VM32Y = VM32Y_32;
|
||||
#endif
|
||||
const uint64 REG64 = _REG64 | _REG64_2 | RAX;
|
||||
const uint64 REG32 = _REG32 | REG32_2 | EAX;
|
||||
const uint64 REG16 = _REG16 | REG16_2 | AX;
|
||||
const uint64 REG32e = REG32 | REG64;
|
||||
const uint64 REG8 = _REG8 | REG8_2|AL;
|
||||
const uint64 MEM = _MEM | _MEMe;
|
||||
const uint64 MEM64 = 1ULL << 35;
|
||||
const uint64 ST0 = 1ULL << 36;
|
||||
const uint64 STi = 1ULL << 37;
|
||||
const uint64 IMM_2 = 1ULL << 38;
|
||||
const uint64 IMM = IMM_1 | IMM_2;
|
||||
const uint64 XMM = _XMM | _XMM2;
|
||||
const uint64 YMM = _YMM | _YMM2;
|
||||
const uint64 K = 1ULL << 43;
|
||||
const uint64 _ZMM = 1ULL << 44;
|
||||
const uint64 _ZMM2 = 1ULL << 45;
|
||||
const uint64_t REG64 = _REG64 | _REG64_2 | RAX;
|
||||
const uint64_t REG32 = _REG32 | REG32_2 | EAX;
|
||||
const uint64_t REG16 = _REG16 | REG16_2 | AX;
|
||||
const uint64_t REG32e = REG32 | REG64;
|
||||
const uint64_t REG8 = _REG8 | REG8_2|AL;
|
||||
const uint64_t MEM = _MEM | _MEMe;
|
||||
const uint64_t MEM64 = 1ULL << 35;
|
||||
const uint64_t ST0 = 1ULL << 36;
|
||||
const uint64_t STi = 1ULL << 37;
|
||||
const uint64_t IMM_2 = 1ULL << 38;
|
||||
const uint64_t IMM = IMM_1 | IMM_2;
|
||||
const uint64_t XMM = _XMM | _XMM2;
|
||||
const uint64_t YMM = _YMM | _YMM2;
|
||||
const uint64_t K = 1ULL << 43;
|
||||
const uint64_t _ZMM = 1ULL << 44;
|
||||
const uint64_t _ZMM2 = 1ULL << 45;
|
||||
#ifdef XBYAK64
|
||||
const uint64 ZMM = _ZMM | _ZMM2;
|
||||
const uint64 _YMM3 = 1ULL << 46;
|
||||
const uint64_t ZMM = _ZMM | _ZMM2;
|
||||
const uint64_t _YMM3 = 1ULL << 46;
|
||||
#else
|
||||
const uint64 ZMM = _ZMM;
|
||||
const uint64 _YMM3 = 0;
|
||||
const uint64_t ZMM = _ZMM;
|
||||
const uint64_t _YMM3 = 0;
|
||||
#endif
|
||||
const uint64 K2 = 1ULL << 47;
|
||||
const uint64 ZMM_SAE = 1ULL << 48;
|
||||
const uint64 ZMM_ER = 1ULL << 49;
|
||||
const uint64_t K2 = 1ULL << 47;
|
||||
const uint64_t ZMM_SAE = 1ULL << 48;
|
||||
const uint64_t ZMM_ER = 1ULL << 49;
|
||||
#ifdef XBYAK64
|
||||
const uint64 _XMM3 = 1ULL << 50;
|
||||
const uint64_t _XMM3 = 1ULL << 50;
|
||||
#endif
|
||||
const uint64 XMM_SAE = 1ULL << 51;
|
||||
const uint64_t XMM_SAE = 1ULL << 51;
|
||||
#ifdef XBYAK64
|
||||
const uint64 XMM_KZ = 1ULL << 52;
|
||||
const uint64 YMM_KZ = 1ULL << 53;
|
||||
const uint64 ZMM_KZ = 1ULL << 54;
|
||||
const uint64_t XMM_KZ = 1ULL << 52;
|
||||
const uint64_t YMM_KZ = 1ULL << 53;
|
||||
const uint64_t ZMM_KZ = 1ULL << 54;
|
||||
#else
|
||||
const uint64 XMM_KZ = 0;
|
||||
const uint64 YMM_KZ = 0;
|
||||
const uint64 ZMM_KZ = 0;
|
||||
const uint64_t XMM_KZ = 0;
|
||||
const uint64_t YMM_KZ = 0;
|
||||
const uint64_t ZMM_KZ = 0;
|
||||
#endif
|
||||
const uint64 MEM_K = 1ULL << 55;
|
||||
const uint64 M_1to2 = 1ULL << 56;
|
||||
const uint64 M_1to4 = 1ULL << 57;
|
||||
const uint64 M_1to8 = 1ULL << 58;
|
||||
const uint64 M_1to16 = 1ULL << 59;
|
||||
const uint64 XMM_ER = 1ULL << 60;
|
||||
const uint64 M_xword = 1ULL << 61;
|
||||
const uint64 M_yword = 1ULL << 62;
|
||||
const uint64 MY_1to4 = 1ULL << 18;
|
||||
const uint64 BNDREG = 1ULL << 22;
|
||||
const uint64_t MEM_K = 1ULL << 55;
|
||||
const uint64_t M_1to2 = 1ULL << 56;
|
||||
const uint64_t M_1to4 = 1ULL << 57;
|
||||
const uint64_t M_1to8 = 1ULL << 58;
|
||||
const uint64_t M_1to16 = 1ULL << 59;
|
||||
const uint64_t XMM_ER = 1ULL << 60;
|
||||
const uint64_t M_xword = 1ULL << 61;
|
||||
const uint64_t M_yword = 1ULL << 62;
|
||||
const uint64_t MY_1to4 = 1ULL << 18;
|
||||
const uint64_t BNDREG = 1ULL << 22;
|
||||
|
||||
const uint64 NOPARA = 1ULL << (bitEnd - 1);
|
||||
const uint64_t NOPARA = 1ULL << (bitEnd - 1);
|
||||
|
||||
class Test {
|
||||
Test(const Test&);
|
||||
|
|
@ -132,7 +131,7 @@ class Test {
|
|||
}
|
||||
|
||||
// check all op1, op2, op3
|
||||
void put(const std::string& nm, uint64 op1 = NOPARA, uint64 op2 = NOPARA, uint64 op3 = NOPARA, uint64 op4 = NOPARA) const
|
||||
void put(const std::string& nm, uint64_t op1 = NOPARA, uint64_t op2 = NOPARA, uint64_t op3 = NOPARA, uint64_t op4 = NOPARA) const
|
||||
{
|
||||
for (int i = 0; i < bitEnd; i++) {
|
||||
if ((op1 & (1ULL << i)) == 0) continue;
|
||||
|
|
@ -155,7 +154,7 @@ class Test {
|
|||
}
|
||||
}
|
||||
}
|
||||
void put(const char *nm, uint64 op, const char *xbyak, const char *nasm) const
|
||||
void put(const char *nm, uint64_t op, const char *xbyak, const char *nasm) const
|
||||
{
|
||||
for (int i = 0; i < bitEnd; i++) {
|
||||
if ((op & (1ULL << i)) == 0) continue;
|
||||
|
|
@ -167,7 +166,7 @@ class Test {
|
|||
printf("\n");
|
||||
}
|
||||
}
|
||||
void put(const char *nm, const char *xbyak, const char *nasm = 0, uint64 op = NOPARA) const
|
||||
void put(const char *nm, const char *xbyak, const char *nasm = 0, uint64_t op = NOPARA) const
|
||||
{
|
||||
if (nasm == 0) nasm = xbyak;
|
||||
for (int i = 0; i < bitEnd; i++) {
|
||||
|
|
@ -180,7 +179,7 @@ class Test {
|
|||
printf("\n");
|
||||
}
|
||||
}
|
||||
const char *get(uint64 type) const
|
||||
const char *get(uint64_t type) const
|
||||
{
|
||||
int idx = (rand() / 31) & 7;
|
||||
if (type == ST0) {
|
||||
|
|
@ -460,8 +459,14 @@ class Test {
|
|||
"cqo",
|
||||
"cmpsq",
|
||||
"movsq",
|
||||
"popfq",
|
||||
"pushfq",
|
||||
"lodsq",
|
||||
"movsq",
|
||||
"scasq",
|
||||
"stosq",
|
||||
"syscall",
|
||||
"sysret",
|
||||
#else
|
||||
"aaa",
|
||||
"aad",
|
||||
|
|
@ -469,6 +474,7 @@ class Test {
|
|||
"aas",
|
||||
"daa",
|
||||
"das",
|
||||
"into",
|
||||
"popad",
|
||||
"popfd",
|
||||
"pusha",
|
||||
|
|
@ -493,9 +499,17 @@ class Test {
|
|||
"cmpsb",
|
||||
"cmpsw",
|
||||
"cmpsd",
|
||||
"int3",
|
||||
"leave",
|
||||
"lodsb",
|
||||
"lodsw",
|
||||
"lodsd",
|
||||
"movsb",
|
||||
"movsw",
|
||||
"movsd",
|
||||
"outsb",
|
||||
"outsw",
|
||||
"outsd",
|
||||
"scasb",
|
||||
"scasw",
|
||||
"scasd",
|
||||
|
|
@ -508,6 +522,8 @@ class Test {
|
|||
"stc",
|
||||
"std",
|
||||
"sti",
|
||||
"sysenter",
|
||||
"sysexit",
|
||||
|
||||
"emms",
|
||||
"pause",
|
||||
|
|
@ -540,6 +556,8 @@ class Test {
|
|||
"fabs",
|
||||
"faddp",
|
||||
"fchs",
|
||||
"fclex",
|
||||
"fnclex",
|
||||
"fcom",
|
||||
"fcomp",
|
||||
"fcompp",
|
||||
|
|
@ -579,15 +597,52 @@ class Test {
|
|||
"fxtract",
|
||||
"fyl2x",
|
||||
"fyl2xp1",
|
||||
|
||||
"monitorx",
|
||||
"mwaitx",
|
||||
"clzero",
|
||||
};
|
||||
for (size_t i = 0; i < NUM_OF_ARRAY(tbl); i++) {
|
||||
put(tbl[i]);
|
||||
}
|
||||
{
|
||||
const char memTbl[][16] = {
|
||||
"clflush",
|
||||
"clflushopt",
|
||||
"fbld",
|
||||
"fbstp",
|
||||
"fldcw",
|
||||
"fldenv",
|
||||
"frstor",
|
||||
"fsave",
|
||||
"fnsave",
|
||||
"fstcw",
|
||||
"fnstcw",
|
||||
"fstenv",
|
||||
"fnstenv",
|
||||
"fstsw",
|
||||
"fnstsw",
|
||||
"fxrstor",
|
||||
};
|
||||
for (size_t i = 0; i < NUM_OF_ARRAY(memTbl); i++) {
|
||||
put(memTbl[i], MEM);
|
||||
}
|
||||
put("fstsw", AX);
|
||||
put("fnstsw", AX);
|
||||
}
|
||||
|
||||
put("bswap", REG32e);
|
||||
put("lea", REG32e|REG16, MEM);
|
||||
put("fldcw", MEM);
|
||||
put("fstcw", MEM);
|
||||
put("enter", IMM, IMM);
|
||||
put(isXbyak_ ? "int_" : "int", IMM8);
|
||||
put(isXbyak_ ? "in_" : "in", AL|AX|EAX, IMM8);
|
||||
puts(isXbyak_ ? "in_(al, dx); dump();" : "in al, dx");
|
||||
puts(isXbyak_ ? "in_(ax, dx); dump();" : "in ax, dx");
|
||||
puts(isXbyak_ ? "in_(eax, dx); dump();" : "in eax, dx");
|
||||
put(isXbyak_ ? "out_" : "out", IMM8, AL|AX|EAX);
|
||||
puts(isXbyak_ ? "out_(dx, al); dump();" : "out dx, al");
|
||||
puts(isXbyak_ ? "out_(dx, ax); dump();" : "out dx, ax");
|
||||
puts(isXbyak_ ? "out_(dx, eax); dump();" : "out dx, eax");
|
||||
}
|
||||
void putJmp() const
|
||||
{
|
||||
|
|
@ -803,7 +858,7 @@ class Test {
|
|||
SD = 1 << 3
|
||||
};
|
||||
const struct {
|
||||
uint8 code;
|
||||
uint8_t code;
|
||||
const char *name;
|
||||
} sufTbl[] = {
|
||||
{ 0, "ps" },
|
||||
|
|
@ -812,7 +867,7 @@ class Test {
|
|||
{ 0xF2, "sd" },
|
||||
};
|
||||
static const struct XmmTbl1 {
|
||||
uint8 code;
|
||||
uint8_t code;
|
||||
int mode;
|
||||
const char *name;
|
||||
bool hasImm;
|
||||
|
|
@ -841,7 +896,7 @@ class Test {
|
|||
for (size_t j = 0; j < NUM_OF_ARRAY(sufTbl); j++) {
|
||||
if (!(p->mode & (1 << j))) continue;
|
||||
char buf[16];
|
||||
sprintf(buf, "%s%s", p->name, sufTbl[j].name);
|
||||
snprintf(buf, sizeof(buf), "%s%s", p->name, sufTbl[j].name);
|
||||
if (p->hasImm) {
|
||||
put(buf, XMM, XMM|MEM, IMM);
|
||||
} else {
|
||||
|
|
@ -891,8 +946,8 @@ class Test {
|
|||
{
|
||||
static const struct Tbl {
|
||||
const char *name;
|
||||
uint64 op1;
|
||||
uint64 op2;
|
||||
uint64_t op1;
|
||||
uint64_t op2;
|
||||
} tbl[] = {
|
||||
{ "cvtpi2ps", XMM, MMX|MEM },
|
||||
{ "cvtps2pi", MMX, XMM|MEM },
|
||||
|
|
@ -928,7 +983,9 @@ class Test {
|
|||
}
|
||||
void putCmov() const
|
||||
{
|
||||
const char tbl[][4] = {
|
||||
const struct {
|
||||
const char *s;
|
||||
} tbl[] = {
|
||||
"o",
|
||||
"no",
|
||||
"b",
|
||||
|
|
@ -961,12 +1018,12 @@ class Test {
|
|||
"g",
|
||||
};
|
||||
for (size_t i = 0; i < NUM_OF_ARRAY(tbl); i++) {
|
||||
char buf[16];
|
||||
sprintf(buf, "cmov%s", tbl[i]);
|
||||
char buf[32];
|
||||
snprintf(buf, sizeof(buf), "cmov%s", tbl[i].s);
|
||||
put(buf, REG16, REG16|MEM);
|
||||
put(buf, REG32, REG32|MEM);
|
||||
put(buf, REG64, REG64|MEM);
|
||||
sprintf(buf, "set%s", tbl[i]);
|
||||
snprintf(buf, sizeof(buf), "set%s", tbl[i].s);
|
||||
put(buf, REG8|REG8_3|MEM);
|
||||
}
|
||||
}
|
||||
|
|
@ -1088,6 +1145,33 @@ class Test {
|
|||
put("pop", REG32|MEM32);
|
||||
#endif
|
||||
}
|
||||
void putPushPop8_16() const
|
||||
{
|
||||
const struct {
|
||||
int b;
|
||||
uint32_t v;
|
||||
} tbl[] = {
|
||||
{ 8, 0x7f },
|
||||
{ 8, 0x80 },
|
||||
{ 8, 0xff },
|
||||
{ 8, 0x100 },
|
||||
{ 8, 0x12345 },
|
||||
{ 16, 0x7fff },
|
||||
{ 16, 0x8000 },
|
||||
{ 16, 0xffff },
|
||||
{ 16, 0x10000 },
|
||||
{ 16, 0x12345 },
|
||||
};
|
||||
for (size_t i = 0; i < NUM_OF_ARRAY(tbl); i++) {
|
||||
const char *b = tbl[i].b == 8 ? "byte" : "word";
|
||||
uint32_t v = tbl[i].v;
|
||||
if (isXbyak_) {
|
||||
printf("push(%s, 0x%x);dump();\n", b, v);
|
||||
} else {
|
||||
printf("push %s 0x%x\n", b, v);
|
||||
}
|
||||
}
|
||||
}
|
||||
void putTest() const
|
||||
{
|
||||
const char *p = "test";
|
||||
|
|
@ -1121,6 +1205,30 @@ class Test {
|
|||
put("mov", REG64, tbl[i].a, tbl[i].b);
|
||||
}
|
||||
}
|
||||
void putLoadSeg() const
|
||||
{
|
||||
const struct Tbl {
|
||||
const char *name;
|
||||
bool support64Bit;
|
||||
} tbl[] = {
|
||||
#ifdef XBYAK32
|
||||
{ "lds", false },
|
||||
{ "les", false },
|
||||
#endif
|
||||
{ "lss", true },
|
||||
{ "lfs", true },
|
||||
{ "lgs", true },
|
||||
};
|
||||
for (size_t i = 0; i < NUM_OF_ARRAY(tbl); i++) {
|
||||
const Tbl *p = &tbl[i];
|
||||
put(p->name, REG16|REG32, MEM);
|
||||
#ifdef XBYAK64
|
||||
if (p->support64Bit) {
|
||||
put(p->name, REG64, MEM);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
}
|
||||
// only nasm
|
||||
void putMovImm64() const
|
||||
{
|
||||
|
|
@ -1176,6 +1284,7 @@ class Test {
|
|||
put("cmpxchg8b", MEM);
|
||||
#ifdef XBYAK64
|
||||
put("cmpxchg16b", MEM);
|
||||
put("fxrstor64", MEM);
|
||||
#endif
|
||||
{
|
||||
const char tbl[][8] = {
|
||||
|
|
@ -1384,9 +1493,9 @@ class Test {
|
|||
void putMPX() const
|
||||
{
|
||||
#ifdef XBYAK64
|
||||
const uint64 reg = REG64;
|
||||
const uint64_t reg = REG64;
|
||||
#else
|
||||
const uint64 reg = REG32;
|
||||
const uint64_t reg = REG32;
|
||||
#endif
|
||||
put("bndcl", BNDREG, reg|MEM);
|
||||
put("bndcu", BNDREG, reg|MEM);
|
||||
|
|
@ -2414,6 +2523,7 @@ public:
|
|||
separateFunc();
|
||||
putSSE4_2();
|
||||
putSeg(); // same behavior as yasm for mov rax, cx
|
||||
putPushPop8_16();
|
||||
#else
|
||||
putSIMPLE();
|
||||
putReg1();
|
||||
|
|
@ -2423,6 +2533,7 @@ public:
|
|||
putPushPop();
|
||||
putTest();
|
||||
separateFunc();
|
||||
putLoadSeg();
|
||||
putEtc();
|
||||
putShift();
|
||||
putShxd();
|
||||
|
|
@ -2447,7 +2558,6 @@ public:
|
|||
putFpuMem32_64();
|
||||
separateFunc();
|
||||
putFpuMem16_32_64();
|
||||
put("clflush", MEM); // current nasm is ok
|
||||
putFpu();
|
||||
putFpuFpu();
|
||||
putCmp();
|
||||
|
|
@ -2546,7 +2656,7 @@ public:
|
|||
printf("vaddpd(%s%s%s, %s, %s%s); dump();\n", r1, pk, pz, r2, r3, saeTblXbyak[sae]);
|
||||
} else {
|
||||
if (kIdx) CYBOZU_SNPRINTF(pk, sizeof(pk), "{k%d}", kIdx);
|
||||
if (z) pz = "{z}";
|
||||
if (z && kIdx) pz = "{z}";
|
||||
printf("vaddpd %s%s%s, %s, %s%s\n", r1, pk, pz, r2, r3, saeTblNASM[sae]);
|
||||
}
|
||||
}
|
||||
|
|
@ -2583,9 +2693,9 @@ public:
|
|||
for (size_t k = 0; k < N; k++) {
|
||||
#ifdef XBYAK64
|
||||
for (int kIdx = 0; kIdx < 8; kIdx++) {
|
||||
put_vaddpd(xTbl[i], xTbl[j], xTbl[k], kIdx);
|
||||
put_vaddpd(yTbl[i], yTbl[j], yTbl[k], kIdx);
|
||||
for (int z = 0; z < 2; z++) {
|
||||
put_vaddpd(xTbl[i], xTbl[j], xTbl[k], kIdx, z == 1);
|
||||
put_vaddpd(yTbl[i], yTbl[j], yTbl[k], kIdx, z == 1);
|
||||
for (int sae = 0; sae < 5; sae++) {
|
||||
put_vaddpd(zTbl[i], zTbl[j], zTbl[k], kIdx, z == 1, sae);
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue