From: Aurelien Jarno <aurelien@aurel32.net>
To: Peter Maydell <peter.maydell@linaro.org>
Cc: qemu-devel@nongnu.org, patches@linaro.org
Subject: Re: [Qemu-devel] [PATCH] target-arm: Set Invalid flag for NaN in float-to-int conversions
Date: Wed, 20 Apr 2011 13:02:43 +0200 [thread overview]
Message-ID: <20110420110243.GD24035@volta.aurel32.net> (raw)
In-Reply-To: <1303230655-31280-1-git-send-email-peter.maydell@linaro.org>
On Tue, Apr 19, 2011 at 05:30:55PM +0100, Peter Maydell wrote:
> When we catch the special case of an input NaN in ARM float to int
> helper functions, set the Invalid flag as well as returning the
> correct result.
>
> Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
> ---
> target-arm/helper.c | 9 +++++++++
> 1 files changed, 9 insertions(+), 0 deletions(-)
Thanks, applied.
> diff --git a/target-arm/helper.c b/target-arm/helper.c
> index 12127de..d5f2ace 100644
> --- a/target-arm/helper.c
> +++ b/target-arm/helper.c
> @@ -2542,6 +2542,7 @@ float64 VFP_HELPER(sito, d)(uint32_t x, CPUState *env)
> uint32_t VFP_HELPER(toui, s)(float32 x, CPUState *env)
> {
> if (float32_is_any_nan(x)) {
> + float_raise(float_flag_invalid, &env->vfp.fp_status);
> return 0;
> }
> return float32_to_uint32(x, &env->vfp.fp_status);
> @@ -2550,6 +2551,7 @@ uint32_t VFP_HELPER(toui, s)(float32 x, CPUState *env)
> uint32_t VFP_HELPER(toui, d)(float64 x, CPUState *env)
> {
> if (float64_is_any_nan(x)) {
> + float_raise(float_flag_invalid, &env->vfp.fp_status);
> return 0;
> }
> return float64_to_uint32(x, &env->vfp.fp_status);
> @@ -2558,6 +2560,7 @@ uint32_t VFP_HELPER(toui, d)(float64 x, CPUState *env)
> uint32_t VFP_HELPER(tosi, s)(float32 x, CPUState *env)
> {
> if (float32_is_any_nan(x)) {
> + float_raise(float_flag_invalid, &env->vfp.fp_status);
> return 0;
> }
> return float32_to_int32(x, &env->vfp.fp_status);
> @@ -2566,6 +2569,7 @@ uint32_t VFP_HELPER(tosi, s)(float32 x, CPUState *env)
> uint32_t VFP_HELPER(tosi, d)(float64 x, CPUState *env)
> {
> if (float64_is_any_nan(x)) {
> + float_raise(float_flag_invalid, &env->vfp.fp_status);
> return 0;
> }
> return float64_to_int32(x, &env->vfp.fp_status);
> @@ -2574,6 +2578,7 @@ uint32_t VFP_HELPER(tosi, d)(float64 x, CPUState *env)
> uint32_t VFP_HELPER(touiz, s)(float32 x, CPUState *env)
> {
> if (float32_is_any_nan(x)) {
> + float_raise(float_flag_invalid, &env->vfp.fp_status);
> return 0;
> }
> return float32_to_uint32_round_to_zero(x, &env->vfp.fp_status);
> @@ -2582,6 +2587,7 @@ uint32_t VFP_HELPER(touiz, s)(float32 x, CPUState *env)
> uint32_t VFP_HELPER(touiz, d)(float64 x, CPUState *env)
> {
> if (float64_is_any_nan(x)) {
> + float_raise(float_flag_invalid, &env->vfp.fp_status);
> return 0;
> }
> return float64_to_uint32_round_to_zero(x, &env->vfp.fp_status);
> @@ -2590,6 +2596,7 @@ uint32_t VFP_HELPER(touiz, d)(float64 x, CPUState *env)
> uint32_t VFP_HELPER(tosiz, s)(float32 x, CPUState *env)
> {
> if (float32_is_any_nan(x)) {
> + float_raise(float_flag_invalid, &env->vfp.fp_status);
> return 0;
> }
> return float32_to_int32_round_to_zero(x, &env->vfp.fp_status);
> @@ -2598,6 +2605,7 @@ uint32_t VFP_HELPER(tosiz, s)(float32 x, CPUState *env)
> uint32_t VFP_HELPER(tosiz, d)(float64 x, CPUState *env)
> {
> if (float64_is_any_nan(x)) {
> + float_raise(float_flag_invalid, &env->vfp.fp_status);
> return 0;
> }
> return float64_to_int32_round_to_zero(x, &env->vfp.fp_status);
> @@ -2636,6 +2644,7 @@ uint##fsz##_t VFP_HELPER(to##name, p)(float##fsz x, uint32_t shift, \
> { \
> float##fsz tmp; \
> if (float##fsz##_is_any_nan(x)) { \
> + float_raise(float_flag_invalid, &env->vfp.fp_status); \
> return 0; \
> } \
> tmp = float##fsz##_scalbn(x, shift, &env->vfp.fp_status); \
> --
> 1.7.1
>
>
>
--
Aurelien Jarno GPG: 1024D/F1BCDB73
aurelien@aurel32.net http://www.aurel32.net
prev parent reply other threads:[~2011-04-20 11:03 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-04-19 16:30 [Qemu-devel] [PATCH] target-arm: Set Invalid flag for NaN in float-to-int conversions Peter Maydell
2011-04-20 11:02 ` Aurelien Jarno [this message]
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=20110420110243.GD24035@volta.aurel32.net \
--to=aurelien@aurel32.net \
--cc=patches@linaro.org \
--cc=peter.maydell@linaro.org \
--cc=qemu-devel@nongnu.org \
/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.