From: "Nicholas Piggin" <npiggin@gmail.com>
To: "Peter Maydell" <peter.maydell@linaro.org>
Cc: "Richard Henderson" <richard.henderson@linaro.org>,
"Chinmay Rath" <rathc@linux.ibm.com>, <qemu-ppc@nongnu.org>,
<qemu-devel@nongnu.org>, <danielhb413@gmail.com>, <clg@kaod.org>,
<harshpb@linux.ibm.com>, <sbhat@linux.ibm.com>
Subject: Re: [PATCH] target/ppc: Move floating-point arithmetic instructions to decodetree.
Date: Wed, 13 Mar 2024 15:28:24 +1000 [thread overview]
Message-ID: <CZSDHCIGS20N.2X51Z0GLK9O7S@wheely> (raw)
In-Reply-To: <CAFEAcA8im7S-bsx-hYqgUy4tsc8yXjWQf7Sb-=KnuREyqqC8mw@mail.gmail.com>
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
next prev parent reply other threads:[~2024-03-13 5:29 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-03-07 11:03 [PATCH] target/ppc: Move floating-point arithmetic instructions to decodetree Chinmay Rath
2024-03-12 9:36 ` Nicholas Piggin
2024-03-12 14:01 ` Richard Henderson
2024-03-12 14:24 ` Nicholas Piggin
2024-03-12 14:29 ` Peter Maydell
2024-03-13 5:28 ` Nicholas Piggin [this message]
2024-03-13 11:50 ` Chinmay Rath
2024-03-12 14:45 ` Richard Henderson
2024-03-12 10:01 ` Nicholas Piggin
2024-03-13 11:52 ` Chinmay Rath
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CZSDHCIGS20N.2X51Z0GLK9O7S@wheely \
--to=npiggin@gmail.com \
--cc=clg@kaod.org \
--cc=danielhb413@gmail.com \
--cc=harshpb@linux.ibm.com \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
--cc=qemu-ppc@nongnu.org \
--cc=rathc@linux.ibm.com \
--cc=richard.henderson@linaro.org \
--cc=sbhat@linux.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.