qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Richard Henderson <rth@twiddle.net>
To: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>,
	qemu-ppc@nongnu.org, david@gibson.dropbear.id.au
Cc: qemu-devel@nongnu.org, bharata@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH 6/7] target-ppc: Add xvtstdc[sp, dp] instructions
Date: Thu, 12 Jan 2017 09:23:38 -0800	[thread overview]
Message-ID: <1145c965-e1e5-025f-c88b-de0dd614fee1@twiddle.net> (raw)
In-Reply-To: <1484238251-8096-7-git-send-email-nikunj@linux.vnet.ibm.com>

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	other threads:[~2017-01-12 17:23 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-12 16:24 [Qemu-devel] [PATCH 0/7] POWER9 TCG enablements - part12 Nikunj A Dadhania
2017-01-12 16:24 ` [Qemu-devel] [PATCH 1/7] target-ppc: Use ppc_vsr_t.f128 in xscmp[o, u, exp]qp Nikunj A Dadhania
2017-01-12 16:24 ` [Qemu-devel] [PATCH 2/7] target-ppc: Add xscvsdqp and xscvudqp instructions Nikunj A Dadhania
2017-01-12 16:24 ` [Qemu-devel] [PATCH 3/7] target-ppc: Add xsdivqp instruction Nikunj A Dadhania
2017-01-12 16:24 ` [Qemu-devel] [PATCH 4/7] target-ppc: Add xsmulqp instruction Nikunj A Dadhania
2017-01-12 16:24 ` [Qemu-devel] [PATCH 5/7] target-ppc: Add xvcv[hpsp, sphp] instructions Nikunj A Dadhania
2017-01-12 16:24 ` [Qemu-devel] [PATCH 6/7] target-ppc: Add xvtstdc[sp, dp] instructions Nikunj A Dadhania
2017-01-12 17:23   ` Richard Henderson [this message]
2017-01-13  3:32     ` Nikunj A Dadhania
2017-01-12 16:24 ` [Qemu-devel] [PATCH 7/7] target-ppc: Add xststdc[sp, dp, qp] instructions Nikunj A Dadhania
2017-01-13  3:01 ` [Qemu-devel] [PATCH 0/7] POWER9 TCG enablements - part12 David Gibson

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1145c965-e1e5-025f-c88b-de0dd614fee1@twiddle.net \
    --to=rth@twiddle.net \
    --cc=bharata@linux.vnet.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=nikunj@linux.vnet.ibm.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).