Wire Sysio Wire Sysion 1.0.0
Loading...
Searching...
No Matches
cvt_test.cpp File Reference
#include <xbyak/xbyak.h>
Include dependency graph for cvt_test.cpp:

Go to the source code of this file.

Classes

struct  Ptn
 

Macros

#define verifyExp(state)
 

Functions

template<class T >
void verify (const T &x, const T &y)
 
int main ()
 

Variables

const struct Ptn tbl []
 
int errNum = 0
 
int testNum = 0
 

Macro Definition Documentation

◆ verifyExp

#define verifyExp ( state)
Value:
{ \
bool isOK = false; \
try { \
state; \
} catch (const Xbyak::Error& e) { \
if ((int)e == ERR_CANT_CONVERT) { \
isOK = true; \
} \
} \
if (!isOK) { \
printf("ERR " #state "\n"); \
errNum++; \
} \
testNum++; \
}
int errNum
Definition cvt_test.cpp:47
int testNum
Definition cvt_test.cpp:48
@ ERR_CANT_CONVERT
Definition xbyak.h:165

Definition at line 60 of file cvt_test.cpp.

60#define verifyExp(state) \
61{ \
62 bool isOK = false; \
63 try { \
64 state; \
65 } catch (const Xbyak::Error& e) { \
66 if ((int)e == ERR_CANT_CONVERT) { \
67 isOK = true; \
68 } \
69 } \
70 if (!isOK) { \
71 printf("ERR " #state "\n"); \
72 errNum++; \
73 } \
74 testNum++; \
75}

Function Documentation

◆ main()

int main ( void )

Definition at line 77 of file cvt_test.cpp.

79{
80 for (size_t i = 0; i < sizeof(tbl) / sizeof(tbl[0]); i++) {
81 if (tbl[i].reg8) {
82 verify(tbl[i].reg8->cvt8(), *tbl[i].reg8);
83 verify(tbl[i].reg8->cvt16(), tbl[i].reg16);
84 verify(tbl[i].reg8->cvt32(), tbl[i].reg32);
85 verify(tbl[i].reg16.cvt8(), *tbl[i].reg8);
86 verify(tbl[i].reg32.cvt8(), *tbl[i].reg8);
87 }
88 verify(tbl[i].reg16.cvt16(), tbl[i].reg16);
89 verify(tbl[i].reg16.cvt32(), tbl[i].reg32);
90 verify(tbl[i].reg32.cvt16(), tbl[i].reg16);
91 verify(tbl[i].reg32.cvt32(), tbl[i].reg32);
92#ifdef XBYAK64
93 if (tbl[i].reg8) {
94 verify(tbl[i].reg64.cvt8(), *tbl[i].reg8);
95 verify(tbl[i].reg8->cvt64(), tbl[i].reg64);
96 }
97 verify(tbl[i].reg64.cvt16(), tbl[i].reg16);
98 verify(tbl[i].reg64.cvt32(), tbl[i].reg32);
99 verify(tbl[i].reg64.cvt64(), tbl[i].reg64);
100 verify(tbl[i].reg16.cvt64(), tbl[i].reg64);
101 verify(tbl[i].reg32.cvt64(), tbl[i].reg64);
102#endif
103 }
104 {
105 const Reg8 errTbl[] = {
106 ah, bh, ch, dh
107 };
108 for (size_t i = 0; i < sizeof(errTbl) / sizeof(errTbl[0]); i++) {
109 verifyExp(errTbl[i].cvt16());
110 }
111 }
112#ifdef XBYAK32
113 {
114 const Reg16 errTbl[] = {
115 si, di, bp, sp
116 };
117 for (size_t i = 0; i < sizeof(errTbl) / sizeof(errTbl[0]); i++) {
118 verifyExp(errTbl[i].cvt8());
119 }
120 }
121#endif
122 printf("test=%d(err=%d)\n", testNum, errNum);
123} catch (std::exception& e) {
124 printf("ERR %s\n", e.what());
125}
#define verifyExp(state)
Definition cvt_test.cpp:60
void verify(const T &x, const T &y)
Definition cvt_test.cpp:51
const struct Ptn tbl[]
LOGGING_API void printf(Category category, const char *format,...)
Definition Logging.cpp:30
static const Reg8 ch(Operand::CH)
static const Reg8 ah(Operand::AH)
static const Reg16 di(Operand::DI)
static const Reg16 si(Operand::SI)
static const Reg8 dh(Operand::DH)
static const Reg16 sp(Operand::SP)
static const Reg8 bh(Operand::BH)
static const Reg16 bp(Operand::BP)
Here is the call graph for this function:

◆ verify()

template<class T >
void verify ( const T & x,
const T & y )

Definition at line 51 of file cvt_test.cpp.

52{
53 if (x != y) {
54 printf("ERR %s %s\n", x.toString(), y.toString());
55 errNum++;
56 }
57 testNum++;
58}
uint64_t y
Definition sha3.cpp:34
Here is the caller graph for this function:

Variable Documentation

◆ errNum

int errNum = 0

Definition at line 47 of file cvt_test.cpp.

◆ tbl

const struct Ptn tbl[]
Initial value:
= {
{ &al, ax, eax },
{ &bl, bx, ebx },
{ &cl, cx, ecx },
{ &dl, dx, edx },
{ 0, si, esi },
{ 0, di, edi },
{ 0, bp, ebp },
{ 0, sp, esp },
}
static const Reg8 dl(Operand::DL)
static const Reg32 ebp(Operand::EBP)
static const Reg32 esp(Operand::ESP)
static const Reg16 dx(Operand::DX)
static const Reg32 ecx(Operand::ECX)
static const Reg32 edi(Operand::EDI)
static const Reg32 edx(Operand::EDX)
static const Reg16 cx(Operand::CX)
static const Reg32 ebx(Operand::EBX)
static const Reg8 bl(Operand::BL)
static const Reg8 cl(Operand::CL)
static const Reg16 bx(Operand::BX)
static const Reg32 esi(Operand::ESI)

◆ testNum

int testNum = 0

Definition at line 48 of file cvt_test.cpp.