qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Qemu-devel] [PATCH 2/4] target-tricore: Added MADD.F and MSUB.F ins


From: Bastian Koppelmann
Subject: Re: [Qemu-devel] [PATCH 2/4] target-tricore: Added MADD.F and MSUB.F instructions
Date: Tue, 31 May 2016 13:13:09 +0200
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.1.0

On 05/30/2016 12:59 AM, address@hidden wrote:
> +uint32_t helper_fmadd(CPUTriCoreState *env, uint32_t r1,
> +                      uint32_t r2, uint32_t r3)
> +{
> +    uint32_t flags;
> +    float32 arg1 = make_float32(r1);
> +    float32 arg2 = make_float32(r2);
> +    float32 arg3 = make_float32(r3);
> +    float32 f_result;
> +
> +    flags = f_get_excp_flags(env);
> +    f_result = float32_muladd(arg1, arg2, arg3, flags, &env->fp_status);
The flags argument allows the caller to select negation of the
addend, the intermediate product, or the final result. These are not
excp_flags. Additionally, you need to collect the excp_flags after doing
the muladd.
> +
> +    if (flags) {
> +        /* If the output is a NaN, but the inputs aren't,
> +           we return a unique value.  */
> +        if ((flags & float_flag_invalid)
> +            && !float32_is_any_nan(arg1)
> +            && !float32_is_any_nan(arg2)) {
You are not doing what the comment says. You have three inputs here but
you only check two.

> +    float32 arg2 = make_float32(r2);
> +    float32 arg3 = make_float32(r3);
> +    float32 f_result;
> +
> +    flags = f_get_excp_flags(env);
> +    f_result = float32_muladd(-arg1, arg2, arg3, flags, &env->fp_status);
Likewise.

> +    if (flags) {
> +        /* If the output is a NaN, but the inputs aren't,
> +           we return a unique value.  */
> +        if ((flags & float_flag_invalid)
> +            && !float32_is_any_nan(arg1)
> +            && !float32_is_any_nan(arg2)) {
Likewise.

Cheers,
    Bastian




reply via email to

[Prev in Thread] Current Thread [Next in Thread]