[2/6] target/arm: Ignore float_flag_input_denormal from fp_status_f16

Message ID 20180810193129.1556-3-richard.henderson@linaro.org
State New
Headers show
Series
  • target/arm: More sve-ish fixes
Related show

Commit Message

Richard Henderson Aug. 10, 2018, 7:31 p.m.
When FZ is set, input_denormal exceptions are recognized, but this does
not happen with FZ16.  The softfloat code has no way to distinguish
these bits and will raise such exceptions into fp_status_f16.flags,
so ignore them when computing the accumulated flags.

Cc: qemu-stable@nongnu.org (3.0.1)
Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/arm/helper.c | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

Comments

Laurent Desnogues Aug. 11, 2018, 4:23 p.m. | #1
On Fri, Aug 10, 2018 at 9:31 PM, Richard Henderson
<richard.henderson@linaro.org> wrote:
> When FZ is set, input_denormal exceptions are recognized, but this does
> not happen with FZ16.  The softfloat code has no way to distinguish
> these bits and will raise such exceptions into fp_status_f16.flags,
> so ignore them when computing the accumulated flags.
>
> Cc: qemu-stable@nongnu.org (3.0.1)
> Reported-by: Laurent Desnogues <laurent.desnogues@gmail.com>
> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

Tested-by: Laurent Desnogues <laurent.desnogues@gmail.com>
Reviewed-by: Laurent Desnogues <laurent.desnogues@gmail.com>

Laurent

> ---
>  target/arm/helper.c | 6 +++++-
>  1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/target/arm/helper.c b/target/arm/helper.c
> index 452d5e182a..61454a77ec 100644
> --- a/target/arm/helper.c
> +++ b/target/arm/helper.c
> @@ -11314,9 +11314,13 @@ uint32_t HELPER(vfp_get_fpscr)(CPUARMState *env)
>      fpscr = (env->vfp.xregs[ARM_VFP_FPSCR] & 0xffc8ffff)
>              | (env->vfp.vec_len << 16)
>              | (env->vfp.vec_stride << 20);
> +
>      i = get_float_exception_flags(&env->vfp.fp_status);
>      i |= get_float_exception_flags(&env->vfp.standard_fp_status);
> -    i |= get_float_exception_flags(&env->vfp.fp_status_f16);
> +    /* FZ16 does not generate an input denormal exception.  */
> +    i |= (get_float_exception_flags(&env->vfp.fp_status_f16)
> +          & ~float_flag_input_denormal);
> +
>      fpscr |= vfp_exceptbits_from_host(i);
>      return fpscr;
>  }
> --
> 2.17.1
>

Patch

diff --git a/target/arm/helper.c b/target/arm/helper.c
index 452d5e182a..61454a77ec 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -11314,9 +11314,13 @@  uint32_t HELPER(vfp_get_fpscr)(CPUARMState *env)
     fpscr = (env->vfp.xregs[ARM_VFP_FPSCR] & 0xffc8ffff)
             | (env->vfp.vec_len << 16)
             | (env->vfp.vec_stride << 20);
+
     i = get_float_exception_flags(&env->vfp.fp_status);
     i |= get_float_exception_flags(&env->vfp.standard_fp_status);
-    i |= get_float_exception_flags(&env->vfp.fp_status_f16);
+    /* FZ16 does not generate an input denormal exception.  */
+    i |= (get_float_exception_flags(&env->vfp.fp_status_f16)
+          & ~float_flag_input_denormal);
+
     fpscr |= vfp_exceptbits_from_host(i);
     return fpscr;
 }