On Sat, May 2, 2020 at 12:51 AM Richard Henderson <
address@hidden> wrote:
On 5/1/20 9:29 AM, 罗勇刚(Yonggang Luo) wrote:
> On Fri, May 1, 2020 at 10:18 PM Richard Henderson <address@hidden
> Step 1 is to rearrange the fp helpers to eliminate helper_reset_fpstatus().
> I've mentioned this before, that it's possible to leave the steady-state of
> env->fp_status.exception_flags == 0, so there's no need for a separate function
> call. I suspect this is worth a decent speedup by itself.
>
> Hi Richard, what kinds of rearrange the fp need to be done? Can you give me a
> more detailed example? I am still not get the idea.
See target/openrisc, helper_update_fpcsr.
This is like target/ppc helper_float_check_status, in that it is called after
the primary fpu helper, after the fpu result is written back to the
architectural register, to process fpu exceptions.
Note that if get_float_exception_flags returns non-zero, we immediately reset
them to zero. Thus the exception flags are only ever non-zero in between the
primary fpu operation and the update of the fpscr.
According to
```
void HELPER(update_fpcsr)(CPUOpenRISCState *env)
{
int tmp = get_float_exception_flags(&env->fp_status);
if (tmp) {
set_float_exception_flags(0, &env->fp_status);
tmp = ieee_ex_to_openrisc(tmp);
if (tmp) {
env->fpcsr |= tmp;
if (env->fpcsr & FPCSR_FPEE) {
helper_exception(env, EXCP_FPE);
}
}
}
}
```
The openrisc also clearing the flags before each fp operation?
Thus, no need for a separate helper_reset_fpstatus.
r~