From: Nikunj A Dadhania <nikunj@linux.vnet.ibm.com>
To: qemu-ppc@nongnu.org, david@gibson.dropbear.id.au, rth@twiddle.net
Cc: qemu-devel@nongnu.org, bharata@linux.vnet.ibm.com,
nikunj@linux.vnet.ibm.com
Subject: [Qemu-devel] [PATCH 0/3] target/ppc: floating point multiply-add fixes
Date: Fri, 3 Mar 2017 12:28:06 +0530 [thread overview]
Message-ID: <1488524289-5305-1-git-send-email-nikunj@linux.vnet.ibm.com> (raw)
Exception handling in fmadd/fmsub/fnmadd/fnmsub isnt correct as the
order of checking could give wrong settings in FPSCR.
For example, (x * y) + z, if x = infinity, y = zero and z = snan.
After the execution of instruction VXNAN and VXIMZ both should be set. For
this correct the ordering in the float64_maddsub_update_excp() as follows:
* 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.
Moreover, all vector multiply-add/substract and vector scalar multiply-add/sub
had the bug. VXISI should be set only when (∞ - ∞), where as the instruction was
doing it wrong, was just checking ((a == ∞ OR b == ∞) && (c == ∞)). There are two
issues here:
1. infinity can be +ve or -ve, i.e. (∞ + (-∞)), should result in setting VXISI
2. Need to take care of the operation (add or sub). (∞ + ∞) should not set VXISI
Patch:
01: Fixes the order of checking and makes them independent as per
the ISA
02: Introduces the macro to be used by Vector Scalar and Vector Multiply-Add
03: Make Vector Scalar and Vector Multiply Add use the macro for updating
exception flags
Nikunj A Dadhania (3):
target/ppc: fmadd check for excp independently
target/ppc: fmadd: add macro for updating flags
target/ppc: use helper for excp handling
target/ppc/fpu_helper.c | 78 +++++++++++++++++++++----------------------------
1 file changed, 33 insertions(+), 45 deletions(-)
--
2.7.4
next reply other threads:[~2017-03-03 6:58 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-03-03 6:58 Nikunj A Dadhania [this message]
2017-03-03 6:58 ` [Qemu-devel] [PATCH 1/3] target/ppc: fmadd check for excp independently Nikunj A Dadhania
2017-03-03 19:14 ` Richard Henderson
2017-03-03 6:58 ` [Qemu-devel] [PATCH 2/3] target/ppc: fmadd: add macro for updating flags Nikunj A Dadhania
2017-03-03 19:15 ` Richard Henderson
2017-03-04 13:42 ` [Qemu-devel] [Qemu-ppc] " Nikunj Dadhania
2017-03-03 6:58 ` [Qemu-devel] [PATCH 3/3] target/ppc: use helper for excp handling Nikunj A Dadhania
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=1488524289-5305-1-git-send-email-nikunj@linux.vnet.ibm.com \
--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 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).