diff options
author | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2005-04-26 20:38:17 +0000 |
---|---|---|
committer | bellard <bellard@c046a42c-6fe2-441c-8c8c-71466251a162> | 2005-04-26 20:38:17 +0000 |
commit | 43fb823b5f89c6d716e2cbce603c6fb1ca6c0b2f (patch) | |
tree | d34fc754d9b2417efdbe37d89410fbebc9449103 /target-i386/op.c | |
parent | e50e6a20192616b93d94be316556deb001e4f477 (diff) |
removed switches in op.c (Paul Brook)
git-svn-id: svn://svn.savannah.nongnu.org/qemu/trunk@1400 c046a42c-6fe2-441c-8c8c-71466251a162
Diffstat (limited to 'target-i386/op.c')
-rw-r--r-- | target-i386/op.c | 90 |
1 files changed, 22 insertions, 68 deletions
diff --git a/target-i386/op.c b/target-i386/op.c index c157b120b0..2af4e8eb37 100644 --- a/target-i386/op.c +++ b/target-i386/op.c @@ -1952,94 +1952,48 @@ void OPPROTO op_fxchg_ST0_STN(void) /* FPU operations */ +const int fcom_ccval[4] = {0x0100, 0x4000, 0x0000, 0x4500}; + void OPPROTO op_fcom_ST0_FT0(void) { - int cc; - switch(floatx_compare(ST0, FT0, &env->fp_status)) { - case -1: - cc = 0x0100; - break; - case 0: - cc = 0x4000; - break; - case 1: - cc = 0x0000; - break; - case 2: - default: - cc = 0x4500; - break; - } - env->fpus = (env->fpus & ~0x4500) | cc; + int ret; + + ret = floatx_compare(ST0, FT0, &env->fp_status); + env->fpus = (env->fpus & ~0x4500) | fcom_ccval[ret + 1]; FORCE_RET(); } void OPPROTO op_fucom_ST0_FT0(void) { - int cc; - switch(floatx_compare_quiet(ST0, FT0, &env->fp_status)) { - case -1: - cc = 0x0100; - break; - case 0: - cc = 0x4000; - break; - case 1: - cc = 0x0000; - break; - case 2: - default: - cc = 0x4500; - break; - } - env->fpus = (env->fpus & ~0x4500) | cc; + int ret; + + ret = floatx_compare_quiet(ST0, FT0, &env->fp_status); + env->fpus = (env->fpus & ~0x4500) | fcom_ccval[ret+ 1]; 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) { - int eflags, cc; - switch(floatx_compare(ST0, FT0, &env->fp_status)) { - case -1: - cc = CC_C; - break; - case 0: - cc = CC_Z; - break; - case 1: - cc = 0; - break; - case 2: - default: - cc = CC_Z | CC_P | CC_C; - break; - } + int eflags; + int ret; + + ret = floatx_compare(ST0, FT0, &env->fp_status); 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; FORCE_RET(); } void OPPROTO op_fucomi_ST0_FT0(void) { - int eflags, cc; - switch(floatx_compare_quiet(ST0, FT0, &env->fp_status)) { - case -1: - cc = CC_C; - break; - case 0: - cc = CC_Z; - break; - case 1: - cc = 0; - break; - case 2: - default: - cc = CC_Z | CC_P | CC_C; - break; - } + int eflags; + int ret; + + ret = floatx_compare_quiet(ST0, FT0, &env->fp_status); 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; FORCE_RET(); } |