SoftFloat MMX:

Added softfloat versions of the MMX instructions while preserving the non-softfloat ones.
This commit is contained in:
TC1995
2023-07-15 00:28:39 +02:00
parent 5d07468a67
commit e676796367
7 changed files with 2481 additions and 744 deletions

View File

@@ -5,7 +5,10 @@
#define MMX_GETSRC() \ #define MMX_GETSRC() \
if (cpu_mod == 3) { \ if (cpu_mod == 3) { \
src = cpu_state.MM[cpu_rm]; \ if (fpu_softfloat) \
src = *(MMX_REG *)&fpu_state.st_space[cpu_rm].fraction; \
else \
src = cpu_state.MM[cpu_rm]; \
CLOCK_CYCLES(1); \ CLOCK_CYCLES(1); \
} else { \ } else { \
SEG_CHECK_READ(cpu_state.ea_seg); \ SEG_CHECK_READ(cpu_state.ea_seg); \

File diff suppressed because it is too large Load Diff

View File

@@ -1,217 +1,393 @@
static int static int
opPCMPEQB_a16(uint32_t fetchdat) opPCMPEQB_a16(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC(); MMX_GETSRC();
cpu_state.MM[cpu_reg].b[0] = (cpu_state.MM[cpu_reg].b[0] == src.b[0]) ? 0xff : 0; if (fpu_softfloat) {
cpu_state.MM[cpu_reg].b[1] = (cpu_state.MM[cpu_reg].b[1] == src.b[1]) ? 0xff : 0; fpu_state.tag = 0;
cpu_state.MM[cpu_reg].b[2] = (cpu_state.MM[cpu_reg].b[2] == src.b[2]) ? 0xff : 0; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
cpu_state.MM[cpu_reg].b[3] = (cpu_state.MM[cpu_reg].b[3] == src.b[3]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[4] = (cpu_state.MM[cpu_reg].b[4] == src.b[4]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[5] = (cpu_state.MM[cpu_reg].b[5] == src.b[5]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[6] = (cpu_state.MM[cpu_reg].b[6] == src.b[6]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[7] = (cpu_state.MM[cpu_reg].b[7] == src.b[7]) ? 0xff : 0;
dst.b[0] = (dst.b[0] == src.b[0]) ? 0xff : 0;
dst.b[1] = (dst.b[1] == src.b[1]) ? 0xff : 0;
dst.b[2] = (dst.b[2] == src.b[2]) ? 0xff : 0;
dst.b[3] = (dst.b[3] == src.b[3]) ? 0xff : 0;
dst.b[4] = (dst.b[4] == src.b[4]) ? 0xff : 0;
dst.b[5] = (dst.b[5] == src.b[5]) ? 0xff : 0;
dst.b[6] = (dst.b[6] == src.b[6]) ? 0xff : 0;
dst.b[7] = (dst.b[7] == src.b[7]) ? 0xff : 0;
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
cpu_state.MM[cpu_reg].b[0] = (cpu_state.MM[cpu_reg].b[0] == src.b[0]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[1] = (cpu_state.MM[cpu_reg].b[1] == src.b[1]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[2] = (cpu_state.MM[cpu_reg].b[2] == src.b[2]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[3] = (cpu_state.MM[cpu_reg].b[3] == src.b[3]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[4] = (cpu_state.MM[cpu_reg].b[4] == src.b[4]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[5] = (cpu_state.MM[cpu_reg].b[5] == src.b[5]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[6] = (cpu_state.MM[cpu_reg].b[6] == src.b[6]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[7] = (cpu_state.MM[cpu_reg].b[7] == src.b[7]) ? 0xff : 0;
}
return 0; return 0;
} }
static int static int
opPCMPEQB_a32(uint32_t fetchdat) opPCMPEQB_a32(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC(); MMX_GETSRC();
cpu_state.MM[cpu_reg].b[0] = (cpu_state.MM[cpu_reg].b[0] == src.b[0]) ? 0xff : 0; if (fpu_softfloat) {
cpu_state.MM[cpu_reg].b[1] = (cpu_state.MM[cpu_reg].b[1] == src.b[1]) ? 0xff : 0; fpu_state.tag = 0;
cpu_state.MM[cpu_reg].b[2] = (cpu_state.MM[cpu_reg].b[2] == src.b[2]) ? 0xff : 0; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
cpu_state.MM[cpu_reg].b[3] = (cpu_state.MM[cpu_reg].b[3] == src.b[3]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[4] = (cpu_state.MM[cpu_reg].b[4] == src.b[4]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[5] = (cpu_state.MM[cpu_reg].b[5] == src.b[5]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[6] = (cpu_state.MM[cpu_reg].b[6] == src.b[6]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[7] = (cpu_state.MM[cpu_reg].b[7] == src.b[7]) ? 0xff : 0;
dst.b[0] = (dst.b[0] == src.b[0]) ? 0xff : 0;
dst.b[1] = (dst.b[1] == src.b[1]) ? 0xff : 0;
dst.b[2] = (dst.b[2] == src.b[2]) ? 0xff : 0;
dst.b[3] = (dst.b[3] == src.b[3]) ? 0xff : 0;
dst.b[4] = (dst.b[4] == src.b[4]) ? 0xff : 0;
dst.b[5] = (dst.b[5] == src.b[5]) ? 0xff : 0;
dst.b[6] = (dst.b[6] == src.b[6]) ? 0xff : 0;
dst.b[7] = (dst.b[7] == src.b[7]) ? 0xff : 0;
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
cpu_state.MM[cpu_reg].b[0] = (cpu_state.MM[cpu_reg].b[0] == src.b[0]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[1] = (cpu_state.MM[cpu_reg].b[1] == src.b[1]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[2] = (cpu_state.MM[cpu_reg].b[2] == src.b[2]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[3] = (cpu_state.MM[cpu_reg].b[3] == src.b[3]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[4] = (cpu_state.MM[cpu_reg].b[4] == src.b[4]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[5] = (cpu_state.MM[cpu_reg].b[5] == src.b[5]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[6] = (cpu_state.MM[cpu_reg].b[6] == src.b[6]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[7] = (cpu_state.MM[cpu_reg].b[7] == src.b[7]) ? 0xff : 0;
}
return 0; return 0;
} }
static int static int
opPCMPGTB_a16(uint32_t fetchdat) opPCMPGTB_a16(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC(); MMX_GETSRC();
cpu_state.MM[cpu_reg].b[0] = (cpu_state.MM[cpu_reg].sb[0] > src.sb[0]) ? 0xff : 0; if (fpu_softfloat) {
cpu_state.MM[cpu_reg].b[1] = (cpu_state.MM[cpu_reg].sb[1] > src.sb[1]) ? 0xff : 0; fpu_state.tag = 0;
cpu_state.MM[cpu_reg].b[2] = (cpu_state.MM[cpu_reg].sb[2] > src.sb[2]) ? 0xff : 0; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
cpu_state.MM[cpu_reg].b[3] = (cpu_state.MM[cpu_reg].sb[3] > src.sb[3]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[4] = (cpu_state.MM[cpu_reg].sb[4] > src.sb[4]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[5] = (cpu_state.MM[cpu_reg].sb[5] > src.sb[5]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[6] = (cpu_state.MM[cpu_reg].sb[6] > src.sb[6]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[7] = (cpu_state.MM[cpu_reg].sb[7] > src.sb[7]) ? 0xff : 0;
dst.b[0] = (dst.sb[0] > src.sb[0]) ? 0xff : 0;
dst.b[1] = (dst.sb[1] > src.sb[1]) ? 0xff : 0;
dst.b[2] = (dst.sb[2] > src.sb[2]) ? 0xff : 0;
dst.b[3] = (dst.sb[3] > src.sb[3]) ? 0xff : 0;
dst.b[4] = (dst.sb[4] > src.sb[4]) ? 0xff : 0;
dst.b[5] = (dst.sb[5] > src.sb[5]) ? 0xff : 0;
dst.b[6] = (dst.sb[6] > src.sb[6]) ? 0xff : 0;
dst.b[7] = (dst.sb[7] > src.sb[7]) ? 0xff : 0;
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
cpu_state.MM[cpu_reg].b[0] = (cpu_state.MM[cpu_reg].sb[0] > src.sb[0]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[1] = (cpu_state.MM[cpu_reg].sb[1] > src.sb[1]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[2] = (cpu_state.MM[cpu_reg].sb[2] > src.sb[2]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[3] = (cpu_state.MM[cpu_reg].sb[3] > src.sb[3]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[4] = (cpu_state.MM[cpu_reg].sb[4] > src.sb[4]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[5] = (cpu_state.MM[cpu_reg].sb[5] > src.sb[5]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[6] = (cpu_state.MM[cpu_reg].sb[6] > src.sb[6]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[7] = (cpu_state.MM[cpu_reg].sb[7] > src.sb[7]) ? 0xff : 0;
}
return 0; return 0;
} }
static int static int
opPCMPGTB_a32(uint32_t fetchdat) opPCMPGTB_a32(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC(); MMX_GETSRC();
cpu_state.MM[cpu_reg].b[0] = (cpu_state.MM[cpu_reg].sb[0] > src.sb[0]) ? 0xff : 0; if (fpu_softfloat) {
cpu_state.MM[cpu_reg].b[1] = (cpu_state.MM[cpu_reg].sb[1] > src.sb[1]) ? 0xff : 0; fpu_state.tag = 0;
cpu_state.MM[cpu_reg].b[2] = (cpu_state.MM[cpu_reg].sb[2] > src.sb[2]) ? 0xff : 0; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
cpu_state.MM[cpu_reg].b[3] = (cpu_state.MM[cpu_reg].sb[3] > src.sb[3]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[4] = (cpu_state.MM[cpu_reg].sb[4] > src.sb[4]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[5] = (cpu_state.MM[cpu_reg].sb[5] > src.sb[5]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[6] = (cpu_state.MM[cpu_reg].sb[6] > src.sb[6]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[7] = (cpu_state.MM[cpu_reg].sb[7] > src.sb[7]) ? 0xff : 0;
dst.b[0] = (dst.sb[0] > src.sb[0]) ? 0xff : 0;
dst.b[1] = (dst.sb[1] > src.sb[1]) ? 0xff : 0;
dst.b[2] = (dst.sb[2] > src.sb[2]) ? 0xff : 0;
dst.b[3] = (dst.sb[3] > src.sb[3]) ? 0xff : 0;
dst.b[4] = (dst.sb[4] > src.sb[4]) ? 0xff : 0;
dst.b[5] = (dst.sb[5] > src.sb[5]) ? 0xff : 0;
dst.b[6] = (dst.sb[6] > src.sb[6]) ? 0xff : 0;
dst.b[7] = (dst.sb[7] > src.sb[7]) ? 0xff : 0;
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
cpu_state.MM[cpu_reg].b[0] = (cpu_state.MM[cpu_reg].sb[0] > src.sb[0]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[1] = (cpu_state.MM[cpu_reg].sb[1] > src.sb[1]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[2] = (cpu_state.MM[cpu_reg].sb[2] > src.sb[2]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[3] = (cpu_state.MM[cpu_reg].sb[3] > src.sb[3]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[4] = (cpu_state.MM[cpu_reg].sb[4] > src.sb[4]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[5] = (cpu_state.MM[cpu_reg].sb[5] > src.sb[5]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[6] = (cpu_state.MM[cpu_reg].sb[6] > src.sb[6]) ? 0xff : 0;
cpu_state.MM[cpu_reg].b[7] = (cpu_state.MM[cpu_reg].sb[7] > src.sb[7]) ? 0xff : 0;
}
return 0; return 0;
} }
static int static int
opPCMPEQW_a16(uint32_t fetchdat) opPCMPEQW_a16(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC(); MMX_GETSRC();
cpu_state.MM[cpu_reg].w[0] = (cpu_state.MM[cpu_reg].w[0] == src.w[0]) ? 0xffff : 0; if (fpu_softfloat) {
cpu_state.MM[cpu_reg].w[1] = (cpu_state.MM[cpu_reg].w[1] == src.w[1]) ? 0xffff : 0; fpu_state.tag = 0;
cpu_state.MM[cpu_reg].w[2] = (cpu_state.MM[cpu_reg].w[2] == src.w[2]) ? 0xffff : 0; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
cpu_state.MM[cpu_reg].w[3] = (cpu_state.MM[cpu_reg].w[3] == src.w[3]) ? 0xffff : 0;
dst.w[0] = (dst.w[0] == src.w[0]) ? 0xffff : 0;
dst.w[1] = (dst.w[1] == src.w[1]) ? 0xffff : 0;
dst.w[2] = (dst.w[2] == src.w[2]) ? 0xffff : 0;
dst.w[3] = (dst.w[3] == src.w[3]) ? 0xffff : 0;
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
cpu_state.MM[cpu_reg].w[0] = (cpu_state.MM[cpu_reg].w[0] == src.w[0]) ? 0xffff : 0;
cpu_state.MM[cpu_reg].w[1] = (cpu_state.MM[cpu_reg].w[1] == src.w[1]) ? 0xffff : 0;
cpu_state.MM[cpu_reg].w[2] = (cpu_state.MM[cpu_reg].w[2] == src.w[2]) ? 0xffff : 0;
cpu_state.MM[cpu_reg].w[3] = (cpu_state.MM[cpu_reg].w[3] == src.w[3]) ? 0xffff : 0;
}
return 0; return 0;
} }
static int static int
opPCMPEQW_a32(uint32_t fetchdat) opPCMPEQW_a32(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC(); MMX_GETSRC();
cpu_state.MM[cpu_reg].w[0] = (cpu_state.MM[cpu_reg].w[0] == src.w[0]) ? 0xffff : 0; if (fpu_softfloat) {
cpu_state.MM[cpu_reg].w[1] = (cpu_state.MM[cpu_reg].w[1] == src.w[1]) ? 0xffff : 0; fpu_state.tag = 0;
cpu_state.MM[cpu_reg].w[2] = (cpu_state.MM[cpu_reg].w[2] == src.w[2]) ? 0xffff : 0; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
cpu_state.MM[cpu_reg].w[3] = (cpu_state.MM[cpu_reg].w[3] == src.w[3]) ? 0xffff : 0;
dst.w[0] = (dst.w[0] == src.w[0]) ? 0xffff : 0;
dst.w[1] = (dst.w[1] == src.w[1]) ? 0xffff : 0;
dst.w[2] = (dst.w[2] == src.w[2]) ? 0xffff : 0;
dst.w[3] = (dst.w[3] == src.w[3]) ? 0xffff : 0;
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
cpu_state.MM[cpu_reg].w[0] = (cpu_state.MM[cpu_reg].w[0] == src.w[0]) ? 0xffff : 0;
cpu_state.MM[cpu_reg].w[1] = (cpu_state.MM[cpu_reg].w[1] == src.w[1]) ? 0xffff : 0;
cpu_state.MM[cpu_reg].w[2] = (cpu_state.MM[cpu_reg].w[2] == src.w[2]) ? 0xffff : 0;
cpu_state.MM[cpu_reg].w[3] = (cpu_state.MM[cpu_reg].w[3] == src.w[3]) ? 0xffff : 0;
}
return 0; return 0;
} }
static int static int
opPCMPGTW_a16(uint32_t fetchdat) opPCMPGTW_a16(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC(); MMX_GETSRC();
cpu_state.MM[cpu_reg].w[0] = (cpu_state.MM[cpu_reg].sw[0] > src.sw[0]) ? 0xffff : 0; if (fpu_softfloat) {
cpu_state.MM[cpu_reg].w[1] = (cpu_state.MM[cpu_reg].sw[1] > src.sw[1]) ? 0xffff : 0; fpu_state.tag = 0;
cpu_state.MM[cpu_reg].w[2] = (cpu_state.MM[cpu_reg].sw[2] > src.sw[2]) ? 0xffff : 0; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
cpu_state.MM[cpu_reg].w[3] = (cpu_state.MM[cpu_reg].sw[3] > src.sw[3]) ? 0xffff : 0;
dst.w[0] = (dst.sw[0] > src.sw[0]) ? 0xffff : 0;
dst.w[1] = (dst.sw[1] > src.sw[1]) ? 0xffff : 0;
dst.w[2] = (dst.sw[2] > src.sw[2]) ? 0xffff : 0;
dst.w[3] = (dst.sw[3] > src.sw[3]) ? 0xffff : 0;
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
cpu_state.MM[cpu_reg].w[0] = (cpu_state.MM[cpu_reg].sw[0] > src.sw[0]) ? 0xffff : 0;
cpu_state.MM[cpu_reg].w[1] = (cpu_state.MM[cpu_reg].sw[1] > src.sw[1]) ? 0xffff : 0;
cpu_state.MM[cpu_reg].w[2] = (cpu_state.MM[cpu_reg].sw[2] > src.sw[2]) ? 0xffff : 0;
cpu_state.MM[cpu_reg].w[3] = (cpu_state.MM[cpu_reg].sw[3] > src.sw[3]) ? 0xffff : 0;
}
return 0; return 0;
} }
static int static int
opPCMPGTW_a32(uint32_t fetchdat) opPCMPGTW_a32(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC(); MMX_GETSRC();
cpu_state.MM[cpu_reg].w[0] = (cpu_state.MM[cpu_reg].sw[0] > src.sw[0]) ? 0xffff : 0; if (fpu_softfloat) {
cpu_state.MM[cpu_reg].w[1] = (cpu_state.MM[cpu_reg].sw[1] > src.sw[1]) ? 0xffff : 0; fpu_state.tag = 0;
cpu_state.MM[cpu_reg].w[2] = (cpu_state.MM[cpu_reg].sw[2] > src.sw[2]) ? 0xffff : 0; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
cpu_state.MM[cpu_reg].w[3] = (cpu_state.MM[cpu_reg].sw[3] > src.sw[3]) ? 0xffff : 0;
dst.w[0] = (dst.sw[0] > src.sw[0]) ? 0xffff : 0;
dst.w[1] = (dst.sw[1] > src.sw[1]) ? 0xffff : 0;
dst.w[2] = (dst.sw[2] > src.sw[2]) ? 0xffff : 0;
dst.w[3] = (dst.sw[3] > src.sw[3]) ? 0xffff : 0;
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
cpu_state.MM[cpu_reg].w[0] = (cpu_state.MM[cpu_reg].sw[0] > src.sw[0]) ? 0xffff : 0;
cpu_state.MM[cpu_reg].w[1] = (cpu_state.MM[cpu_reg].sw[1] > src.sw[1]) ? 0xffff : 0;
cpu_state.MM[cpu_reg].w[2] = (cpu_state.MM[cpu_reg].sw[2] > src.sw[2]) ? 0xffff : 0;
cpu_state.MM[cpu_reg].w[3] = (cpu_state.MM[cpu_reg].sw[3] > src.sw[3]) ? 0xffff : 0;
}
return 0; return 0;
} }
static int static int
opPCMPEQD_a16(uint32_t fetchdat) opPCMPEQD_a16(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC(); MMX_GETSRC();
cpu_state.MM[cpu_reg].l[0] = (cpu_state.MM[cpu_reg].l[0] == src.l[0]) ? 0xffffffff : 0; if (fpu_softfloat) {
cpu_state.MM[cpu_reg].l[1] = (cpu_state.MM[cpu_reg].l[1] == src.l[1]) ? 0xffffffff : 0; fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
dst.l[0] = (dst.l[0] == src.l[0]) ? 0xffffffff : 0;
dst.l[1] = (dst.l[1] == src.l[1]) ? 0xffffffff : 0;
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
cpu_state.MM[cpu_reg].l[0] = (cpu_state.MM[cpu_reg].l[0] == src.l[0]) ? 0xffffffff : 0;
cpu_state.MM[cpu_reg].l[1] = (cpu_state.MM[cpu_reg].l[1] == src.l[1]) ? 0xffffffff : 0;
}
return 0; return 0;
} }
static int static int
opPCMPEQD_a32(uint32_t fetchdat) opPCMPEQD_a32(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC(); MMX_GETSRC();
cpu_state.MM[cpu_reg].l[0] = (cpu_state.MM[cpu_reg].l[0] == src.l[0]) ? 0xffffffff : 0; if (fpu_softfloat) {
cpu_state.MM[cpu_reg].l[1] = (cpu_state.MM[cpu_reg].l[1] == src.l[1]) ? 0xffffffff : 0; fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
dst.l[0] = (dst.l[0] == src.l[0]) ? 0xffffffff : 0;
dst.l[1] = (dst.l[1] == src.l[1]) ? 0xffffffff : 0;
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
cpu_state.MM[cpu_reg].l[0] = (cpu_state.MM[cpu_reg].l[0] == src.l[0]) ? 0xffffffff : 0;
cpu_state.MM[cpu_reg].l[1] = (cpu_state.MM[cpu_reg].l[1] == src.l[1]) ? 0xffffffff : 0;
}
return 0; return 0;
} }
static int static int
opPCMPGTD_a16(uint32_t fetchdat) opPCMPGTD_a16(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC(); MMX_GETSRC();
cpu_state.MM[cpu_reg].l[0] = (cpu_state.MM[cpu_reg].sl[0] > src.sl[0]) ? 0xffffffff : 0; if (fpu_softfloat) {
cpu_state.MM[cpu_reg].l[1] = (cpu_state.MM[cpu_reg].sl[1] > src.sl[1]) ? 0xffffffff : 0; fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
dst.l[0] = (dst.sl[0] > src.sl[0]) ? 0xffffffff : 0;
dst.l[1] = (dst.sl[1] > src.sl[1]) ? 0xffffffff : 0;
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
cpu_state.MM[cpu_reg].l[0] = (cpu_state.MM[cpu_reg].sl[0] > src.sl[0]) ? 0xffffffff : 0;
cpu_state.MM[cpu_reg].l[1] = (cpu_state.MM[cpu_reg].sl[1] > src.sl[1]) ? 0xffffffff : 0;
}
return 0; return 0;
} }
static int static int
opPCMPGTD_a32(uint32_t fetchdat) opPCMPGTD_a32(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC(); MMX_GETSRC();
cpu_state.MM[cpu_reg].l[0] = (cpu_state.MM[cpu_reg].sl[0] > src.sl[0]) ? 0xffffffff : 0; if (fpu_softfloat) {
cpu_state.MM[cpu_reg].l[1] = (cpu_state.MM[cpu_reg].sl[1] > src.sl[1]) ? 0xffffffff : 0; fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
dst.l[0] = (dst.sl[0] > src.sl[0]) ? 0xffffffff : 0;
dst.l[1] = (dst.sl[1] > src.sl[1]) ? 0xffffffff : 0;
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
cpu_state.MM[cpu_reg].l[0] = (cpu_state.MM[cpu_reg].sl[0] > src.sl[0]) ? 0xffffffff : 0;
cpu_state.MM[cpu_reg].l[1] = (cpu_state.MM[cpu_reg].sl[1] > src.sl[1]) ? 0xffffffff : 0;
}
return 0; return 0;
} }

View File

@@ -1,99 +1,203 @@
static int static int
opPAND_a16(uint32_t fetchdat) opPAND_a16(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC(); MMX_GETSRC();
cpu_state.MM[cpu_reg].q &= src.q; if (fpu_softfloat) {
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
dst.q &= src.q;
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else
cpu_state.MM[cpu_reg].q &= src.q;
return 0; return 0;
} }
static int static int
opPAND_a32(uint32_t fetchdat) opPAND_a32(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC(); MMX_GETSRC();
cpu_state.MM[cpu_reg].q &= src.q; if (fpu_softfloat) {
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
dst.q &= src.q;
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else
cpu_state.MM[cpu_reg].q &= src.q;
return 0; return 0;
} }
static int static int
opPANDN_a16(uint32_t fetchdat) opPANDN_a16(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC(); MMX_GETSRC();
cpu_state.MM[cpu_reg].q = ~cpu_state.MM[cpu_reg].q & src.q; if (fpu_softfloat) {
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
dst.q = ~dst.q & src.q;
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else
cpu_state.MM[cpu_reg].q = ~cpu_state.MM[cpu_reg].q & src.q;
return 0; return 0;
} }
static int static int
opPANDN_a32(uint32_t fetchdat) opPANDN_a32(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC(); MMX_GETSRC();
cpu_state.MM[cpu_reg].q = ~cpu_state.MM[cpu_reg].q & src.q; if (fpu_softfloat) {
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
dst.q = ~dst.q & src.q;
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else
cpu_state.MM[cpu_reg].q = ~cpu_state.MM[cpu_reg].q & src.q;
return 0; return 0;
} }
static int static int
opPOR_a16(uint32_t fetchdat) opPOR_a16(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC(); MMX_GETSRC();
cpu_state.MM[cpu_reg].q |= src.q; if (fpu_softfloat) {
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
dst.q |= src.q;
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else
cpu_state.MM[cpu_reg].q |= src.q;
return 0; return 0;
} }
static int static int
opPOR_a32(uint32_t fetchdat) opPOR_a32(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC(); MMX_GETSRC();
cpu_state.MM[cpu_reg].q |= src.q; if (fpu_softfloat) {
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
dst.q |= src.q;
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else
cpu_state.MM[cpu_reg].q |= src.q;
return 0; return 0;
} }
static int static int
opPXOR_a16(uint32_t fetchdat) opPXOR_a16(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC(); MMX_GETSRC();
cpu_state.MM[cpu_reg].q ^= src.q; if (fpu_softfloat) {
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
dst.q ^= src.q;
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else
cpu_state.MM[cpu_reg].q ^= src.q;
return 0; return 0;
} }
static int static int
opPXOR_a32(uint32_t fetchdat) opPXOR_a32(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC(); MMX_GETSRC();
cpu_state.MM[cpu_reg].q ^= src.q; if (fpu_softfloat) {
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
dst.q ^= src.q;
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else
cpu_state.MM[cpu_reg].q ^= src.q;
return 0; return 0;
} }

View File

@@ -1,48 +1,94 @@
static int static int
opMOVD_l_mm_a16(uint32_t fetchdat) opMOVD_l_mm_a16(uint32_t fetchdat)
{ {
uint32_t dst;
MMX_REG op;
MMX_ENTER(); MMX_ENTER();
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
if (cpu_mod == 3) { if (fpu_softfloat) {
cpu_state.MM[cpu_reg].l[0] = cpu_state.regs[cpu_rm].l; if (cpu_mod == 3) {
cpu_state.MM[cpu_reg].l[1] = 0; fpu_state.tag = 0;
CLOCK_CYCLES(1); fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
op.l[0] = cpu_state.regs[cpu_rm].l;
op.l[1] = 0;
fpu_state.st_space[cpu_reg].fraction = op.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
CLOCK_CYCLES(1);
} else {
SEG_CHECK_READ(cpu_state.ea_seg);
dst = readmeml(easeg, cpu_state.eaaddr);
if (cpu_state.abrt)
return 1;
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
op.l[0] = dst;
op.l[1] = 0;
fpu_state.st_space[cpu_reg].fraction = op.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
CLOCK_CYCLES(2);
}
} else { } else {
uint32_t dst; if (cpu_mod == 3) {
cpu_state.MM[cpu_reg].l[0] = cpu_state.regs[cpu_rm].l;
SEG_CHECK_READ(cpu_state.ea_seg); cpu_state.MM[cpu_reg].l[1] = 0;
dst = readmeml(easeg, cpu_state.eaaddr); CLOCK_CYCLES(1);
if (cpu_state.abrt) } else {
return 1; SEG_CHECK_READ(cpu_state.ea_seg);
cpu_state.MM[cpu_reg].l[0] = dst; dst = readmeml(easeg, cpu_state.eaaddr);
cpu_state.MM[cpu_reg].l[1] = 0; if (cpu_state.abrt)
return 1;
CLOCK_CYCLES(2); cpu_state.MM[cpu_reg].l[0] = dst;
cpu_state.MM[cpu_reg].l[1] = 0;
CLOCK_CYCLES(2);
}
} }
return 0; return 0;
} }
static int static int
opMOVD_l_mm_a32(uint32_t fetchdat) opMOVD_l_mm_a32(uint32_t fetchdat)
{ {
uint32_t dst;
MMX_REG op;
MMX_ENTER(); MMX_ENTER();
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
if (cpu_mod == 3) { if (fpu_softfloat) {
cpu_state.MM[cpu_reg].l[0] = cpu_state.regs[cpu_rm].l; if (cpu_mod == 3) {
cpu_state.MM[cpu_reg].l[1] = 0; fpu_state.tag = 0;
CLOCK_CYCLES(1); fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
op.l[0] = cpu_state.regs[cpu_rm].l;
op.l[1] = 0;
fpu_state.st_space[cpu_reg].fraction = op.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
CLOCK_CYCLES(1);
} else {
SEG_CHECK_READ(cpu_state.ea_seg);
dst = readmeml(easeg, cpu_state.eaaddr);
if (cpu_state.abrt)
return 1;
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
op.l[0] = dst;
op.l[1] = 0;
fpu_state.st_space[cpu_reg].fraction = op.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
CLOCK_CYCLES(2);
}
} else { } else {
uint32_t dst; if (cpu_mod == 3) {
cpu_state.MM[cpu_reg].l[0] = cpu_state.regs[cpu_rm].l;
SEG_CHECK_READ(cpu_state.ea_seg); cpu_state.MM[cpu_reg].l[1] = 0;
dst = readmeml(easeg, cpu_state.eaaddr); CLOCK_CYCLES(1);
if (cpu_state.abrt) } else {
return 1; SEG_CHECK_READ(cpu_state.ea_seg);
cpu_state.MM[cpu_reg].l[0] = dst; dst = readmeml(easeg, cpu_state.eaaddr);
cpu_state.MM[cpu_reg].l[1] = 0; if (cpu_state.abrt)
return 1;
CLOCK_CYCLES(2); cpu_state.MM[cpu_reg].l[0] = dst;
cpu_state.MM[cpu_reg].l[1] = 0;
CLOCK_CYCLES(2);
}
} }
return 0; return 0;
} }
@@ -50,38 +96,80 @@ opMOVD_l_mm_a32(uint32_t fetchdat)
static int static int
opMOVD_mm_l_a16(uint32_t fetchdat) opMOVD_mm_l_a16(uint32_t fetchdat)
{ {
MMX_REG op;
MMX_ENTER(); MMX_ENTER();
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
if (cpu_mod == 3) { if (fpu_softfloat) {
cpu_state.regs[cpu_rm].l = cpu_state.MM[cpu_reg].l[0]; if (cpu_mod == 3) {
CLOCK_CYCLES(1); fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
op = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
cpu_state.regs[cpu_rm].l = op.l[0];
CLOCK_CYCLES(1);
} else {
SEG_CHECK_WRITE(cpu_state.ea_seg);
CHECK_WRITE_COMMON(cpu_state.ea_seg, cpu_state.eaaddr, cpu_state.eaaddr + 3);
op = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
writememl(easeg, cpu_state.eaaddr, op.l[0]);
if (cpu_state.abrt)
return 1;
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
CLOCK_CYCLES(2);
}
} else { } else {
SEG_CHECK_WRITE(cpu_state.ea_seg); if (cpu_mod == 3) {
CHECK_WRITE_COMMON(cpu_state.ea_seg, cpu_state.eaaddr, cpu_state.eaaddr + 3); cpu_state.regs[cpu_rm].l = cpu_state.MM[cpu_reg].l[0];
writememl(easeg, cpu_state.eaaddr, cpu_state.MM[cpu_reg].l[0]); CLOCK_CYCLES(1);
if (cpu_state.abrt) } else {
return 1; SEG_CHECK_WRITE(cpu_state.ea_seg);
CLOCK_CYCLES(2); CHECK_WRITE_COMMON(cpu_state.ea_seg, cpu_state.eaaddr, cpu_state.eaaddr + 3);
writememl(easeg, cpu_state.eaaddr, cpu_state.MM[cpu_reg].l[0]);
if (cpu_state.abrt)
return 1;
CLOCK_CYCLES(2);
}
} }
return 0; return 0;
} }
static int static int
opMOVD_mm_l_a32(uint32_t fetchdat) opMOVD_mm_l_a32(uint32_t fetchdat)
{ {
MMX_REG op;
MMX_ENTER(); MMX_ENTER();
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
if (cpu_mod == 3) { if (fpu_softfloat) {
cpu_state.regs[cpu_rm].l = cpu_state.MM[cpu_reg].l[0]; if (cpu_mod == 3) {
CLOCK_CYCLES(1); fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
op = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
cpu_state.regs[cpu_rm].l = op.l[0];
CLOCK_CYCLES(1);
} else {
SEG_CHECK_WRITE(cpu_state.ea_seg);
CHECK_WRITE_COMMON(cpu_state.ea_seg, cpu_state.eaaddr, cpu_state.eaaddr + 3);
op = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
writememl(easeg, cpu_state.eaaddr, op.l[0]);
if (cpu_state.abrt)
return 1;
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
CLOCK_CYCLES(2);
}
} else { } else {
SEG_CHECK_WRITE(cpu_state.ea_seg); if (cpu_mod == 3) {
CHECK_WRITE_COMMON(cpu_state.ea_seg, cpu_state.eaaddr, cpu_state.eaaddr + 3); cpu_state.regs[cpu_rm].l = cpu_state.MM[cpu_reg].l[0];
writememl(easeg, cpu_state.eaaddr, cpu_state.MM[cpu_reg].l[0]); CLOCK_CYCLES(1);
if (cpu_state.abrt) } else {
return 1; SEG_CHECK_WRITE(cpu_state.ea_seg);
CLOCK_CYCLES(2); CHECK_WRITE_COMMON(cpu_state.ea_seg, cpu_state.eaaddr, cpu_state.eaaddr + 3);
writememl(easeg, cpu_state.eaaddr, cpu_state.MM[cpu_reg].l[0]);
if (cpu_state.abrt)
return 1;
CLOCK_CYCLES(2);
}
} }
return 0; return 0;
} }
@@ -137,42 +225,88 @@ opMOVD_mm_l_a32_cx(uint32_t fetchdat)
static int static int
opMOVQ_q_mm_a16(uint32_t fetchdat) opMOVQ_q_mm_a16(uint32_t fetchdat)
{ {
uint64_t dst;
MMX_REG src, op;
MMX_ENTER(); MMX_ENTER();
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
if (cpu_mod == 3) { if (fpu_softfloat) {
cpu_state.MM[cpu_reg].q = cpu_state.MM[cpu_rm].q; if (cpu_mod == 3) {
CLOCK_CYCLES(1); fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
src = *(MMX_REG *)&fpu_state.st_space[cpu_rm].fraction;
op.q = src.q;
fpu_state.st_space[cpu_reg].fraction = op.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
CLOCK_CYCLES(1);
} else {
SEG_CHECK_READ(cpu_state.ea_seg);
dst = readmemq(easeg, cpu_state.eaaddr);
if (cpu_state.abrt)
return 1;
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
op.q = dst;
fpu_state.st_space[cpu_reg].fraction = op.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
CLOCK_CYCLES(2);
}
} else { } else {
uint64_t dst; if (cpu_mod == 3) {
cpu_state.MM[cpu_reg].q = cpu_state.MM[cpu_rm].q;
SEG_CHECK_READ(cpu_state.ea_seg); CLOCK_CYCLES(1);
dst = readmemq(easeg, cpu_state.eaaddr); } else {
if (cpu_state.abrt) SEG_CHECK_READ(cpu_state.ea_seg);
return 1; dst = readmemq(easeg, cpu_state.eaaddr);
cpu_state.MM[cpu_reg].q = dst; if (cpu_state.abrt)
CLOCK_CYCLES(2); return 1;
cpu_state.MM[cpu_reg].q = dst;
CLOCK_CYCLES(2);
}
} }
return 0; return 0;
} }
static int static int
opMOVQ_q_mm_a32(uint32_t fetchdat) opMOVQ_q_mm_a32(uint32_t fetchdat)
{ {
uint64_t dst;
MMX_REG src, op;
MMX_ENTER(); MMX_ENTER();
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
if (cpu_mod == 3) { if (fpu_softfloat) {
cpu_state.MM[cpu_reg].q = cpu_state.MM[cpu_rm].q; if (cpu_mod == 3) {
CLOCK_CYCLES(1); fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
src = *(MMX_REG *)&fpu_state.st_space[cpu_rm].fraction;
op.q = src.q;
fpu_state.st_space[cpu_reg].fraction = op.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
CLOCK_CYCLES(1);
} else {
SEG_CHECK_READ(cpu_state.ea_seg);
dst = readmemq(easeg, cpu_state.eaaddr);
if (cpu_state.abrt)
return 1;
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
op.q = dst;
fpu_state.st_space[cpu_reg].fraction = op.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
CLOCK_CYCLES(2);
}
} else { } else {
uint64_t dst; if (cpu_mod == 3) {
cpu_state.MM[cpu_reg].q = cpu_state.MM[cpu_rm].q;
SEG_CHECK_READ(cpu_state.ea_seg); CLOCK_CYCLES(1);
dst = readmemq(easeg, cpu_state.eaaddr); } else {
if (cpu_state.abrt) SEG_CHECK_READ(cpu_state.ea_seg);
return 1; dst = readmemq(easeg, cpu_state.eaaddr);
cpu_state.MM[cpu_reg].q = dst; if (cpu_state.abrt)
CLOCK_CYCLES(2); return 1;
cpu_state.MM[cpu_reg].q = dst;
CLOCK_CYCLES(2);
}
} }
return 0; return 0;
} }
@@ -183,16 +317,34 @@ opMOVQ_mm_q_a16(uint32_t fetchdat)
MMX_ENTER(); MMX_ENTER();
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
if (cpu_mod == 3) { if (fpu_softfloat) {
cpu_state.MM[cpu_rm].q = cpu_state.MM[cpu_reg].q; if (cpu_mod == 3) {
CLOCK_CYCLES(1); fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
fpu_state.st_space[cpu_rm].fraction = fpu_state.st_space[cpu_reg].fraction;
CLOCK_CYCLES(1);
} else {
SEG_CHECK_WRITE(cpu_state.ea_seg);
CHECK_WRITE_COMMON(cpu_state.ea_seg, cpu_state.eaaddr, cpu_state.eaaddr + 7);
writememq(easeg, cpu_state.eaaddr, fpu_state.st_space[cpu_reg].fraction);
if (cpu_state.abrt)
return 1;
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
CLOCK_CYCLES(2);
}
} else { } else {
SEG_CHECK_WRITE(cpu_state.ea_seg); if (cpu_mod == 3) {
CHECK_WRITE_COMMON(cpu_state.ea_seg, cpu_state.eaaddr, cpu_state.eaaddr + 7); cpu_state.MM[cpu_rm].q = cpu_state.MM[cpu_reg].q;
writememq(easeg, cpu_state.eaaddr, cpu_state.MM[cpu_reg].q); CLOCK_CYCLES(1);
if (cpu_state.abrt) } else {
return 1; SEG_CHECK_WRITE(cpu_state.ea_seg);
CLOCK_CYCLES(2); CHECK_WRITE_COMMON(cpu_state.ea_seg, cpu_state.eaaddr, cpu_state.eaaddr + 7);
writememq(easeg, cpu_state.eaaddr, cpu_state.MM[cpu_reg].q);
if (cpu_state.abrt)
return 1;
CLOCK_CYCLES(2);
}
} }
return 0; return 0;
} }
@@ -202,16 +354,34 @@ opMOVQ_mm_q_a32(uint32_t fetchdat)
MMX_ENTER(); MMX_ENTER();
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
if (cpu_mod == 3) { if (fpu_softfloat) {
cpu_state.MM[cpu_rm].q = cpu_state.MM[cpu_reg].q; if (cpu_mod == 3) {
CLOCK_CYCLES(1); fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
fpu_state.st_space[cpu_rm].fraction = fpu_state.st_space[cpu_reg].fraction;
CLOCK_CYCLES(1);
} else {
SEG_CHECK_WRITE(cpu_state.ea_seg);
CHECK_WRITE_COMMON(cpu_state.ea_seg, cpu_state.eaaddr, cpu_state.eaaddr + 7);
writememq(easeg, cpu_state.eaaddr, fpu_state.st_space[cpu_reg].fraction);
if (cpu_state.abrt)
return 1;
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
CLOCK_CYCLES(2);
}
} else { } else {
SEG_CHECK_WRITE(cpu_state.ea_seg); if (cpu_mod == 3) {
CHECK_WRITE_COMMON(cpu_state.ea_seg, cpu_state.eaaddr, cpu_state.eaaddr + 7); cpu_state.MM[cpu_rm].q = cpu_state.MM[cpu_reg].q;
writememq(easeg, cpu_state.eaaddr, cpu_state.MM[cpu_reg].q); CLOCK_CYCLES(1);
if (cpu_state.abrt) } else {
return 1; SEG_CHECK_WRITE(cpu_state.ea_seg);
CLOCK_CYCLES(2); CHECK_WRITE_COMMON(cpu_state.ea_seg, cpu_state.eaaddr, cpu_state.eaaddr + 7);
writememq(easeg, cpu_state.eaaddr, cpu_state.MM[cpu_reg].q);
if (cpu_state.abrt)
return 1;
CLOCK_CYCLES(2);
}
} }
return 0; return 0;
} }

View File

@@ -1,44 +1,92 @@
static int static int
opPUNPCKLDQ_a16(uint32_t fetchdat) opPUNPCKLDQ_a16(uint32_t fetchdat)
{ {
uint32_t usrc;
MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
if (cpu_mod == 3) { if (fpu_softfloat) {
cpu_state.MM[cpu_reg].l[1] = cpu_state.MM[cpu_rm].l[0]; dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
CLOCK_CYCLES(1); if (cpu_mod == 3) {
src = *(MMX_REG *)&fpu_state.st_space[cpu_rm].fraction;
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
dst.l[1] = src.l[0];
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
CLOCK_CYCLES(1);
} else {
SEG_CHECK_READ(cpu_state.ea_seg);
src.l[0] = readmeml(easeg, cpu_state.eaaddr);
if (cpu_state.abrt)
return 1;
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
dst.l[1] = src.l[0];
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
CLOCK_CYCLES(2);
}
} else { } else {
uint32_t src; if (cpu_mod == 3) {
cpu_state.MM[cpu_reg].l[1] = cpu_state.MM[cpu_rm].l[0];
CLOCK_CYCLES(1);
} else {
SEG_CHECK_READ(cpu_state.ea_seg);
usrc = readmeml(easeg, cpu_state.eaaddr);
if (cpu_state.abrt)
return 0;
cpu_state.MM[cpu_reg].l[1] = usrc;
SEG_CHECK_READ(cpu_state.ea_seg); CLOCK_CYCLES(2);
src = readmeml(easeg, cpu_state.eaaddr); }
if (cpu_state.abrt)
return 0;
cpu_state.MM[cpu_reg].l[1] = src;
CLOCK_CYCLES(2);
} }
return 0; return 0;
} }
static int static int
opPUNPCKLDQ_a32(uint32_t fetchdat) opPUNPCKLDQ_a32(uint32_t fetchdat)
{ {
uint32_t usrc;
MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
if (cpu_mod == 3) { if (fpu_softfloat) {
cpu_state.MM[cpu_reg].l[1] = cpu_state.MM[cpu_rm].l[0]; dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
CLOCK_CYCLES(1); if (cpu_mod == 3) {
src = *(MMX_REG *)&fpu_state.st_space[cpu_rm].fraction;
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
dst.l[1] = src.l[0];
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
CLOCK_CYCLES(1);
} else {
SEG_CHECK_READ(cpu_state.ea_seg);
src.l[0] = readmeml(easeg, cpu_state.eaaddr);
if (cpu_state.abrt)
return 1;
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
dst.l[1] = src.l[0];
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
CLOCK_CYCLES(2);
}
} else { } else {
uint32_t src; if (cpu_mod == 3) {
cpu_state.MM[cpu_reg].l[1] = cpu_state.MM[cpu_rm].l[0];
CLOCK_CYCLES(1);
} else {
SEG_CHECK_READ(cpu_state.ea_seg);
usrc = readmeml(easeg, cpu_state.eaaddr);
if (cpu_state.abrt)
return 0;
cpu_state.MM[cpu_reg].l[1] = usrc;
SEG_CHECK_READ(cpu_state.ea_seg); CLOCK_CYCLES(2);
src = readmeml(easeg, cpu_state.eaaddr); }
if (cpu_state.abrt)
return 0;
cpu_state.MM[cpu_reg].l[1] = src;
CLOCK_CYCLES(2);
} }
return 0; return 0;
} }
@@ -46,177 +94,321 @@ opPUNPCKLDQ_a32(uint32_t fetchdat)
static int static int
opPUNPCKHDQ_a16(uint32_t fetchdat) opPUNPCKHDQ_a16(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
MMX_GETSRC(); MMX_GETSRC();
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
cpu_state.MM[cpu_reg].l[0] = cpu_state.MM[cpu_reg].l[1]; if (fpu_softfloat) {
cpu_state.MM[cpu_reg].l[1] = src.l[1]; fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
dst.l[0] = dst.l[1];
dst.l[1] = src.l[1];
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
cpu_state.MM[cpu_reg].l[0] = cpu_state.MM[cpu_reg].l[1];
cpu_state.MM[cpu_reg].l[1] = src.l[1];
}
return 0; return 0;
} }
static int static int
opPUNPCKHDQ_a32(uint32_t fetchdat) opPUNPCKHDQ_a32(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
MMX_GETSRC(); MMX_GETSRC();
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
cpu_state.MM[cpu_reg].l[0] = cpu_state.MM[cpu_reg].l[1]; if (fpu_softfloat) {
cpu_state.MM[cpu_reg].l[1] = src.l[1]; fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
dst.l[0] = dst.l[1];
dst.l[1] = src.l[1];
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
cpu_state.MM[cpu_reg].l[0] = cpu_state.MM[cpu_reg].l[1];
cpu_state.MM[cpu_reg].l[1] = src.l[1];
}
return 0; return 0;
} }
static int static int
opPUNPCKLBW_a16(uint32_t fetchdat) opPUNPCKLBW_a16(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC(); MMX_GETSRC();
cpu_state.MM[cpu_reg].b[7] = src.b[3]; if (fpu_softfloat) {
cpu_state.MM[cpu_reg].b[6] = cpu_state.MM[cpu_reg].b[3]; fpu_state.tag = 0;
cpu_state.MM[cpu_reg].b[5] = src.b[2]; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
cpu_state.MM[cpu_reg].b[4] = cpu_state.MM[cpu_reg].b[2]; dst.b[7] = src.b[3];
cpu_state.MM[cpu_reg].b[3] = src.b[1]; dst.b[6] = dst.b[3];
cpu_state.MM[cpu_reg].b[2] = cpu_state.MM[cpu_reg].b[1]; dst.b[5] = src.b[2];
cpu_state.MM[cpu_reg].b[1] = src.b[0]; dst.b[4] = dst.b[2];
cpu_state.MM[cpu_reg].b[0] = cpu_state.MM[cpu_reg].b[0]; dst.b[3] = src.b[1];
dst.b[2] = dst.b[1];
dst.b[1] = src.b[0];
dst.b[0] = dst.b[0];
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
cpu_state.MM[cpu_reg].b[7] = src.b[3];
cpu_state.MM[cpu_reg].b[6] = cpu_state.MM[cpu_reg].b[3];
cpu_state.MM[cpu_reg].b[5] = src.b[2];
cpu_state.MM[cpu_reg].b[4] = cpu_state.MM[cpu_reg].b[2];
cpu_state.MM[cpu_reg].b[3] = src.b[1];
cpu_state.MM[cpu_reg].b[2] = cpu_state.MM[cpu_reg].b[1];
cpu_state.MM[cpu_reg].b[1] = src.b[0];
cpu_state.MM[cpu_reg].b[0] = cpu_state.MM[cpu_reg].b[0];
}
return 0; return 0;
} }
static int static int
opPUNPCKLBW_a32(uint32_t fetchdat) opPUNPCKLBW_a32(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC(); MMX_GETSRC();
cpu_state.MM[cpu_reg].b[7] = src.b[3]; if (fpu_softfloat) {
cpu_state.MM[cpu_reg].b[6] = cpu_state.MM[cpu_reg].b[3]; fpu_state.tag = 0;
cpu_state.MM[cpu_reg].b[5] = src.b[2]; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
cpu_state.MM[cpu_reg].b[4] = cpu_state.MM[cpu_reg].b[2]; dst.b[7] = src.b[3];
cpu_state.MM[cpu_reg].b[3] = src.b[1]; dst.b[6] = dst.b[3];
cpu_state.MM[cpu_reg].b[2] = cpu_state.MM[cpu_reg].b[1]; dst.b[5] = src.b[2];
cpu_state.MM[cpu_reg].b[1] = src.b[0]; dst.b[4] = dst.b[2];
cpu_state.MM[cpu_reg].b[0] = cpu_state.MM[cpu_reg].b[0]; dst.b[3] = src.b[1];
dst.b[2] = dst.b[1];
dst.b[1] = src.b[0];
dst.b[0] = dst.b[0];
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
cpu_state.MM[cpu_reg].b[7] = src.b[3];
cpu_state.MM[cpu_reg].b[6] = cpu_state.MM[cpu_reg].b[3];
cpu_state.MM[cpu_reg].b[5] = src.b[2];
cpu_state.MM[cpu_reg].b[4] = cpu_state.MM[cpu_reg].b[2];
cpu_state.MM[cpu_reg].b[3] = src.b[1];
cpu_state.MM[cpu_reg].b[2] = cpu_state.MM[cpu_reg].b[1];
cpu_state.MM[cpu_reg].b[1] = src.b[0];
cpu_state.MM[cpu_reg].b[0] = cpu_state.MM[cpu_reg].b[0];
}
return 0; return 0;
} }
static int static int
opPUNPCKHBW_a16(uint32_t fetchdat) opPUNPCKHBW_a16(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC(); MMX_GETSRC();
cpu_state.MM[cpu_reg].b[0] = cpu_state.MM[cpu_reg].b[4]; if (fpu_softfloat) {
cpu_state.MM[cpu_reg].b[1] = src.b[4]; fpu_state.tag = 0;
cpu_state.MM[cpu_reg].b[2] = cpu_state.MM[cpu_reg].b[5]; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
cpu_state.MM[cpu_reg].b[3] = src.b[5]; dst.b[0] = dst.b[4];
cpu_state.MM[cpu_reg].b[4] = cpu_state.MM[cpu_reg].b[6]; dst.b[1] = src.b[4];
cpu_state.MM[cpu_reg].b[5] = src.b[6]; dst.b[2] = dst.b[5];
cpu_state.MM[cpu_reg].b[6] = cpu_state.MM[cpu_reg].b[7]; dst.b[3] = src.b[5];
cpu_state.MM[cpu_reg].b[7] = src.b[7]; dst.b[4] = dst.b[6];
dst.b[5] = src.b[6];
dst.b[6] = dst.b[7];
dst.b[7] = src.b[7];
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
cpu_state.MM[cpu_reg].b[0] = cpu_state.MM[cpu_reg].b[4];
cpu_state.MM[cpu_reg].b[1] = src.b[4];
cpu_state.MM[cpu_reg].b[2] = cpu_state.MM[cpu_reg].b[5];
cpu_state.MM[cpu_reg].b[3] = src.b[5];
cpu_state.MM[cpu_reg].b[4] = cpu_state.MM[cpu_reg].b[6];
cpu_state.MM[cpu_reg].b[5] = src.b[6];
cpu_state.MM[cpu_reg].b[6] = cpu_state.MM[cpu_reg].b[7];
cpu_state.MM[cpu_reg].b[7] = src.b[7];
}
return 0; return 0;
} }
static int static int
opPUNPCKHBW_a32(uint32_t fetchdat) opPUNPCKHBW_a32(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC(); MMX_GETSRC();
cpu_state.MM[cpu_reg].b[0] = cpu_state.MM[cpu_reg].b[4]; if (fpu_softfloat) {
cpu_state.MM[cpu_reg].b[1] = src.b[4]; fpu_state.tag = 0;
cpu_state.MM[cpu_reg].b[2] = cpu_state.MM[cpu_reg].b[5]; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
cpu_state.MM[cpu_reg].b[3] = src.b[5]; dst.b[0] = dst.b[4];
cpu_state.MM[cpu_reg].b[4] = cpu_state.MM[cpu_reg].b[6]; dst.b[1] = src.b[4];
cpu_state.MM[cpu_reg].b[5] = src.b[6]; dst.b[2] = dst.b[5];
cpu_state.MM[cpu_reg].b[6] = cpu_state.MM[cpu_reg].b[7]; dst.b[3] = src.b[5];
cpu_state.MM[cpu_reg].b[7] = src.b[7]; dst.b[4] = dst.b[6];
dst.b[5] = src.b[6];
dst.b[6] = dst.b[7];
dst.b[7] = src.b[7];
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
cpu_state.MM[cpu_reg].b[0] = cpu_state.MM[cpu_reg].b[4];
cpu_state.MM[cpu_reg].b[1] = src.b[4];
cpu_state.MM[cpu_reg].b[2] = cpu_state.MM[cpu_reg].b[5];
cpu_state.MM[cpu_reg].b[3] = src.b[5];
cpu_state.MM[cpu_reg].b[4] = cpu_state.MM[cpu_reg].b[6];
cpu_state.MM[cpu_reg].b[5] = src.b[6];
cpu_state.MM[cpu_reg].b[6] = cpu_state.MM[cpu_reg].b[7];
cpu_state.MM[cpu_reg].b[7] = src.b[7];
}
return 0; return 0;
} }
static int static int
opPUNPCKLWD_a16(uint32_t fetchdat) opPUNPCKLWD_a16(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC(); MMX_GETSRC();
cpu_state.MM[cpu_reg].w[3] = src.w[1]; if (fpu_softfloat) {
cpu_state.MM[cpu_reg].w[2] = cpu_state.MM[cpu_reg].w[1]; fpu_state.tag = 0;
cpu_state.MM[cpu_reg].w[1] = src.w[0]; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
cpu_state.MM[cpu_reg].w[0] = cpu_state.MM[cpu_reg].w[0]; dst.w[3] = src.w[1];
dst.w[2] = dst.w[1];
dst.w[1] = src.w[0];
dst.w[0] = dst.w[0];
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
cpu_state.MM[cpu_reg].w[3] = src.w[1];
cpu_state.MM[cpu_reg].w[2] = cpu_state.MM[cpu_reg].w[1];
cpu_state.MM[cpu_reg].w[1] = src.w[0];
cpu_state.MM[cpu_reg].w[0] = cpu_state.MM[cpu_reg].w[0];
}
return 0; return 0;
} }
static int static int
opPUNPCKLWD_a32(uint32_t fetchdat) opPUNPCKLWD_a32(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC(); MMX_GETSRC();
cpu_state.MM[cpu_reg].w[3] = src.w[1]; if (fpu_softfloat) {
cpu_state.MM[cpu_reg].w[2] = cpu_state.MM[cpu_reg].w[1]; fpu_state.tag = 0;
cpu_state.MM[cpu_reg].w[1] = src.w[0]; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
cpu_state.MM[cpu_reg].w[0] = cpu_state.MM[cpu_reg].w[0]; dst.w[3] = src.w[1];
dst.w[2] = dst.w[1];
dst.w[1] = src.w[0];
dst.w[0] = dst.w[0];
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
cpu_state.MM[cpu_reg].w[3] = src.w[1];
cpu_state.MM[cpu_reg].w[2] = cpu_state.MM[cpu_reg].w[1];
cpu_state.MM[cpu_reg].w[1] = src.w[0];
cpu_state.MM[cpu_reg].w[0] = cpu_state.MM[cpu_reg].w[0];
}
return 0; return 0;
} }
static int static int
opPUNPCKHWD_a16(uint32_t fetchdat) opPUNPCKHWD_a16(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC(); MMX_GETSRC();
cpu_state.MM[cpu_reg].w[0] = cpu_state.MM[cpu_reg].w[2]; if (fpu_softfloat) {
cpu_state.MM[cpu_reg].w[1] = src.w[2]; fpu_state.tag = 0;
cpu_state.MM[cpu_reg].w[2] = cpu_state.MM[cpu_reg].w[3]; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
cpu_state.MM[cpu_reg].w[3] = src.w[3]; dst.w[0] = dst.w[2];
dst.w[1] = src.w[2];
dst.w[2] = dst.w[3];
dst.w[3] = src.w[3];
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
cpu_state.MM[cpu_reg].w[0] = cpu_state.MM[cpu_reg].w[2];
cpu_state.MM[cpu_reg].w[1] = src.w[2];
cpu_state.MM[cpu_reg].w[2] = cpu_state.MM[cpu_reg].w[3];
cpu_state.MM[cpu_reg].w[3] = src.w[3];
}
return 0; return 0;
} }
static int static int
opPUNPCKHWD_a32(uint32_t fetchdat) opPUNPCKHWD_a32(uint32_t fetchdat)
{ {
MMX_REG src; MMX_REG src, dst;
MMX_ENTER(); MMX_ENTER();
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
if (fpu_softfloat)
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC(); MMX_GETSRC();
cpu_state.MM[cpu_reg].w[0] = cpu_state.MM[cpu_reg].w[2]; if (fpu_softfloat) {
cpu_state.MM[cpu_reg].w[1] = src.w[2]; fpu_state.tag = 0;
cpu_state.MM[cpu_reg].w[2] = cpu_state.MM[cpu_reg].w[3]; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
cpu_state.MM[cpu_reg].w[3] = src.w[3]; dst.w[0] = dst.w[2];
dst.w[1] = src.w[2];
dst.w[2] = dst.w[3];
dst.w[3] = src.w[3];
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
cpu_state.MM[cpu_reg].w[0] = cpu_state.MM[cpu_reg].w[2];
cpu_state.MM[cpu_reg].w[1] = src.w[2];
cpu_state.MM[cpu_reg].w[2] = cpu_state.MM[cpu_reg].w[3];
cpu_state.MM[cpu_reg].w[3] = src.w[3];
}
return 0; return 0;
} }
@@ -228,17 +420,35 @@ opPACKSSWB_a16(uint32_t fetchdat)
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
MMX_GETSRC(); MMX_GETSRC();
dst = cpu_state.MM[cpu_reg];
cpu_state.MM[cpu_reg].sb[0] = SSATB(dst.sw[0]); if (fpu_softfloat) {
cpu_state.MM[cpu_reg].sb[1] = SSATB(dst.sw[1]); dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
cpu_state.MM[cpu_reg].sb[2] = SSATB(dst.sw[2]);
cpu_state.MM[cpu_reg].sb[3] = SSATB(dst.sw[3]);
cpu_state.MM[cpu_reg].sb[4] = SSATB(src.sw[0]);
cpu_state.MM[cpu_reg].sb[5] = SSATB(src.sw[1]);
cpu_state.MM[cpu_reg].sb[6] = SSATB(src.sw[2]);
cpu_state.MM[cpu_reg].sb[7] = SSATB(src.sw[3]);
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
dst.sb[0] = SSATB(dst.sw[0]);
dst.sb[1] = SSATB(dst.sw[1]);
dst.sb[2] = SSATB(dst.sw[2]);
dst.sb[3] = SSATB(dst.sw[3]);
dst.sb[4] = SSATB(src.sw[0]);
dst.sb[5] = SSATB(src.sw[1]);
dst.sb[6] = SSATB(src.sw[2]);
dst.sb[7] = SSATB(src.sw[3]);
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
dst = cpu_state.MM[cpu_reg];
cpu_state.MM[cpu_reg].sb[0] = SSATB(dst.sw[0]);
cpu_state.MM[cpu_reg].sb[1] = SSATB(dst.sw[1]);
cpu_state.MM[cpu_reg].sb[2] = SSATB(dst.sw[2]);
cpu_state.MM[cpu_reg].sb[3] = SSATB(dst.sw[3]);
cpu_state.MM[cpu_reg].sb[4] = SSATB(src.sw[0]);
cpu_state.MM[cpu_reg].sb[5] = SSATB(src.sw[1]);
cpu_state.MM[cpu_reg].sb[6] = SSATB(src.sw[2]);
cpu_state.MM[cpu_reg].sb[7] = SSATB(src.sw[3]);
}
return 0; return 0;
} }
static int static int
@@ -249,17 +459,35 @@ opPACKSSWB_a32(uint32_t fetchdat)
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
MMX_GETSRC(); MMX_GETSRC();
dst = cpu_state.MM[cpu_reg];
cpu_state.MM[cpu_reg].sb[0] = SSATB(dst.sw[0]); if (fpu_softfloat) {
cpu_state.MM[cpu_reg].sb[1] = SSATB(dst.sw[1]); dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
cpu_state.MM[cpu_reg].sb[2] = SSATB(dst.sw[2]);
cpu_state.MM[cpu_reg].sb[3] = SSATB(dst.sw[3]);
cpu_state.MM[cpu_reg].sb[4] = SSATB(src.sw[0]);
cpu_state.MM[cpu_reg].sb[5] = SSATB(src.sw[1]);
cpu_state.MM[cpu_reg].sb[6] = SSATB(src.sw[2]);
cpu_state.MM[cpu_reg].sb[7] = SSATB(src.sw[3]);
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
dst.sb[0] = SSATB(dst.sw[0]);
dst.sb[1] = SSATB(dst.sw[1]);
dst.sb[2] = SSATB(dst.sw[2]);
dst.sb[3] = SSATB(dst.sw[3]);
dst.sb[4] = SSATB(src.sw[0]);
dst.sb[5] = SSATB(src.sw[1]);
dst.sb[6] = SSATB(src.sw[2]);
dst.sb[7] = SSATB(src.sw[3]);
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
dst = cpu_state.MM[cpu_reg];
cpu_state.MM[cpu_reg].sb[0] = SSATB(dst.sw[0]);
cpu_state.MM[cpu_reg].sb[1] = SSATB(dst.sw[1]);
cpu_state.MM[cpu_reg].sb[2] = SSATB(dst.sw[2]);
cpu_state.MM[cpu_reg].sb[3] = SSATB(dst.sw[3]);
cpu_state.MM[cpu_reg].sb[4] = SSATB(src.sw[0]);
cpu_state.MM[cpu_reg].sb[5] = SSATB(src.sw[1]);
cpu_state.MM[cpu_reg].sb[6] = SSATB(src.sw[2]);
cpu_state.MM[cpu_reg].sb[7] = SSATB(src.sw[3]);
}
return 0; return 0;
} }
@@ -271,17 +499,35 @@ opPACKUSWB_a16(uint32_t fetchdat)
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
MMX_GETSRC(); MMX_GETSRC();
dst = cpu_state.MM[cpu_reg];
cpu_state.MM[cpu_reg].b[0] = USATB(dst.sw[0]); if (fpu_softfloat) {
cpu_state.MM[cpu_reg].b[1] = USATB(dst.sw[1]); dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
cpu_state.MM[cpu_reg].b[2] = USATB(dst.sw[2]);
cpu_state.MM[cpu_reg].b[3] = USATB(dst.sw[3]);
cpu_state.MM[cpu_reg].b[4] = USATB(src.sw[0]);
cpu_state.MM[cpu_reg].b[5] = USATB(src.sw[1]);
cpu_state.MM[cpu_reg].b[6] = USATB(src.sw[2]);
cpu_state.MM[cpu_reg].b[7] = USATB(src.sw[3]);
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
dst.b[0] = USATB(dst.sw[0]);
dst.b[1] = USATB(dst.sw[1]);
dst.b[2] = USATB(dst.sw[2]);
dst.b[3] = USATB(dst.sw[3]);
dst.b[4] = USATB(src.sw[0]);
dst.b[5] = USATB(src.sw[1]);
dst.b[6] = USATB(src.sw[2]);
dst.b[7] = USATB(src.sw[3]);
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
dst = cpu_state.MM[cpu_reg];
cpu_state.MM[cpu_reg].b[0] = USATB(dst.sw[0]);
cpu_state.MM[cpu_reg].b[1] = USATB(dst.sw[1]);
cpu_state.MM[cpu_reg].b[2] = USATB(dst.sw[2]);
cpu_state.MM[cpu_reg].b[3] = USATB(dst.sw[3]);
cpu_state.MM[cpu_reg].b[4] = USATB(src.sw[0]);
cpu_state.MM[cpu_reg].b[5] = USATB(src.sw[1]);
cpu_state.MM[cpu_reg].b[6] = USATB(src.sw[2]);
cpu_state.MM[cpu_reg].b[7] = USATB(src.sw[3]);
}
return 0; return 0;
} }
static int static int
@@ -292,17 +538,35 @@ opPACKUSWB_a32(uint32_t fetchdat)
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
MMX_GETSRC(); MMX_GETSRC();
dst = cpu_state.MM[cpu_reg];
cpu_state.MM[cpu_reg].b[0] = USATB(dst.sw[0]); if (fpu_softfloat) {
cpu_state.MM[cpu_reg].b[1] = USATB(dst.sw[1]); dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
cpu_state.MM[cpu_reg].b[2] = USATB(dst.sw[2]);
cpu_state.MM[cpu_reg].b[3] = USATB(dst.sw[3]);
cpu_state.MM[cpu_reg].b[4] = USATB(src.sw[0]);
cpu_state.MM[cpu_reg].b[5] = USATB(src.sw[1]);
cpu_state.MM[cpu_reg].b[6] = USATB(src.sw[2]);
cpu_state.MM[cpu_reg].b[7] = USATB(src.sw[3]);
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
dst.b[0] = USATB(dst.sw[0]);
dst.b[1] = USATB(dst.sw[1]);
dst.b[2] = USATB(dst.sw[2]);
dst.b[3] = USATB(dst.sw[3]);
dst.b[4] = USATB(src.sw[0]);
dst.b[5] = USATB(src.sw[1]);
dst.b[6] = USATB(src.sw[2]);
dst.b[7] = USATB(src.sw[3]);
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
dst = cpu_state.MM[cpu_reg];
cpu_state.MM[cpu_reg].b[0] = USATB(dst.sw[0]);
cpu_state.MM[cpu_reg].b[1] = USATB(dst.sw[1]);
cpu_state.MM[cpu_reg].b[2] = USATB(dst.sw[2]);
cpu_state.MM[cpu_reg].b[3] = USATB(dst.sw[3]);
cpu_state.MM[cpu_reg].b[4] = USATB(src.sw[0]);
cpu_state.MM[cpu_reg].b[5] = USATB(src.sw[1]);
cpu_state.MM[cpu_reg].b[6] = USATB(src.sw[2]);
cpu_state.MM[cpu_reg].b[7] = USATB(src.sw[3]);
}
return 0; return 0;
} }
@@ -314,13 +578,28 @@ opPACKSSDW_a16(uint32_t fetchdat)
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
MMX_GETSRC(); MMX_GETSRC();
dst = cpu_state.MM[cpu_reg];
cpu_state.MM[cpu_reg].sw[0] = SSATW(dst.sl[0]); if (fpu_softfloat) {
cpu_state.MM[cpu_reg].sw[1] = SSATW(dst.sl[1]); dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
cpu_state.MM[cpu_reg].sw[2] = SSATW(src.sl[0]);
cpu_state.MM[cpu_reg].sw[3] = SSATW(src.sl[1]);
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
dst.sw[0] = SSATW(dst.sl[0]);
dst.sw[1] = SSATW(dst.sl[1]);
dst.sw[2] = SSATW(src.sl[0]);
dst.sw[3] = SSATW(src.sl[1]);
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
dst = cpu_state.MM[cpu_reg];
cpu_state.MM[cpu_reg].sw[0] = SSATW(dst.sl[0]);
cpu_state.MM[cpu_reg].sw[1] = SSATW(dst.sl[1]);
cpu_state.MM[cpu_reg].sw[2] = SSATW(src.sl[0]);
cpu_state.MM[cpu_reg].sw[3] = SSATW(src.sl[1]);
}
return 0; return 0;
} }
static int static int
@@ -331,12 +610,27 @@ opPACKSSDW_a32(uint32_t fetchdat)
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
MMX_GETSRC(); MMX_GETSRC();
dst = cpu_state.MM[cpu_reg];
cpu_state.MM[cpu_reg].sw[0] = SSATW(dst.sl[0]); if (fpu_softfloat) {
cpu_state.MM[cpu_reg].sw[1] = SSATW(dst.sl[1]); dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
cpu_state.MM[cpu_reg].sw[2] = SSATW(src.sl[0]);
cpu_state.MM[cpu_reg].sw[3] = SSATW(src.sl[1]);
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
dst.sw[0] = SSATW(dst.sl[0]);
dst.sw[1] = SSATW(dst.sl[1]);
dst.sw[2] = SSATW(src.sl[0]);
dst.sw[3] = SSATW(src.sl[1]);
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
dst = cpu_state.MM[cpu_reg];
cpu_state.MM[cpu_reg].sw[0] = SSATW(dst.sl[0]);
cpu_state.MM[cpu_reg].sw[1] = SSATW(dst.sl[1]);
cpu_state.MM[cpu_reg].sw[2] = SSATW(src.sl[0]);
cpu_state.MM[cpu_reg].sw[3] = SSATW(src.sl[1]);
}
return 0; return 0;
} }

View File

@@ -16,37 +16,80 @@ opPSxxW_imm(uint32_t fetchdat)
int reg = fetchdat & 7; int reg = fetchdat & 7;
int op = fetchdat & 0x38; int op = fetchdat & 0x38;
int shift = (fetchdat >> 8) & 0xff; int shift = (fetchdat >> 8) & 0xff;
MMX_REG dst;
cpu_state.pc += 2; cpu_state.pc += 2;
MMX_ENTER(); MMX_ENTER();
if (fpu_softfloat) {
dst = *(MMX_REG *)&fpu_state.st_space[reg].fraction;
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
}
switch (op) { switch (op) {
case 0x10: /*PSRLW*/ case 0x10: /*PSRLW*/
if (shift > 15) if (fpu_softfloat) {
cpu_state.MM[reg].q = 0; if (shift > 15)
else { dst.q = 0;
cpu_state.MM[reg].w[0] >>= shift; else {
cpu_state.MM[reg].w[1] >>= shift; dst.w[0] >>= shift;
cpu_state.MM[reg].w[2] >>= shift; dst.w[1] >>= shift;
cpu_state.MM[reg].w[3] >>= shift; dst.w[2] >>= shift;
dst.w[3] >>= shift;
}
fpu_state.st_space[reg].fraction = dst.q;
fpu_state.st_space[reg].exp = 0xffff;
} else {
if (shift > 15)
cpu_state.MM[reg].q = 0;
else {
cpu_state.MM[reg].w[0] >>= shift;
cpu_state.MM[reg].w[1] >>= shift;
cpu_state.MM[reg].w[2] >>= shift;
cpu_state.MM[reg].w[3] >>= shift;
}
} }
break; break;
case 0x20: /*PSRAW*/ case 0x20: /*PSRAW*/
if (shift > 15) if (fpu_softfloat) {
shift = 15; if (shift > 15)
cpu_state.MM[reg].sw[0] >>= shift; shift = 15;
cpu_state.MM[reg].sw[1] >>= shift; dst.sw[0] >>= shift;
cpu_state.MM[reg].sw[2] >>= shift; dst.sw[1] >>= shift;
cpu_state.MM[reg].sw[3] >>= shift; dst.sw[2] >>= shift;
dst.sw[3] >>= shift;
fpu_state.st_space[reg].fraction = dst.q;
fpu_state.st_space[reg].exp = 0xffff;
} else {
if (shift > 15)
shift = 15;
cpu_state.MM[reg].sw[0] >>= shift;
cpu_state.MM[reg].sw[1] >>= shift;
cpu_state.MM[reg].sw[2] >>= shift;
cpu_state.MM[reg].sw[3] >>= shift;
}
break; break;
case 0x30: /*PSLLW*/ case 0x30: /*PSLLW*/
if (shift > 15) if (fpu_softfloat) {
cpu_state.MM[reg].q = 0; if (shift > 15)
else { dst.q = 0;
cpu_state.MM[reg].w[0] <<= shift; else {
cpu_state.MM[reg].w[1] <<= shift; dst.w[0] <<= shift;
cpu_state.MM[reg].w[2] <<= shift; dst.w[1] <<= shift;
cpu_state.MM[reg].w[3] <<= shift; dst.w[2] <<= shift;
dst.w[3] <<= shift;
}
fpu_state.st_space[reg].fraction = dst.q;
fpu_state.st_space[reg].exp = 0xffff;
} else {
if (shift > 15)
cpu_state.MM[reg].q = 0;
else {
cpu_state.MM[reg].w[0] <<= shift;
cpu_state.MM[reg].w[1] <<= shift;
cpu_state.MM[reg].w[2] <<= shift;
cpu_state.MM[reg].w[3] <<= shift;
}
} }
break; break;
default: default:
@@ -62,127 +105,239 @@ opPSxxW_imm(uint32_t fetchdat)
static int static int
opPSLLW_a16(uint32_t fetchdat) opPSLLW_a16(uint32_t fetchdat)
{ {
MMX_REG src, dst;
int shift; int shift;
MMX_ENTER(); MMX_ENTER();
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
MMX_GETSHIFT(); if (fpu_softfloat) {
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC();
if (shift > 15) fpu_state.tag = 0;
cpu_state.MM[cpu_reg].q = 0; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
else { if (src.q > 15) {
cpu_state.MM[cpu_reg].w[0] <<= shift; dst.q = 0;
cpu_state.MM[cpu_reg].w[1] <<= shift; } else {
cpu_state.MM[cpu_reg].w[2] <<= shift; shift = src.b[0];
cpu_state.MM[cpu_reg].w[3] <<= shift; dst.w[0] <<= shift;
dst.w[1] <<= shift;
dst.w[2] <<= shift;
dst.w[3] <<= shift;
}
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
MMX_GETSHIFT();
if (shift > 15)
cpu_state.MM[cpu_reg].q = 0;
else {
cpu_state.MM[cpu_reg].w[0] <<= shift;
cpu_state.MM[cpu_reg].w[1] <<= shift;
cpu_state.MM[cpu_reg].w[2] <<= shift;
cpu_state.MM[cpu_reg].w[3] <<= shift;
}
} }
return 0; return 0;
} }
static int static int
opPSLLW_a32(uint32_t fetchdat) opPSLLW_a32(uint32_t fetchdat)
{ {
MMX_REG src, dst;
int shift; int shift;
MMX_ENTER(); MMX_ENTER();
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
MMX_GETSHIFT(); if (fpu_softfloat) {
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC();
if (shift > 15) fpu_state.tag = 0;
cpu_state.MM[cpu_reg].q = 0; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
else { if (src.q > 15) {
cpu_state.MM[cpu_reg].w[0] <<= shift; dst.q = 0;
cpu_state.MM[cpu_reg].w[1] <<= shift; } else {
cpu_state.MM[cpu_reg].w[2] <<= shift; shift = src.b[0];
cpu_state.MM[cpu_reg].w[3] <<= shift; dst.w[0] <<= shift;
dst.w[1] <<= shift;
dst.w[2] <<= shift;
dst.w[3] <<= shift;
}
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
MMX_GETSHIFT();
if (shift > 15)
cpu_state.MM[cpu_reg].q = 0;
else {
cpu_state.MM[cpu_reg].w[0] <<= shift;
cpu_state.MM[cpu_reg].w[1] <<= shift;
cpu_state.MM[cpu_reg].w[2] <<= shift;
cpu_state.MM[cpu_reg].w[3] <<= shift;
}
} }
return 0; return 0;
} }
static int static int
opPSRLW_a16(uint32_t fetchdat) opPSRLW_a16(uint32_t fetchdat)
{ {
MMX_REG src, dst;
int shift; int shift;
MMX_ENTER(); MMX_ENTER();
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
MMX_GETSHIFT(); if (fpu_softfloat) {
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC();
if (shift > 15) fpu_state.tag = 0;
cpu_state.MM[cpu_reg].q = 0; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
else { if (src.q > 15) {
cpu_state.MM[cpu_reg].w[0] >>= shift; dst.q = 0;
cpu_state.MM[cpu_reg].w[1] >>= shift; } else {
cpu_state.MM[cpu_reg].w[2] >>= shift; shift = src.b[0];
cpu_state.MM[cpu_reg].w[3] >>= shift; dst.w[0] >>= shift;
dst.w[1] >>= shift;
dst.w[2] >>= shift;
dst.w[3] >>= shift;
}
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
MMX_GETSHIFT();
if (shift > 15)
cpu_state.MM[cpu_reg].q = 0;
else {
cpu_state.MM[cpu_reg].w[0] >>= shift;
cpu_state.MM[cpu_reg].w[1] >>= shift;
cpu_state.MM[cpu_reg].w[2] >>= shift;
cpu_state.MM[cpu_reg].w[3] >>= shift;
}
} }
return 0; return 0;
} }
static int static int
opPSRLW_a32(uint32_t fetchdat) opPSRLW_a32(uint32_t fetchdat)
{ {
MMX_REG src, dst;
int shift; int shift;
MMX_ENTER(); MMX_ENTER();
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
MMX_GETSHIFT(); if (fpu_softfloat) {
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC();
if (shift > 15) fpu_state.tag = 0;
cpu_state.MM[cpu_reg].q = 0; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
else { if (src.q > 15) {
cpu_state.MM[cpu_reg].w[0] >>= shift; dst.q = 0;
cpu_state.MM[cpu_reg].w[1] >>= shift; } else {
cpu_state.MM[cpu_reg].w[2] >>= shift; shift = src.b[0];
cpu_state.MM[cpu_reg].w[3] >>= shift; dst.w[0] >>= shift;
dst.w[1] >>= shift;
dst.w[2] >>= shift;
dst.w[3] >>= shift;
}
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
MMX_GETSHIFT();
if (shift > 15)
cpu_state.MM[cpu_reg].q = 0;
else {
cpu_state.MM[cpu_reg].w[0] >>= shift;
cpu_state.MM[cpu_reg].w[1] >>= shift;
cpu_state.MM[cpu_reg].w[2] >>= shift;
cpu_state.MM[cpu_reg].w[3] >>= shift;
}
} }
return 0; return 0;
} }
static int static int
opPSRAW_a16(uint32_t fetchdat) opPSRAW_a16(uint32_t fetchdat)
{ {
MMX_REG src, dst;
int shift; int shift;
MMX_ENTER(); MMX_ENTER();
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
MMX_GETSHIFT(); if (fpu_softfloat) {
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC();
if (shift > 15) fpu_state.tag = 0;
shift = 15; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
if (src.q > 15) {
src.q = 15;
}
shift = src.b[0];
dst.sw[0] >>= shift;
dst.sw[1] >>= shift;
dst.sw[2] >>= shift;
dst.sw[3] >>= shift;
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
MMX_GETSHIFT();
cpu_state.MM[cpu_reg].sw[0] >>= shift; if (shift > 15)
cpu_state.MM[cpu_reg].sw[1] >>= shift; shift = 15;
cpu_state.MM[cpu_reg].sw[2] >>= shift;
cpu_state.MM[cpu_reg].sw[3] >>= shift;
cpu_state.MM[cpu_reg].sw[0] >>= shift;
cpu_state.MM[cpu_reg].sw[1] >>= shift;
cpu_state.MM[cpu_reg].sw[2] >>= shift;
cpu_state.MM[cpu_reg].sw[3] >>= shift;
}
return 0; return 0;
} }
static int static int
opPSRAW_a32(uint32_t fetchdat) opPSRAW_a32(uint32_t fetchdat)
{ {
MMX_REG src, dst;
int shift; int shift;
MMX_ENTER(); MMX_ENTER();
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
MMX_GETSHIFT(); if (fpu_softfloat) {
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC();
if (shift > 15) fpu_state.tag = 0;
shift = 15; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
if (src.q > 15) {
src.q = 15;
}
shift = src.b[0];
dst.sw[0] >>= shift;
dst.sw[1] >>= shift;
dst.sw[2] >>= shift;
dst.sw[3] >>= shift;
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
MMX_GETSHIFT();
cpu_state.MM[cpu_reg].sw[0] >>= shift; if (shift > 15)
cpu_state.MM[cpu_reg].sw[1] >>= shift; shift = 15;
cpu_state.MM[cpu_reg].sw[2] >>= shift;
cpu_state.MM[cpu_reg].sw[3] >>= shift;
cpu_state.MM[cpu_reg].sw[0] >>= shift;
cpu_state.MM[cpu_reg].sw[1] >>= shift;
cpu_state.MM[cpu_reg].sw[2] >>= shift;
cpu_state.MM[cpu_reg].sw[3] >>= shift;
}
return 0; return 0;
} }
@@ -192,31 +347,68 @@ opPSxxD_imm(uint32_t fetchdat)
int reg = fetchdat & 7; int reg = fetchdat & 7;
int op = fetchdat & 0x38; int op = fetchdat & 0x38;
int shift = (fetchdat >> 8) & 0xff; int shift = (fetchdat >> 8) & 0xff;
MMX_REG dst;
cpu_state.pc += 2; cpu_state.pc += 2;
MMX_ENTER(); MMX_ENTER();
if (fpu_softfloat) {
dst = *(MMX_REG *)&fpu_state.st_space[reg].fraction;
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
}
switch (op) { switch (op) {
case 0x10: /*PSRLD*/ case 0x10: /*PSRLD*/
if (shift > 31) if (fpu_softfloat) {
cpu_state.MM[reg].q = 0; if (shift > 31)
else { dst.q = 0;
cpu_state.MM[reg].l[0] >>= shift; else {
cpu_state.MM[reg].l[1] >>= shift; dst.l[0] >>= shift;
dst.l[1] >>= shift;
}
fpu_state.st_space[reg].fraction = dst.q;
fpu_state.st_space[reg].exp = 0xffff;
} else {
if (shift > 31)
cpu_state.MM[reg].q = 0;
else {
cpu_state.MM[reg].l[0] >>= shift;
cpu_state.MM[reg].l[1] >>= shift;
}
} }
break; break;
case 0x20: /*PSRAD*/ case 0x20: /*PSRAD*/
if (shift > 31) if (fpu_softfloat) {
shift = 31; if (shift > 31)
cpu_state.MM[reg].sl[0] >>= shift; shift = 31;
cpu_state.MM[reg].sl[1] >>= shift; dst.sl[0] >>= shift;
dst.sl[1] >>= shift;
fpu_state.st_space[reg].fraction = dst.q;
fpu_state.st_space[reg].exp = 0xffff;
} else {
if (shift > 31)
shift = 31;
cpu_state.MM[reg].sl[0] >>= shift;
cpu_state.MM[reg].sl[1] >>= shift;
}
break; break;
case 0x30: /*PSLLD*/ case 0x30: /*PSLLD*/
if (shift > 31) if (fpu_softfloat) {
cpu_state.MM[reg].q = 0; if (shift > 31)
else { dst.q = 0;
cpu_state.MM[reg].l[0] <<= shift; else {
cpu_state.MM[reg].l[1] <<= shift; dst.l[0] <<= shift;
dst.l[1] <<= shift;
}
fpu_state.st_space[reg].fraction = dst.q;
fpu_state.st_space[reg].exp = 0xffff;
} else {
if (shift > 31)
cpu_state.MM[reg].q = 0;
else {
cpu_state.MM[reg].l[0] <<= shift;
cpu_state.MM[reg].l[1] <<= shift;
}
} }
break; break;
default: default:
@@ -232,115 +424,215 @@ opPSxxD_imm(uint32_t fetchdat)
static int static int
opPSLLD_a16(uint32_t fetchdat) opPSLLD_a16(uint32_t fetchdat)
{ {
MMX_REG src, dst;
int shift; int shift;
MMX_ENTER(); MMX_ENTER();
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
MMX_GETSHIFT(); if (fpu_softfloat) {
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC();
if (shift > 31) fpu_state.tag = 0;
cpu_state.MM[cpu_reg].q = 0; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
else { if (src.q > 31) {
cpu_state.MM[cpu_reg].l[0] <<= shift; dst.q = 0;
cpu_state.MM[cpu_reg].l[1] <<= shift; } else {
shift = src.b[0];
dst.l[0] <<= shift;
dst.l[1] <<= shift;
}
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
MMX_GETSHIFT();
if (shift > 31)
cpu_state.MM[cpu_reg].q = 0;
else {
cpu_state.MM[cpu_reg].l[0] <<= shift;
cpu_state.MM[cpu_reg].l[1] <<= shift;
}
} }
return 0; return 0;
} }
static int static int
opPSLLD_a32(uint32_t fetchdat) opPSLLD_a32(uint32_t fetchdat)
{ {
MMX_REG src, dst;
int shift; int shift;
MMX_ENTER(); MMX_ENTER();
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
MMX_GETSHIFT(); if (fpu_softfloat) {
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC();
if (shift > 31) fpu_state.tag = 0;
cpu_state.MM[cpu_reg].q = 0; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
else { if (src.q > 31) {
cpu_state.MM[cpu_reg].l[0] <<= shift; dst.q = 0;
cpu_state.MM[cpu_reg].l[1] <<= shift; } else {
shift = src.b[0];
dst.l[0] <<= shift;
dst.l[1] <<= shift;
}
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
MMX_GETSHIFT();
if (shift > 31)
cpu_state.MM[cpu_reg].q = 0;
else {
cpu_state.MM[cpu_reg].l[0] <<= shift;
cpu_state.MM[cpu_reg].l[1] <<= shift;
}
} }
return 0; return 0;
} }
static int static int
opPSRLD_a16(uint32_t fetchdat) opPSRLD_a16(uint32_t fetchdat)
{ {
MMX_REG src, dst;
int shift; int shift;
MMX_ENTER(); MMX_ENTER();
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
MMX_GETSHIFT(); if (fpu_softfloat) {
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC();
if (shift > 31) fpu_state.tag = 0;
cpu_state.MM[cpu_reg].q = 0; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
else { if (src.q > 31) {
cpu_state.MM[cpu_reg].l[0] >>= shift; dst.q = 0;
cpu_state.MM[cpu_reg].l[1] >>= shift; } else {
shift = src.b[0];
dst.l[0] >>= shift;
dst.l[1] >>= shift;
}
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
MMX_GETSHIFT();
if (shift > 31)
cpu_state.MM[cpu_reg].q = 0;
else {
cpu_state.MM[cpu_reg].l[0] >>= shift;
cpu_state.MM[cpu_reg].l[1] >>= shift;
}
} }
return 0; return 0;
} }
static int static int
opPSRLD_a32(uint32_t fetchdat) opPSRLD_a32(uint32_t fetchdat)
{ {
MMX_REG src, dst;
int shift; int shift;
MMX_ENTER(); MMX_ENTER();
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
MMX_GETSHIFT(); if (fpu_softfloat) {
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC();
if (shift > 31) fpu_state.tag = 0;
cpu_state.MM[cpu_reg].q = 0; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
else { if (src.q > 31) {
cpu_state.MM[cpu_reg].l[0] >>= shift; dst.q = 0;
cpu_state.MM[cpu_reg].l[1] >>= shift; } else {
shift = src.b[0];
dst.l[0] >>= shift;
dst.l[1] >>= shift;
}
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
MMX_GETSHIFT();
if (shift > 31)
cpu_state.MM[cpu_reg].q = 0;
else {
cpu_state.MM[cpu_reg].l[0] >>= shift;
cpu_state.MM[cpu_reg].l[1] >>= shift;
}
} }
return 0; return 0;
} }
static int static int
opPSRAD_a16(uint32_t fetchdat) opPSRAD_a16(uint32_t fetchdat)
{ {
MMX_REG src, dst;
int shift; int shift;
MMX_ENTER(); MMX_ENTER();
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
MMX_GETSHIFT(); if (fpu_softfloat) {
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC();
if (shift > 31) fpu_state.tag = 0;
shift = 31; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
if (src.q > 31) {
src.q = 31;
}
shift = src.b[0];
dst.sl[0] >>= shift;
dst.sl[1] >>= shift;
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
MMX_GETSHIFT();
cpu_state.MM[cpu_reg].sl[0] >>= shift; if (shift > 31)
cpu_state.MM[cpu_reg].sl[1] >>= shift; shift = 31;
cpu_state.MM[cpu_reg].sl[0] >>= shift;
cpu_state.MM[cpu_reg].sl[1] >>= shift;
}
return 0; return 0;
} }
static int static int
opPSRAD_a32(uint32_t fetchdat) opPSRAD_a32(uint32_t fetchdat)
{ {
MMX_REG src, dst;
int shift; int shift;
MMX_ENTER(); MMX_ENTER();
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
MMX_GETSHIFT(); if (fpu_softfloat) {
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC();
if (shift > 31) fpu_state.tag = 0;
shift = 31; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
if (src.q > 31) {
src.q = 31;
}
shift = src.b[0];
dst.sl[0] >>= shift;
dst.sl[1] >>= shift;
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
MMX_GETSHIFT();
cpu_state.MM[cpu_reg].sl[0] >>= shift; if (shift > 31)
cpu_state.MM[cpu_reg].sl[1] >>= shift; shift = 31;
cpu_state.MM[cpu_reg].sl[0] >>= shift;
cpu_state.MM[cpu_reg].sl[1] >>= shift;
}
return 0; return 0;
} }
@@ -350,27 +642,59 @@ opPSxxQ_imm(uint32_t fetchdat)
int reg = fetchdat & 7; int reg = fetchdat & 7;
int op = fetchdat & 0x38; int op = fetchdat & 0x38;
int shift = (fetchdat >> 8) & 0xff; int shift = (fetchdat >> 8) & 0xff;
MMX_REG dst;
cpu_state.pc += 2; cpu_state.pc += 2;
MMX_ENTER(); MMX_ENTER();
if (fpu_softfloat) {
dst = *(MMX_REG *)&fpu_state.st_space[reg].fraction;
fpu_state.tag = 0;
fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
}
switch (op) { switch (op) {
case 0x10: /*PSRLW*/ case 0x10: /*PSRLW*/
if (shift > 63) if (fpu_softfloat) {
cpu_state.MM[reg].q = 0; if (shift > 63)
else dst.q = 0;
cpu_state.MM[reg].q >>= shift; else
dst.q >>= shift;
fpu_state.st_space[reg].fraction = dst.q;
fpu_state.st_space[reg].exp = 0xffff;
} else {
if (shift > 63)
cpu_state.MM[reg].q = 0;
else
cpu_state.MM[reg].q >>= shift;
}
break; break;
case 0x20: /*PSRAW*/ case 0x20: /*PSRAW*/
if (shift > 63) if (shift > 63)
shift = 63; shift = 63;
cpu_state.MM[reg].sq >>= shift;
if (fpu_softfloat) {
dst.sq >>= shift;
fpu_state.st_space[reg].fraction = dst.q;
fpu_state.st_space[reg].exp = 0xffff;
} else
cpu_state.MM[reg].sq >>= shift;
break; break;
case 0x30: /*PSLLW*/ case 0x30: /*PSLLW*/
if (shift > 63) if (fpu_softfloat) {
cpu_state.MM[reg].q = 0; if (shift > 63)
else dst.q = 0;
cpu_state.MM[reg].q <<= shift; else
dst.q <<= shift;
fpu_state.st_space[reg].fraction = dst.q;
fpu_state.st_space[reg].exp = 0xffff;
} else {
if (shift > 63)
cpu_state.MM[reg].q = 0;
else
cpu_state.MM[reg].q <<= shift;
}
break; break;
default: default:
cpu_state.pc = cpu_state.oldpc; cpu_state.pc = cpu_state.oldpc;
@@ -385,69 +709,133 @@ opPSxxQ_imm(uint32_t fetchdat)
static int static int
opPSLLQ_a16(uint32_t fetchdat) opPSLLQ_a16(uint32_t fetchdat)
{ {
MMX_REG src, dst;
int shift; int shift;
MMX_ENTER(); MMX_ENTER();
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
MMX_GETSHIFT(); if (fpu_softfloat) {
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC();
if (shift > 63) fpu_state.tag = 0;
cpu_state.MM[cpu_reg].q = 0; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
else if (src.q > 63) {
cpu_state.MM[cpu_reg].q <<= shift; dst.q = 0;
} else {
shift = src.b[0];
dst.q <<= shift;
}
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
MMX_GETSHIFT();
if (shift > 63)
cpu_state.MM[cpu_reg].q = 0;
else
cpu_state.MM[cpu_reg].q <<= shift;
}
return 0; return 0;
} }
static int static int
opPSLLQ_a32(uint32_t fetchdat) opPSLLQ_a32(uint32_t fetchdat)
{ {
MMX_REG src, dst;
int shift; int shift;
MMX_ENTER(); MMX_ENTER();
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
MMX_GETSHIFT(); if (fpu_softfloat) {
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC();
if (shift > 63) fpu_state.tag = 0;
cpu_state.MM[cpu_reg].q = 0; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
else if (src.q > 63) {
cpu_state.MM[cpu_reg].q <<= shift; dst.q = 0;
} else {
shift = src.b[0];
dst.q <<= shift;
}
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
MMX_GETSHIFT();
if (shift > 63)
cpu_state.MM[cpu_reg].q = 0;
else
cpu_state.MM[cpu_reg].q <<= shift;
}
return 0; return 0;
} }
static int static int
opPSRLQ_a16(uint32_t fetchdat) opPSRLQ_a16(uint32_t fetchdat)
{ {
MMX_REG src, dst;
int shift; int shift;
MMX_ENTER(); MMX_ENTER();
fetch_ea_16(fetchdat); fetch_ea_16(fetchdat);
MMX_GETSHIFT(); if (fpu_softfloat) {
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC();
if (shift > 63) fpu_state.tag = 0;
cpu_state.MM[cpu_reg].q = 0; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
else if (src.q > 63) {
cpu_state.MM[cpu_reg].q >>= shift; dst.q = 0;
} else {
shift = src.b[0];
dst.q >>= shift;
}
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
MMX_GETSHIFT();
if (shift > 63)
cpu_state.MM[cpu_reg].q = 0;
else
cpu_state.MM[cpu_reg].q >>= shift;
}
return 0; return 0;
} }
static int static int
opPSRLQ_a32(uint32_t fetchdat) opPSRLQ_a32(uint32_t fetchdat)
{ {
MMX_REG src, dst;
int shift; int shift;
MMX_ENTER(); MMX_ENTER();
fetch_ea_32(fetchdat); fetch_ea_32(fetchdat);
MMX_GETSHIFT(); if (fpu_softfloat) {
dst = *(MMX_REG *)&fpu_state.st_space[cpu_reg].fraction;
MMX_GETSRC();
if (shift > 63) fpu_state.tag = 0;
cpu_state.MM[cpu_reg].q = 0; fpu_state.tos = 0; /* reset FPU Top-Of-Stack */
else if (src.q > 63) {
cpu_state.MM[cpu_reg].q >>= shift; dst.q = 0;
} else {
shift = src.b[0];
dst.q >>= shift;
}
fpu_state.st_space[cpu_reg].fraction = dst.q;
fpu_state.st_space[cpu_reg].exp = 0xffff;
} else {
MMX_GETSHIFT();
if (shift > 63)
cpu_state.MM[cpu_reg].q = 0;
else
cpu_state.MM[cpu_reg].q >>= shift;
}
return 0; return 0;
} }