All of lore.kernel.org
 help / color / mirror / Atom feed
From: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
To: Richard Henderson <rth@twiddle.net>,
	qemu-ppc@nongnu.org, david@gibson.dropbear.id.au
Cc: qemu-devel@nongnu.org, bharata@linux.vnet.ibm.com
Subject: Re: [Qemu-devel] [PATCH v2] target/ppc: rewrite f[n]m[add, sub] using float64_muladd
Date: Fri, 03 Mar 2017 09:31:52 +0530	[thread overview]
Message-ID: <87varr2ekv.fsf@abhimanyu.i-did-not-set--mail-host-address--so-tickle-me> (raw)
In-Reply-To: <18786e9b-277c-2a66-1662-55a9325a9d2c@twiddle.net>

Richard Henderson <rth@twiddle.net> writes:
> On 03/03/2017 01:10 AM, Nikunj A Dadhania wrote:
>> +static void float64_maddsub_update_excp(CPUPPCState *env, float64 arg1,
>> +                                        float64 arg2, float64 arg3,
>> +                                        unsigned int madd_flags)
>>  {
>> +    if (unlikely((float64_is_infinity(arg1) && float64_is_zero(arg2)) ||
>> +                 (float64_is_zero(arg1) && float64_is_infinity(arg2)))) {
>>          /* Multiplication of zero by infinity */
>> +        arg1 = float_invalid_op_excp(env, POWERPC_EXCP_FP_VXIMZ, 1);
>> +    } else if (unlikely(float64_is_signaling_nan(arg1, &env->fp_status) ||
>> +                        float64_is_signaling_nan(arg2, &env->fp_status) ||
>> +                        float64_is_signaling_nan(arg3, &env->fp_status))) {
>> +        /* sNaN operation */
>> +        float_invalid_op_excp(env, POWERPC_EXCP_FP_VXSNAN, 1);
>
> Are you sure you shouldn't be testing for NaN first?

I have tried to retain the old order of checking. While when I see
MultiplyAddDP(x,y,z) in ISA, following is the order:

    * If x, y or z is an SNaN, vxsnan_flag is set to 1.
    * If x is a Zero and y, is an Infinity or x is an Infinity and y is
      an Zero, vximz_flag is set to 1.
    * If the product of x and y is an Infinity and z is an Infinity of
      the opposite sign, vxisi_flag is set to 1.

In that case, I need to get rid of nested if-else and make each of them
independent checks.
    
> Do you really get VXIMZ if arg3 (the addend) is (S)NaN?

Yes, with the above logic yes. 

> You should probably eliminate QNaN as well, before the other checks.

MultiplyAddDP does not eliminate QNaN. But then, there is detailed spec
on what should be returned in various cases(Page 469 ISA 3.0)

Regards
Nikunj

      parent reply	other threads:[~2017-03-03  4:03 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-03-02 14:10 [Qemu-devel] [PATCH v2] target/ppc: rewrite f[n]m[add, sub] using float64_muladd Nikunj A Dadhania
2017-03-03  1:18 ` David Gibson
2017-03-03  3:31 ` Richard Henderson
2017-03-03  3:52   ` David Gibson
2017-03-03  4:22     ` Nikunj A Dadhania
2017-03-03  4:01   ` Nikunj A Dadhania [this message]

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=87varr2ekv.fsf@abhimanyu.i-did-not-set--mail-host-address--so-tickle-me \
    --to=nikunj@linux.vnet.ibm.com \
    --cc=bharata@linux.vnet.ibm.com \
    --cc=david@gibson.dropbear.id.au \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-ppc@nongnu.org \
    --cc=rth@twiddle.net \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.