qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [Qemu-devel] [PATCH v1 0/3] target/ppc: floating point multiply-add fixes
@ 2017-03-04 14:02 Nikunj A Dadhania
  2017-03-04 14:02 ` [Qemu-devel] [PATCH v1 1/3] target/ppc: fmadd check for excp independently Nikunj A Dadhania
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Nikunj A Dadhania @ 2017-03-04 14:02 UTC (permalink / raw)
  To: qemu-ppc, david, rth; +Cc: qemu-devel, bharata, nikunj

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 

Changelog:
v0:
* Use ALL CAPS for macro arguments
* Correct the argument type in the function

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 | 77 ++++++++++++++++++++-----------------------------
 1 file changed, 32 insertions(+), 45 deletions(-)

-- 
2.7.4

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-03-04 14:02 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-03-04 14:02 [Qemu-devel] [PATCH v1 0/3] target/ppc: floating point multiply-add fixes Nikunj A Dadhania
2017-03-04 14:02 ` [Qemu-devel] [PATCH v1 1/3] target/ppc: fmadd check for excp independently Nikunj A Dadhania
2017-03-04 14:02 ` [Qemu-devel] [PATCH v1 2/3] target/ppc: fmadd: add macro for updating flags Nikunj A Dadhania
2017-03-04 14:02 ` [Qemu-devel] [PATCH v1 3/3] target/ppc: use helper for excp handling Nikunj A Dadhania

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).