I'm understood. So, am I right? From: Dmitry Poletaev <poletaev-q...@yandex.ru> Signed-off-by: Dmitry Poletaev <poletaev-q...@yandex.ru>
--- target-i386/fpu_helper.c | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/target-i386/fpu_helper.c b/target-i386/fpu_helper.c index 1b2900d..c4fdad8 100644 --- a/target-i386/fpu_helper.c +++ b/target-i386/fpu_helper.c @@ -251,16 +251,31 @@ int32_t helper_fist_ST0(CPUX86State *env) int32_t helper_fistl_ST0(CPUX86State *env) { int32_t val; - + signed char old_exp_flags; + + old_exp_flags = env->fp_status.float_exception_flags; + env->fp_status.float_exception_flags = 0; val = floatx80_to_int32(ST0, &env->fp_status); + if (env->fp_status.float_exception_flags & FPUS_IE) { + val = 0x80000000; + } + env->fp_status.float_exception_flags |= old_exp_flags; return val; } int64_t helper_fistll_ST0(CPUX86State *env) { int64_t val; - - val = floatx80_to_int64(ST0, &env->fp_status); + signed char old_exp_flags; + + old_exp_flags = env->fp_status.float_exception_flags; + env->fp_status.float_exception_flags = 0; + + val = floatx80_to_int64(ST0, &env->fp_status); + if (env->fp_status.float_exception_flags & FPUS_IE) { + val = 0x8000000000000000; + } + env->fp_status.float_exception_flags |= old_exp_flags; return val; } -- 1.8.4.msysgit.0 23.07.2014, 16:42, "Peter Maydell" <peter.mayd...@linaro.org>: > On 23 July 2014 12:55, Dmitry Poletaev <poletaev-q...@yandex.ru> wrote: >> 14.07.2014, 18:59, "Peter Maydell" <peter.mayd...@linaro.org>: >>> Since softfloat's status flags are sticky ... >> What does it mean? > > "Sticky" here means that the status flags accumulate the > status from a sequence of operations: a softfloat function > will set the flag if the relevant exception occurred, but if > the exceptional condition did not happen then the flag will > be left at whatever its preceding value was. So you can't > just say "if the flag is set then the last operation I did set > it", because it might have been set by some operation > before that. (That is, once a bit gets set in the flags word > it "sticks" and doesn't go away.) > > This matches the IEEE mandated behaviour for > floating point exception flags, which is why we do it. > > thanks > -- PMM