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: Chinmay Rath
Subject: Re: [PATCH] target/ppc: Move floating-point arithmetic instructions to decodetree.
Date: Wed, 13 Mar 2024 17:20:59 +0530
User-agent: Mozilla Thunderbird



On 3/12/24 19:59, Peter Maydell wrote:
On Tue, 12 Mar 2024 at 14:25, Nicholas Piggin <npiggin@gmail.com> wrote:
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.
The standard way to fix this is that you call GETPC() at the
outermost helper and then pass that value around as an extra
uintptr_t ra argument to called functions that need it.
Thanks Peter, Nick and Richard. I shall post v2 with suggested updates.

Regards,
Chinmay

thanks
-- PMM





reply via email to

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