qemu-ppc
[Top][All Lists]
Advanced

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

Re: [Qemu-ppc] [PATCH 6/7] target-ppc: Add xvtstdc[sp, dp] instructions


From: Richard Henderson
Subject: Re: [Qemu-ppc] [PATCH 6/7] target-ppc: Add xvtstdc[sp, dp] instructions
Date: Thu, 12 Jan 2017 09:23:38 -0800
User-agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.6.0

On 01/12/2017 08:24 AM, Nikunj A Dadhania wrote:
> +        nan = tp##_is_any_nan(xb.fld);                      \
> +        infinity = tp##_is_infinity(xb.fld);                \
> +        sign = tp##_is_neg(xb.fld);                         \
> +        zero = denormal = 0;                                \
> +        if (tp##_is_zero_or_denormal(xb.fld)) {             \
> +            if (tp##_is_zero(xb.fld)) {                     \
> +                zero = 1;                                   \
> +            } else {                                        \
> +                denormal = 1;                               \
> +            }                                               \
> +        }                                                   \
> +                                                            \
> +        if ((extract32(dcmx, 6, 1) && nan) ||               \
> +            (extract32(dcmx, 5, 1) && infinity && !sign) || \
> +            (extract32(dcmx, 4, 1) && infinity &&  sign) || \
> +            (extract32(dcmx, 3, 1) && zero     && !sign) || \
> +            (extract32(dcmx, 3, 1) && zero     &&  sign) || \
> +            (extract32(dcmx, 1, 1) && denormal && !sign) || \
> +            (extract32(dcmx, 0, 1) && denormal &&  sign)) { \
> +            match = 1;                                      \
> +        }                                                   \

I'll note that all of these are mutually exclusive, therefore you're doing much
more work than required.

  sign = tp##_is_neg(x));
  if (tp##is_any_nan(x)) {
      match = extract32(dcmx, 6, 1);
  } else if (tp##_is_infinity(x)) {
      match = extract32(dcmx, 4 + !sign, 1);
  } else if (tp##_is_zero(x)) {
      match = extract32(dcmx, 2 + !sign, 1);
  } else if (tp##_is_zero_or_denormal(x)) {
      match = extract32(dcmx, 0 + !sign, 1);
  }

(Also, an apparent typo for your zero && sign case.)


r~



reply via email to

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