Statistics
| Branch: | Revision:

## root / tests / tcg / test-i386.h @ c09015dd

History | View | Annotate | Download (3.4 kB)

1 2 3 d57c4e01 bellard d57c4e01 bellard ```#define exec_op glue(exec_, OP) ``` 776f2227 bellard ```#define exec_opq glue(glue(exec_, OP), q) ``` d57c4e01 bellard ```#define exec_opl glue(glue(exec_, OP), l) ``` d57c4e01 bellard ```#define exec_opw glue(glue(exec_, OP), w) ``` d57c4e01 bellard ```#define exec_opb glue(glue(exec_, OP), b) ``` d57c4e01 bellard 776f2227 bellard ```#define EXECOP2(size, rsize, res, s1, flags) \ ``` d57c4e01 bellard ``` asm ("push %4\n\t"\ ``` d57c4e01 bellard ``` "popf\n\t"\ ``` 776f2227 bellard ``` stringify(OP) size " %" rsize "2, %" rsize "0\n\t" \ ``` d57c4e01 bellard ``` "pushf\n\t"\ ``` 776f2227 bellard ``` "pop %1\n\t"\ ``` d57c4e01 bellard ``` : "=q" (res), "=g" (flags)\ ``` 776f2227 bellard ``` : "q" (s1), "0" (res), "1" (flags)); \ ``` 776f2227 bellard ``` printf("%-10s A=" FMTLX " B=" FMTLX " R=" FMTLX " CCIN=%04lx CC=%04lx\n", \ ``` 776f2227 bellard ``` stringify(OP) size, s0, s1, res, iflags, flags & CC_MASK); ``` d57c4e01 bellard 776f2227 bellard ```#define EXECOP1(size, rsize, res, flags) \ ``` d57c4e01 bellard ``` asm ("push %3\n\t"\ ``` d57c4e01 bellard ``` "popf\n\t"\ ``` 776f2227 bellard ``` stringify(OP) size " %" rsize "0\n\t" \ ``` d57c4e01 bellard ``` "pushf\n\t"\ ``` 776f2227 bellard ``` "pop %1\n\t"\ ``` d57c4e01 bellard ``` : "=q" (res), "=g" (flags)\ ``` 776f2227 bellard ``` : "0" (res), "1" (flags)); \ ``` 776f2227 bellard ``` printf("%-10s A=" FMTLX " R=" FMTLX " CCIN=%04lx CC=%04lx\n", \ ``` 776f2227 bellard ``` stringify(OP) size, s0, res, iflags, flags & CC_MASK); ``` d57c4e01 bellard d57c4e01 bellard ```#ifdef OP1 ``` 776f2227 bellard ```#if defined(__x86_64__) ``` 776f2227 bellard ```void exec_opq(long s0, long s1, long iflags) ``` d57c4e01 bellard ```{ ``` 776f2227 bellard ``` long res, flags; ``` d57c4e01 bellard ``` res = s0; ``` d57c4e01 bellard ``` flags = iflags; ``` 776f2227 bellard ``` EXECOP1("q", "", res, flags); ``` d57c4e01 bellard ```} ``` 776f2227 bellard ```#endif ``` d57c4e01 bellard 776f2227 bellard ```void exec_opl(long s0, long s1, long iflags) ``` d57c4e01 bellard ```{ ``` 776f2227 bellard ``` long res, flags; ``` d57c4e01 bellard ``` res = s0; ``` d57c4e01 bellard ``` flags = iflags; ``` 776f2227 bellard ``` EXECOP1("l", "k", res, flags); ``` d57c4e01 bellard ```} ``` d57c4e01 bellard 776f2227 bellard ```void exec_opw(long s0, long s1, long iflags) ``` d57c4e01 bellard ```{ ``` 776f2227 bellard ``` long res, flags; ``` d57c4e01 bellard ``` res = s0; ``` d57c4e01 bellard ``` flags = iflags; ``` 776f2227 bellard ``` EXECOP1("w", "w", res, flags); ``` 776f2227 bellard ```} ``` 776f2227 bellard 776f2227 bellard ```void exec_opb(long s0, long s1, long iflags) ``` 776f2227 bellard ```{ ``` 776f2227 bellard ``` long res, flags; ``` 776f2227 bellard ``` res = s0; ``` 776f2227 bellard ``` flags = iflags; ``` 776f2227 bellard ``` EXECOP1("b", "b", res, flags); ``` d57c4e01 bellard ```} ``` d57c4e01 bellard ```#else ``` 776f2227 bellard ```#if defined(__x86_64__) ``` 776f2227 bellard ```void exec_opq(long s0, long s1, long iflags) ``` 776f2227 bellard ```{ ``` 776f2227 bellard ``` long res, flags; ``` 776f2227 bellard ``` res = s0; ``` 776f2227 bellard ``` flags = iflags; ``` 776f2227 bellard ``` EXECOP2("q", "", res, s1, flags); ``` 776f2227 bellard ```} ``` 776f2227 bellard ```#endif ``` 776f2227 bellard 776f2227 bellard ```void exec_opl(long s0, long s1, long iflags) ``` d57c4e01 bellard ```{ ``` 776f2227 bellard ``` long res, flags; ``` d57c4e01 bellard ``` res = s0; ``` d57c4e01 bellard ``` flags = iflags; ``` 776f2227 bellard ``` EXECOP2("l", "k", res, s1, flags); ``` d57c4e01 bellard ```} ``` d57c4e01 bellard 776f2227 bellard ```void exec_opw(long s0, long s1, long iflags) ``` d57c4e01 bellard ```{ ``` 776f2227 bellard ``` long res, flags; ``` d57c4e01 bellard ``` res = s0; ``` d57c4e01 bellard ``` flags = iflags; ``` 776f2227 bellard ``` EXECOP2("w", "w", res, s1, flags); ``` d57c4e01 bellard ```} ``` d57c4e01 bellard 776f2227 bellard ```void exec_opb(long s0, long s1, long iflags) ``` d57c4e01 bellard ```{ ``` 776f2227 bellard ``` long res, flags; ``` d57c4e01 bellard ``` res = s0; ``` d57c4e01 bellard ``` flags = iflags; ``` 776f2227 bellard ``` EXECOP2("b", "b", res, s1, flags); ``` d57c4e01 bellard ```} ``` d57c4e01 bellard ```#endif ``` d57c4e01 bellard 776f2227 bellard ```void exec_op(long s0, long s1) ``` d57c4e01 bellard ```{ ``` 776f2227 bellard ``` s0 = i2l(s0); ``` 776f2227 bellard ``` s1 = i2l(s1); ``` 776f2227 bellard ```#if defined(__x86_64__) ``` 776f2227 bellard ``` exec_opq(s0, s1, 0); ``` 776f2227 bellard ```#endif ``` d57c4e01 bellard ``` exec_opl(s0, s1, 0); ``` d57c4e01 bellard ``` exec_opw(s0, s1, 0); ``` d57c4e01 bellard ``` exec_opb(s0, s1, 0); ``` d57c4e01 bellard ```#ifdef OP_CC ``` 776f2227 bellard ```#if defined(__x86_64__) ``` 776f2227 bellard ``` exec_opq(s0, s1, CC_C); ``` 776f2227 bellard ```#endif ``` d57c4e01 bellard ``` exec_opl(s0, s1, CC_C); ``` d57c4e01 bellard ``` exec_opw(s0, s1, CC_C); ``` d57c4e01 bellard ``` exec_opb(s0, s1, CC_C); ``` d57c4e01 bellard ```#endif ``` d57c4e01 bellard ```} ``` d57c4e01 bellard d57c4e01 bellard ```void glue(test_, OP)(void) ``` d57c4e01 bellard ```{ ``` d57c4e01 bellard ``` exec_op(0x12345678, 0x812FADA); ``` d57c4e01 bellard ``` exec_op(0x12341, 0x12341); ``` d57c4e01 bellard ``` exec_op(0x12341, -0x12341); ``` d57c4e01 bellard ``` exec_op(0xffffffff, 0); ``` d57c4e01 bellard ``` exec_op(0xffffffff, -1); ``` d57c4e01 bellard ``` exec_op(0xffffffff, 1); ``` d57c4e01 bellard ``` exec_op(0xffffffff, 2); ``` d57c4e01 bellard ``` exec_op(0x7fffffff, 0); ``` d57c4e01 bellard ``` exec_op(0x7fffffff, 1); ``` d57c4e01 bellard ``` exec_op(0x7fffffff, -1); ``` d57c4e01 bellard ``` exec_op(0x80000000, -1); ``` d57c4e01 bellard ``` exec_op(0x80000000, 1); ``` d57c4e01 bellard ``` exec_op(0x80000000, -2); ``` d57c4e01 bellard ``` exec_op(0x12347fff, 0); ``` d57c4e01 bellard ``` exec_op(0x12347fff, 1); ``` d57c4e01 bellard ``` exec_op(0x12347fff, -1); ``` d57c4e01 bellard ``` exec_op(0x12348000, -1); ``` d57c4e01 bellard ``` exec_op(0x12348000, 1); ``` d57c4e01 bellard ``` exec_op(0x12348000, -2); ``` d57c4e01 bellard ``` exec_op(0x12347f7f, 0); ``` d57c4e01 bellard ``` exec_op(0x12347f7f, 1); ``` d57c4e01 bellard ``` exec_op(0x12347f7f, -1); ``` d57c4e01 bellard ``` exec_op(0x12348080, -1); ``` d57c4e01 bellard ``` exec_op(0x12348080, 1); ``` d57c4e01 bellard ``` exec_op(0x12348080, -2); ``` d57c4e01 bellard ```} ``` d57c4e01 bellard d57c4e01 bellard ```void *glue(_test_, OP) __init_call = glue(test_, OP); ``` d57c4e01 bellard d57c4e01 bellard ```#undef OP ``` d57c4e01 bellard `#undef OP_CC`