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
this correct the ordering in the float64_maddsub_update_excp() as
* 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
the opposite sign, vxisi_flag is set to 1.
Moreover, all vector multiply-add/substract and vector scalar
had the bug. VXISI should be set only when (? - ?), where as the
doing it wrong, was just checking ((a == ? OR b == ?) && (c == ?)).
There are two
1. infinity can be +ve or -ve, i.e. (? + (-?)), should result in
2. Need to take care of the operation (add or sub). (? + ?) should
not set VXISI
01: Fixes the order of checking and makes them independent as per
02: Introduces the macro to be used by Vector Scalar and Vector
03: Make Vector Scalar and Vector Multiply Add use the macro for
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(-)