qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Peter Maydell <peter.maydell@linaro.org>
To: Tom Musta <tommusta@gmail.com>
Cc: "qemu-ppc@nongnu.org" <qemu-ppc@nongnu.org>,
	QEMU Developers <qemu-devel@nongnu.org>
Subject: Re: [Qemu-devel] [PATCH] target-ppc: Bug: VSX Convert to Integer Should Truncate
Date: Sun, 23 Mar 2014 18:21:29 +0000	[thread overview]
Message-ID: <CAFEAcA8h3DN8Fxf-uCpo3QSXC-CJ3UsEg7ci1ceP6w2sGPTkNg@mail.gmail.com> (raw)
In-Reply-To: <1395597768-3159-1-git-send-email-tommusta@gmail.com>

On 23 March 2014 18:02, Tom Musta <tommusta@gmail.com> wrote:
> diff --git a/target-ppc/fpu_helper.c b/target-ppc/fpu_helper.c
> index e7f3295..ccfc5cc 100644
> --- a/target-ppc/fpu_helper.c
> +++ b/target-ppc/fpu_helper.c
> @@ -2558,10 +2558,14 @@ void helper_##op(CPUPPCState *env, uint32_t opcode)                          \
>              fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXCVI, 0);            \
>              xt.tfld = rnan;                                                  \
>          } else {                                                             \
> +            /* force round to zero mode (truncation) */                      \
> +            set_float_rounding_mode(float_round_to_zero, &env->fp_status);   \
>              xt.tfld = stp##_to_##ttp(xb.sfld, &env->fp_status);              \
>              if (env->fp_status.float_exception_flags & float_flag_invalid) { \
>                  fload_invalid_op_excp(env, POWERPC_EXCP_FP_VXCVI, 0);        \
>              }                                                                \

If we raise a CPU exception here (via helper_raise_exception_err())
we'll longjmp out of here and never restore the rounding mode. So
the restoring of the rounding mode needs to happen before we
check for exceptions here.

> +            /* restore rounding mode from FPSCR */                           \
> +            fpscr_set_rounding_mode(env);                                    \
>          }                                                                    \
>      }                                                                        \
>                                                                               \

thanks
-- PMM

  reply	other threads:[~2014-03-23 18:22 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-03-23 18:02 [Qemu-devel] [PATCH] target-ppc: Bug: VSX Convert to Integer Should Truncate Tom Musta
2014-03-23 18:21 ` Peter Maydell [this message]
2014-03-23 21:52   ` [Qemu-devel] [V2 PATCH] " Tom Musta
2014-03-25 18:06     ` Peter Maydell
2014-03-25 21:26       ` Tom Musta
2014-03-26 15:05       ` Tom Musta
2014-03-26 16:41         ` Richard Henderson

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=CAFEAcA8h3DN8Fxf-uCpo3QSXC-CJ3UsEg7ci1ceP6w2sGPTkNg@mail.gmail.com \
    --to=peter.maydell@linaro.org \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=tommusta@gmail.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).