On Fri, 30 Apr 2021 at 22:24, Richard Henderson
<richard.hender...@linaro.org> wrote:
>
> From: Stephen Long <stepl...@quicinc.com>
>
> Signed-off-by: Stephen Long <stepl...@quicinc.com>
> Message-Id: <20200430191405.21641-1-stepl...@quicinc.com>
> Signed-off-by: Richard Henderson <richard.hender...@linaro.org>
> ---
> v2: Fixed esz index and c++ comments
> v3: Fixed denormal arithmetic and raise invalid.

> +static int64_t do_float64_logb_as_int(float64 a, float_status *s)
> +{
> +    if (float64_is_normal(a)) {
> +        return extract64(a, 52, 11) - 1023;
> +    } else if (float64_is_infinity(a)) {
> +        return INT64_MAX;
> +    } else if (float64_is_any_nan(a) || float64_is_zero(a)) {
> +        float_raise(float_flag_invalid, s);
> +        return INT64_MIN;
> +    } else {
> +        /* denormal (see above) */
> +        return -1023 + 12 - clz64(extract64(a, 0, 52));
> +    }
> +}

These don't look like they're handling denormal inputs quite right:
 * should raise the input-denormal exception
 * should flush-to-zero if that is enabled

thanks
-- PMM

Reply via email to