qemu-devel
[Top][All Lists]
Advanced

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

Re: [Qemu-devel] [PATCH 2/2] target-mips: Implement IEEE 754-2008 functi


From: Leon Alrae
Subject: Re: [Qemu-devel] [PATCH 2/2] target-mips: Implement IEEE 754-2008 functionality for R6 and MSA instructions
Date: Fri, 1 Apr 2016 20:07:28 +0100
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:38.0) Gecko/20100101 Thunderbird/38.6.0

On 25/03/16 12:50, Aleksandar Markovic wrote:
> +#define MSA_CLASS_SIGNALING_NAN      0x001
> +#define MSA_CLASS_QUIET_NAN          0x002
> +#define MSA_CLASS_NEGATIVE_INFINITY  0x004
> +#define MSA_CLASS_NEGATIVE_NORMAL    0x008
> +#define MSA_CLASS_NEGATIVE_SUBNORMAL 0x010
> +#define MSA_CLASS_NEGATIVE_ZERO      0x020
> +#define MSA_CLASS_POSITIVE_INFINITY  0x040
> +#define MSA_CLASS_POSITIVE_NORMAL    0x080
> +#define MSA_CLASS_POSITIVE_SUBNORMAL 0x100
> +#define MSA_CLASS_POSITIVE_ZERO      0x200
> +
> +#define MSA_CLASS(name, bits)                                        \
> +uint ## bits ## _t helper_msa_ ## name (CPUMIPSState *env,           \
> +                                        uint ## bits ## _t arg)      \
> +{                                                                    \
> +    if (float ## bits ## _is_signaling_nan(arg,                      \
> +                &env->active_tc.msa_fp_status)) {                    \
> +        return MSA_CLASS_SIGNALING_NAN;                              \
> +    } else if (float ## bits ## _is_quiet_nan(arg,                   \
> +                    &env->active_tc.msa_fp_status)) {                \
> +        return MSA_CLASS_QUIET_NAN;                                  \
> +    } else if (float ## bits ## _is_neg(arg)) {                      \
> +        if (float ## bits ## _is_infinity(arg)) {                    \
> +            return MSA_CLASS_NEGATIVE_INFINITY;                      \
> +        } else if (float ## bits ## _is_zero(arg)) {                 \
> +            return MSA_CLASS_NEGATIVE_ZERO;                          \
> +        } else if (float ## bits ## _is_zero_or_denormal(arg)) {     \
> +            return MSA_CLASS_NEGATIVE_SUBNORMAL;                     \
> +        } else {                                                     \
> +            return MSA_CLASS_NEGATIVE_NORMAL;                        \
> +        }                                                            \
> +    } else {                                                         \
> +        if (float ## bits ## _is_infinity(arg)) {                    \
> +            return MSA_CLASS_POSITIVE_INFINITY;                      \
> +        } else if (float ## bits ## _is_zero(arg)) {                 \
> +            return MSA_CLASS_POSITIVE_ZERO;                          \
> +        } else if (float ## bits ## _is_zero_or_denormal(arg)) {     \
> +            return MSA_CLASS_POSITIVE_SUBNORMAL;                     \
> +        } else {                                                     \
> +            return MSA_CLASS_POSITIVE_NORMAL;                        \
> +        }                                                            \
> +    }                                                                \
> +}

Duplicating the class operation is unnecessary. We can just have common
function for FPU and MSA which takes additional float_status argument.

Also I noticed that this patch series doesn't provide Flush Subnormals
(the FCSR.FS bit), but probably this functionality can come later...

Leon



reply via email to

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