Re: [PATCH 2/2] target/i386: fix IEEE x87 floating-point exception raising

2021-05-20 Thread Peter Maydell
On Fri, 15 May 2020 at 22:23, Joseph Myers wrote: > > Most x87 instruction implementations fail to raise the expected IEEE > floating-point exceptions because they do nothing to convert the > exception state from the softfloat machinery into the exception flags > in the x87 status word. There is

Re: [PATCH 2/2] target/i386: fix IEEE x87 floating-point exception raising

2020-05-19 Thread Joseph Myers
On Tue, 19 May 2020, Richard Henderson wrote: > > Note that another bug in the x87 emulation is the lack of setting C1 for > > most instructions with inexact results based on the direction of rounding > > (which will require a new feature to be added to the softfloat code to > > record that inf

Re: [PATCH 2/2] target/i386: fix IEEE x87 floating-point exception raising

2020-05-19 Thread Richard Henderson
On 5/19/20 11:12 AM, Joseph Myers wrote: > On Tue, 19 May 2020, Richard Henderson wrote: > >> To retain the hard float fast path, we need to leave float_flag_invalid set >> when the accrued exception bit is set. To me this suggests keep all of the >> FPUS_* bits in fp_status and only convert to F

Re: [PATCH 2/2] target/i386: fix IEEE x87 floating-point exception raising

2020-05-19 Thread Joseph Myers
On Tue, 19 May 2020, Richard Henderson wrote: > To retain the hard float fast path, we need to leave float_flag_invalid set > when the accrued exception bit is set. To me this suggests keep all of the > FPUS_* bits in fp_status and only convert to FPUS_* when we read the fp status > word. There

Re: [PATCH 2/2] target/i386: fix IEEE x87 floating-point exception raising

2020-05-19 Thread Richard Henderson
On 5/15/20 2:21 PM, Joseph Myers wrote: > +uint8_t new_flags = get_float_exception_flags(&env->fp_status); > +float_raise(old_flags, &env->fp_status); > +fpu_set_exception(env, > + ((new_flags & float_flag_invalid ? FPUS_IE : 0) | > + (new_flag

[PATCH 2/2] target/i386: fix IEEE x87 floating-point exception raising

2020-05-15 Thread Joseph Myers
Most x87 instruction implementations fail to raise the expected IEEE floating-point exceptions because they do nothing to convert the exception state from the softfloat machinery into the exception flags in the x87 status word. There is special-case handling of division to raise the divide-by-zero