removed switches in op.c (Paul Brook)

git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1400 c046a42c-6fe2-441c-8c8c-71466251a162
This commit is contained in:
bellard 2005-04-26 20:38:17 +00:00
parent e50e6a2019
commit 43fb823b5f
2 changed files with 36 additions and 136 deletions

View File

@ -1952,94 +1952,48 @@ void OPPROTO op_fxchg_ST0_STN(void)
/* FPU operations */ /* FPU operations */
const int fcom_ccval[4] = {0x0100, 0x4000, 0x0000, 0x4500};
void OPPROTO op_fcom_ST0_FT0(void) void OPPROTO op_fcom_ST0_FT0(void)
{ {
int cc; int ret;
switch(floatx_compare(ST0, FT0, &env->fp_status)) {
case -1: ret = floatx_compare(ST0, FT0, &env->fp_status);
cc = 0x0100; env->fpus = (env->fpus & ~0x4500) | fcom_ccval[ret + 1];
break;
case 0:
cc = 0x4000;
break;
case 1:
cc = 0x0000;
break;
case 2:
default:
cc = 0x4500;
break;
}
env->fpus = (env->fpus & ~0x4500) | cc;
FORCE_RET(); FORCE_RET();
} }
void OPPROTO op_fucom_ST0_FT0(void) void OPPROTO op_fucom_ST0_FT0(void)
{ {
int cc; int ret;
switch(floatx_compare_quiet(ST0, FT0, &env->fp_status)) {
case -1: ret = floatx_compare_quiet(ST0, FT0, &env->fp_status);
cc = 0x0100; env->fpus = (env->fpus & ~0x4500) | fcom_ccval[ret+ 1];
break;
case 0:
cc = 0x4000;
break;
case 1:
cc = 0x0000;
break;
case 2:
default:
cc = 0x4500;
break;
}
env->fpus = (env->fpus & ~0x4500) | cc;
FORCE_RET(); FORCE_RET();
} }
const int fcomi_ccval[4] = {CC_C, CC_Z, 0, CC_Z | CC_P | CC_C};
void OPPROTO op_fcomi_ST0_FT0(void) void OPPROTO op_fcomi_ST0_FT0(void)
{ {
int eflags, cc; int eflags;
switch(floatx_compare(ST0, FT0, &env->fp_status)) { int ret;
case -1:
cc = CC_C; ret = floatx_compare(ST0, FT0, &env->fp_status);
break;
case 0:
cc = CC_Z;
break;
case 1:
cc = 0;
break;
case 2:
default:
cc = CC_Z | CC_P | CC_C;
break;
}
eflags = cc_table[CC_OP].compute_all(); eflags = cc_table[CC_OP].compute_all();
eflags = (eflags & ~(CC_Z | CC_P | CC_C)) | cc; eflags = (eflags & ~(CC_Z | CC_P | CC_C)) | fcomi_ccval[ret + 1];
CC_SRC = eflags; CC_SRC = eflags;
FORCE_RET(); FORCE_RET();
} }
void OPPROTO op_fucomi_ST0_FT0(void) void OPPROTO op_fucomi_ST0_FT0(void)
{ {
int eflags, cc; int eflags;
switch(floatx_compare_quiet(ST0, FT0, &env->fp_status)) { int ret;
case -1:
cc = CC_C; ret = floatx_compare_quiet(ST0, FT0, &env->fp_status);
break;
case 0:
cc = CC_Z;
break;
case 1:
cc = 0;
break;
case 2:
default:
cc = CC_Z | CC_P | CC_C;
break;
}
eflags = cc_table[CC_OP].compute_all(); eflags = cc_table[CC_OP].compute_all();
eflags = (eflags & ~(CC_Z | CC_P | CC_C)) | cc; eflags = (eflags & ~(CC_Z | CC_P | CC_C)) | fcomi_ccval[ret + 1];
CC_SRC = eflags; CC_SRC = eflags;
FORCE_RET(); FORCE_RET();
} }

View File

@ -1079,9 +1079,11 @@ SSE_OP_CMP(cmpnlt, FPU_CMPNLT)
SSE_OP_CMP(cmpnle, FPU_CMPNLE) SSE_OP_CMP(cmpnle, FPU_CMPNLE)
SSE_OP_CMP(cmpord, FPU_CMPORD) SSE_OP_CMP(cmpord, FPU_CMPORD)
const int comis_eflags[4] = {CC_C, CC_Z, 0, CC_Z | CC_P | CC_C};
void OPPROTO op_ucomiss(void) void OPPROTO op_ucomiss(void)
{ {
int eflags; int ret;
float32 s0, s1; float32 s0, s1;
Reg *d, *s; Reg *d, *s;
d = (Reg *)((char *)env + PARAM1); d = (Reg *)((char *)env + PARAM1);
@ -1089,28 +1091,14 @@ void OPPROTO op_ucomiss(void)
s0 = d->XMM_S(0); s0 = d->XMM_S(0);
s1 = s->XMM_S(0); s1 = s->XMM_S(0);
switch(float32_compare_quiet(s0, s1, &env->sse_status)) { ret = float32_compare_quiet(s0, s1, &env->sse_status);
case -1: CC_SRC = comis_eflags[ret + 1];
eflags = CC_C;
break;
case 0:
eflags = CC_Z;
break;
case 1:
eflags = 0;
break;
case 2:
default:
eflags = CC_Z | CC_P | CC_C;
break;
}
CC_SRC = eflags;
FORCE_RET(); FORCE_RET();
} }
void OPPROTO op_comiss(void) void OPPROTO op_comiss(void)
{ {
int eflags; int ret;
float32 s0, s1; float32 s0, s1;
Reg *d, *s; Reg *d, *s;
d = (Reg *)((char *)env + PARAM1); d = (Reg *)((char *)env + PARAM1);
@ -1118,28 +1106,14 @@ void OPPROTO op_comiss(void)
s0 = d->XMM_S(0); s0 = d->XMM_S(0);
s1 = s->XMM_S(0); s1 = s->XMM_S(0);
switch(float32_compare(s0, s1, &env->sse_status)) { ret = float32_compare(s0, s1, &env->sse_status);
case -1: CC_SRC = comis_eflags[ret + 1];
eflags = CC_C;
break;
case 0:
eflags = CC_Z;
break;
case 1:
eflags = 0;
break;
case 2:
default:
eflags = CC_Z | CC_P | CC_C;
break;
}
CC_SRC = eflags;
FORCE_RET(); FORCE_RET();
} }
void OPPROTO op_ucomisd(void) void OPPROTO op_ucomisd(void)
{ {
int eflags; int ret;
float64 d0, d1; float64 d0, d1;
Reg *d, *s; Reg *d, *s;
d = (Reg *)((char *)env + PARAM1); d = (Reg *)((char *)env + PARAM1);
@ -1147,28 +1121,14 @@ void OPPROTO op_ucomisd(void)
d0 = d->XMM_D(0); d0 = d->XMM_D(0);
d1 = s->XMM_D(0); d1 = s->XMM_D(0);
switch(float64_compare_quiet(d0, d1, &env->sse_status)) { ret = float64_compare_quiet(d0, d1, &env->sse_status);
case -1: CC_SRC = comis_eflags[ret + 1];
eflags = CC_C;
break;
case 0:
eflags = CC_Z;
break;
case 1:
eflags = 0;
break;
case 2:
default:
eflags = CC_Z | CC_P | CC_C;
break;
}
CC_SRC = eflags;
FORCE_RET(); FORCE_RET();
} }
void OPPROTO op_comisd(void) void OPPROTO op_comisd(void)
{ {
int eflags; int ret;
float64 d0, d1; float64 d0, d1;
Reg *d, *s; Reg *d, *s;
d = (Reg *)((char *)env + PARAM1); d = (Reg *)((char *)env + PARAM1);
@ -1176,22 +1136,8 @@ void OPPROTO op_comisd(void)
d0 = d->XMM_D(0); d0 = d->XMM_D(0);
d1 = s->XMM_D(0); d1 = s->XMM_D(0);
switch(float64_compare(d0, d1, &env->sse_status)) { ret = float64_compare(d0, d1, &env->sse_status);
case -1: CC_SRC = comis_eflags[ret + 1];
eflags = CC_C;
break;
case 0:
eflags = CC_Z;
break;
case 1:
eflags = 0;
break;
case 2:
default:
eflags = CC_Z | CC_P | CC_C;
break;
}
CC_SRC = eflags;
FORCE_RET(); FORCE_RET();
} }