aboutsummaryrefslogtreecommitdiff
path: root/fpu
diff options
context:
space:
mode:
authorIlya Leoshkevich <iii@linux.ibm.com>2024-10-23 01:59:18 +0200
committerThomas Huth <thuth@redhat.com>2024-11-18 10:54:42 +0100
commite1f1ccb8f0a476198ce8adff566db26b7143e975 (patch)
treeb29396322341dd2a2a54c338297f5bac4e80f4a1 /fpu
parent80c80346ebd8a36b778cb634732b427862de7cb1 (diff)
target/s390x: Fix the floating-point multiply-and-add NaN rules
Order the helper arguments to match the Principles of Operation. Implement the "Results: MULTIPLY AND ADD" table in pickNaNMulAdd(). Reported-by: Peter Maydell <peter.maydell@linaro.org> Signed-off-by: Ilya Leoshkevich <iii@linux.ibm.com> Reviewed-by: Peter Maydell <peter.maydell@linaro.org> Message-ID: <20241023000147.34035-2-iii@linux.ibm.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
Diffstat (limited to 'fpu')
-rw-r--r--fpu/softfloat-specialize.c.inc19
1 files changed, 19 insertions, 0 deletions
diff --git a/fpu/softfloat-specialize.c.inc b/fpu/softfloat-specialize.c.inc
index b5a3208050..9bca03c4ae 100644
--- a/fpu/softfloat-specialize.c.inc
+++ b/fpu/softfloat-specialize.c.inc
@@ -597,6 +597,25 @@ static int pickNaNMulAdd(FloatClass a_cls, FloatClass b_cls, FloatClass c_cls,
float_raise(float_flag_invalid | float_flag_invalid_imz, status);
}
return 3; /* default NaN */
+#elif defined(TARGET_S390X)
+ if (infzero) {
+ float_raise(float_flag_invalid | float_flag_invalid_imz, status);
+ return 3;
+ }
+
+ if (is_snan(a_cls)) {
+ return 0;
+ } else if (is_snan(b_cls)) {
+ return 1;
+ } else if (is_snan(c_cls)) {
+ return 2;
+ } else if (is_qnan(a_cls)) {
+ return 0;
+ } else if (is_qnan(b_cls)) {
+ return 1;
+ } else {
+ return 2;
+ }
#elif defined(TARGET_SPARC)
/* For (inf,0,nan) return c. */
if (infzero) {