[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 15:28:24 +1000 |
On Wed Mar 13, 2024 at 12:29 AM AEST, 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.
Oh that makes sense, thanks for the tip.
Thanks,
Nick
Re: [PATCH] target/ppc: Move floating-point arithmetic instructions to decodetree., Nicholas Piggin, 2024/03/12