qemu-ppc
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: An first try to improve PPC float simulation, not even compiled. Jus


From: BALATON Zoltan
Subject: Re: An first try to improve PPC float simulation, not even compiled. Just ask question.
Date: Mon, 4 May 2020 20:30:18 +0200 (CEST)
User-agent: Alpine 2.22 (BSF 395 2020-01-19)

On Mon, 4 May 2020, Richard Henderson wrote:
On 5/3/20 5:41 PM, 罗勇刚(Yonggang Luo) wrote:
On Mon, May 4, 2020 at 7:40 AM BALATON Zoltan <address@hidden
<mailto:address@hidden>> wrote:

    Hello,

    On Mon, 4 May 2020, 罗勇刚(Yonggang Luo) wrote:
   > Hello Richard, Can you have a look at the following patch, and was that are
   > the right direction?

    Formatting of the patch is broken by your mailer, try sending it with
    something that does not change it otherwise it's a bit hard to read.

    Richard suggested to add an assert to check the fp_status is correctly
    cleared in place of helper_reset_fpstatus first for debugging so you could
    change the helper accordingly before deleting it and run a few tests to
    verify it still works. You'll need get some tests and benchmarks working
    to be able to verify your changes that's why I've said that would be step
    0. If you checked that it still produces the same results and the assert
    does not trigger then you can remove the helper.

That's what I need help,
1. How to write a assert to replace helper_reset_fpstatus .
  just directly assert? or something else

You can't place the assert where helper_reset_fpstatus was.  You need to place
it in each of the helpers, like helper_fadd, that previously has a call to
helper_reset_fpstatus preceeding it.

Why? If we want to verify that clearing fp_status after flags are processed is equivalent to clearing flags before fp ops then verifying that the fp_status is already cleared when the current helper_reset_fpstatus is called should be enough to check that nothing has set the flags inbetween so the current reset helper would be no op. Therefore I thought you could put the assert there for checking this. This assert is for debugging and checking the change only and not meant to be left there otherwise we lose all the performance gain so it's easier to put in the current helper before removing it for this than in every fp op helper. What am I missing?

Regards,
BALATON Zoltan

The assert should be placed before the first floatN_op call that uses
env->fp_status.  E.g.

float64 helper_fadd(CPUPPCState *env, float64 arg1, float64 arg2)
{
   float64 ret;
   int status;

   status = get_float_exception_flags(&env->fp_status);
   assert(status == 0);
   ret = float64_add(arg1, arg2, &env->fp_status);
   status = get_float_exception_flags(&env->fp_status);

   if (unlikely(status & float_flag_invalid)) {
       float_invalid_op_addsub(env, 1, GETPC(),
                               float64_classify(arg1) |
                               float64_classify(arg2));
   }

   return ret;
}


r~


reply via email to

[Prev in Thread] Current Thread [Next in Thread]