qemu-ppc
[Top][All Lists]
Advanced

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

Re: [PATCH] target/ppc: Move floating-point arithmetic instructions to d


From: Nicholas Piggin
Subject: Re: [PATCH] target/ppc: Move floating-point arithmetic instructions to decodetree.
Date: Wed, 13 Mar 2024 00:24:09 +1000

On Wed Mar 13, 2024 at 12:01 AM AEST, Richard Henderson wrote:
> On 3/11/24 23:36, Nicholas Piggin wrote:

[snip]

> > 
> > #define FPU_HELPER(name, op, flags_handler)                           \
> > float64 helper_##name(CPUPPCState *env, float64 arg1, float64 arg2)   \
> > {                                                                     \
> >      float64 ret = op(arg1, arg2, &env->fp_status);                    \
> >      int flags = get_float_exception_flags(&env->fp_status);           \
> >      flags_handler(env, flags)                                         \
> >      return ret;                                                       \
> > }
> > 
> > static inline void addsub_flags_handler(CPUPPCState *env, int flags)
> > {
> >      if (unlikely(flags & float_flag_invalid)) {
> >          float_invalid_op_addsub(env, flags, 1, GETPC());
> >      }
> > }
> > 
> > static inline void mul_flags_handler(CPUPPCState *env, int flags)
> > {
> >      if (unlikely(flags & float_flag_invalid)) {
> >          float_invalid_op_mul(env, flags, 1, GETPC());
> >      }
> > }
> > 
> > static inline void div_flags_handler(CPUPPCState *env, int flags)
> > {
> >      if (unlikely(flags & float_flag_invalid)) {
> >          float_invalid_op_div(env, flags, 1, GETPC());
> >      }
> >      if (unlikely(flags & float_flag_divbyzero)) {
> >          float_zero_divide_excp(env, GETPC());
> >      }
> > }
>
> Beware -- GETPC() may only be called from the outermost helper.

Ah, because it's using __builtin_return_address. Good to know.
Using always_inline and a comment should do the trick then.

BTW., to Chinmay, don't feel the need to rework your patch this
way if that's creating a lot more work for your tested patch. What
you have is already good if it can just be split in 2 plus the
minor other changes. This could always be done afterwards.

Thanks,
Nick



reply via email to

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