* [PATCH v2 3/6] tests/tcg: extend the float_madds test case
2026-12-01 11:29 [PATCH v2 0/6] [soft|hard]float: tests and bug fix for #5203 Alex Bennée
2026-12-01 11:29 ` [PATCH v2 1/6] meson: expose MESON_SOURCE_ROOT to scripts Alex Bennée
2026-12-01 11:30 ` [PATCH v2 2/6] scripts/tests: add regen-reference.sh Alex Bennée
@ 2026-12-01 11:30 ` Alex Bennée
2026-12-02 21:12 ` Pierrick Bouvier
2026-12-02 21:35 ` Richard Henderson
2026-12-01 11:30 ` [PATCH v2 4/6] fpu/softfloat: gate hardfloat on working fmaf Alex Bennée
` (2 subsequent siblings)
5 siblings, 2 replies; 18+ messages in thread
From: Alex Bennée @ 2026-12-01 11:30 UTC (permalink / raw)
To: qemu-devel
Cc: Aurelien Jarno, Daniel P. Berrangé, Chinmay Rath,
Helge Deller, Chao Liu, Weiwei Li, David Hildenbrand,
Marc-André Lureau, LIU Zhiwei, Pierrick Bouvier, qemu-riscv,
qemu-s390x, Brian Cain, Alistair Francis, Ilya Leoshkevich,
Philippe Mathieu-Daudé, Song Gao, Palmer Dabbelt, qemu-arm,
Stafford Horne, Peter Maydell, Yoshinori Sato, qemu-ppc,
Daniel Henrique Barboza, Bibo Mao, Xianglai Li, Laurent Vivier,
Jiaxun Yang, Richard Henderson, Harsh Prateek Bora,
Alex Bennée, Nicholas Piggin, Aleksandar Rikalo,
Paolo Bonzini, Glenn Miles
We have a bug report about a failing case when using a broken
mingw-w64 and in the upstream bug there where some additional test
cases added. Import them into our *-user test so we can verify the fix
later.
I've regenerated the references with the new TCG helper script but I
have verified they are correct for arm, aarch64, ppc64 and s390x.
BugLink: https://sourceforge.net/p/mingw-w64/bugs/848/
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
v2
- fixed the refs
---
tests/tcg/multiarch/float_madds.c | 13 ++++++
tests/tcg/aarch64/float_madds.ref | 64 +++++++++++++++++++++++++++
tests/tcg/alpha/float_madds.ref | 64 +++++++++++++++++++++++++++
tests/tcg/arm/float_madds.ref | 64 +++++++++++++++++++++++++++
tests/tcg/hexagon/float_madds.ref | 64 +++++++++++++++++++++++++++
tests/tcg/hppa/float_madds.ref | 64 +++++++++++++++++++++++++++
tests/tcg/i386/float_madds.ref | 64 +++++++++++++++++++++++++++
tests/tcg/loongarch64/float_madds.ref | 64 +++++++++++++++++++++++++++
tests/tcg/m68k/float_madds.ref | 64 +++++++++++++++++++++++++++
tests/tcg/mips/float_madds.ref | 64 +++++++++++++++++++++++++++
tests/tcg/mips64/float_madds.ref | 64 +++++++++++++++++++++++++++
tests/tcg/mips64el/float_madds.ref | 64 +++++++++++++++++++++++++++
tests/tcg/mipsel/float_madds.ref | 64 +++++++++++++++++++++++++++
tests/tcg/or1k/float_madds.ref | 16 +++++++
tests/tcg/ppc64/float_madds.ref | 64 +++++++++++++++++++++++++++
tests/tcg/ppc64le/float_madds.ref | 64 +++++++++++++++++++++++++++
tests/tcg/riscv64/float_madds.ref | 64 +++++++++++++++++++++++++++
tests/tcg/s390x/float_madds.ref | 64 +++++++++++++++++++++++++++
tests/tcg/sh4/float_madds.ref | 32 ++++++++++++++
tests/tcg/x86_64/float_madds.ref | 64 +++++++++++++++++++++++++++
20 files changed, 1149 insertions(+)
diff --git a/tests/tcg/multiarch/float_madds.c b/tests/tcg/multiarch/float_madds.c
index a692e052d5b..47d9847b573 100644
--- a/tests/tcg/multiarch/float_madds.c
+++ b/tests/tcg/multiarch/float_madds.c
@@ -99,6 +99,19 @@ int main(int argc, char *argv[argc])
printf("# LP184149\n");
do_madds(0x1.ffffffffffffcp-1022, 0x1.0000000000001p-1, 0x0.0000000000001p-1022, j, 0);
do_madds(0x8p-152, 0x8p-152, 0x8p-152, j+1, 0);
+
+ /* From https://gitlab.com/qemu-project/qemu/-/issues/5023 */
+ printf("# Issue 5023\n");
+ do_madds(FLT_MAX, 2.0f, -FLT_MAX, j+2, 0);
+
+ /* From https://gist.github.com/minoki/ff4412f2a385eab3c7e689acd589ea3e */
+ printf("# Gist cases\n");
+ do_madds(0x1p100f, 0x1p100f, -INFINITY, j+3, 0);
+ do_madds(0x1.fffffep23f, 0x1.000004p28f, 0x1.fcp5f, j+4, 0);
+ do_madds(0x1.84ae3p125f, 0x1.6p-141f, 0x1p-149f, j+5, 0);
+ do_madds(0x1.00001p50f, 0x1.1p50f, 0x1p-149f, j+6, 0);
+ do_madds(0x1.000002p50f, 0x1.8p50f, -0x1p-149f, j+7, 0);
+ do_madds(0x1.83bd78p4f, -0x1.cp118f, -0x1.344108p-2f, j+8, 0);
}
return 0;
diff --git a/tests/tcg/aarch64/float_madds.ref b/tests/tcg/aarch64/float_madds.ref
index 21c05398878..83f451ef1da 100644
--- a/tests/tcg/aarch64/float_madds.ref
+++ b/tests/tcg/aarch64/float_madds.ref
@@ -190,6 +190,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding upwards
op : f32(-nan:0xffa00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffe00000) flags=INVALID (0/0)
@@ -382,6 +398,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-148:0x00000002) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000400000000000000p+52:0x59800002) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000400000000000000p+100:0x71c00002) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
### Rounding downwards
op : f32(-nan:0xffa00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffe00000) flags=INVALID (0/0)
@@ -574,6 +606,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding to zero
op : f32(-nan:0xffa00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffe00000) flags=INVALID (0/0)
@@ -766,3 +814,19 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
diff --git a/tests/tcg/alpha/float_madds.ref b/tests/tcg/alpha/float_madds.ref
index 76996f432db..ae85eb24369 100644
--- a/tests/tcg/alpha/float_madds.ref
+++ b/tests/tcg/alpha/float_madds.ref
@@ -190,6 +190,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding upwards
op : f32(-nan:0xffa00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffe00000) flags=INVALID (0/0)
@@ -382,6 +398,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-148:0x00000002) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000400000000000000p+52:0x59800002) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000400000000000000p+100:0x71c00002) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
### Rounding downwards
op : f32(-nan:0xffa00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffe00000) flags=INVALID (0/0)
@@ -574,6 +606,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding to zero
op : f32(-nan:0xffa00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffe00000) flags=INVALID (0/0)
@@ -766,3 +814,19 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
diff --git a/tests/tcg/arm/float_madds.ref b/tests/tcg/arm/float_madds.ref
index 21c05398878..83f451ef1da 100644
--- a/tests/tcg/arm/float_madds.ref
+++ b/tests/tcg/arm/float_madds.ref
@@ -190,6 +190,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding upwards
op : f32(-nan:0xffa00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffe00000) flags=INVALID (0/0)
@@ -382,6 +398,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-148:0x00000002) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000400000000000000p+52:0x59800002) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000400000000000000p+100:0x71c00002) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
### Rounding downwards
op : f32(-nan:0xffa00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffe00000) flags=INVALID (0/0)
@@ -574,6 +606,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding to zero
op : f32(-nan:0xffa00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffe00000) flags=INVALID (0/0)
@@ -766,3 +814,19 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
diff --git a/tests/tcg/hexagon/float_madds.ref b/tests/tcg/hexagon/float_madds.ref
index a08c6160574..63585ff0dce 100644
--- a/tests/tcg/hexagon/float_madds.ref
+++ b/tests/tcg/hexagon/float_madds.ref
@@ -190,6 +190,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding upwards
op : f32(-nan:0xffa00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffffffff) flags=INVALID (0/0)
@@ -382,6 +398,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-148:0x00000002) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000400000000000000p+52:0x59800002) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000400000000000000p+100:0x71c00002) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
### Rounding downwards
op : f32(-nan:0xffa00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffffffff) flags=INVALID (0/0)
@@ -574,6 +606,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding to zero
op : f32(-nan:0xffa00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffffffff) flags=INVALID (0/0)
@@ -766,3 +814,19 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
diff --git a/tests/tcg/hppa/float_madds.ref b/tests/tcg/hppa/float_madds.ref
index b4b65f83aed..8453c191988 100644
--- a/tests/tcg/hppa/float_madds.ref
+++ b/tests/tcg/hppa/float_madds.ref
@@ -190,6 +190,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding upwards
op : f32(-nan:0xffffffff) * f32(-nan:0xffbfffff) + f32(-inf:0xff800000)
res: f32(-nan:0xffbfffff) flags=INVALID (0/0)
@@ -382,6 +398,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-148:0x00000002) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000400000000000000p+52:0x59800002) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000400000000000000p+100:0x71c00002) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
### Rounding downwards
op : f32(-nan:0xffffffff) * f32(-nan:0xffbfffff) + f32(-inf:0xff800000)
res: f32(-nan:0xffbfffff) flags=INVALID (0/0)
@@ -574,6 +606,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding to zero
op : f32(-nan:0xffffffff) * f32(-nan:0xffbfffff) + f32(-inf:0xff800000)
res: f32(-nan:0xffbfffff) flags=INVALID (0/0)
@@ -766,3 +814,19 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
diff --git a/tests/tcg/i386/float_madds.ref b/tests/tcg/i386/float_madds.ref
index bb834699311..eaca70cd21a 100644
--- a/tests/tcg/i386/float_madds.ref
+++ b/tests/tcg/i386/float_madds.ref
@@ -190,6 +190,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding upwards
op : f32(-nan:0xffe00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffc00000) flags=OK (0/0)
@@ -382,6 +398,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-148:0x00000002) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000400000000000000p+52:0x59800002) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000400000000000000p+100:0x71c00002) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
### Rounding downwards
op : f32(-nan:0xffe00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffc00000) flags=OK (0/0)
@@ -574,6 +606,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding to zero
op : f32(-nan:0xffe00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffc00000) flags=OK (0/0)
@@ -766,3 +814,19 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
diff --git a/tests/tcg/loongarch64/float_madds.ref b/tests/tcg/loongarch64/float_madds.ref
index 21c05398878..83f451ef1da 100644
--- a/tests/tcg/loongarch64/float_madds.ref
+++ b/tests/tcg/loongarch64/float_madds.ref
@@ -190,6 +190,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding upwards
op : f32(-nan:0xffa00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffe00000) flags=INVALID (0/0)
@@ -382,6 +398,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-148:0x00000002) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000400000000000000p+52:0x59800002) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000400000000000000p+100:0x71c00002) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
### Rounding downwards
op : f32(-nan:0xffa00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffe00000) flags=INVALID (0/0)
@@ -574,6 +606,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding to zero
op : f32(-nan:0xffa00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffe00000) flags=INVALID (0/0)
@@ -766,3 +814,19 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
diff --git a/tests/tcg/m68k/float_madds.ref b/tests/tcg/m68k/float_madds.ref
index 23a1357a590..44c32bf5c24 100644
--- a/tests/tcg/m68k/float_madds.ref
+++ b/tests/tcg/m68k/float_madds.ref
@@ -190,6 +190,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
### Rounding upwards
op : f32(-nan:0xffffffff) * f32(-nan:0xffffffff) + f32(-inf:0xff800000)
res: f32(-nan:0xffffffff) flags=INVALID (0/0)
@@ -382,6 +398,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
### Rounding downwards
op : f32(-nan:0xffffffff) * f32(-nan:0xffffffff) + f32(-inf:0xff800000)
res: f32(-nan:0xffffffff) flags=INVALID (0/0)
@@ -574,6 +606,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
### Rounding to zero
op : f32(-nan:0xffffffff) * f32(-nan:0xffffffff) + f32(-inf:0xff800000)
res: f32(-nan:0xffffffff) flags=INVALID (0/0)
@@ -766,3 +814,19 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
diff --git a/tests/tcg/mips/float_madds.ref b/tests/tcg/mips/float_madds.ref
index 2020c65d18e..b6eb0463eeb 100644
--- a/tests/tcg/mips/float_madds.ref
+++ b/tests/tcg/mips/float_madds.ref
@@ -190,6 +190,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding upwards
op : f32(nan:0xffffffff) * f32(nan:0xffbfffff) + f32(-inf:0xff800000)
res: f32(nan:0x7fbfffff) flags=INVALID (0/0)
@@ -382,6 +398,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-148:0x00000002) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000400000000000000p+52:0x59800002) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000400000000000000p+100:0x71c00002) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
### Rounding downwards
op : f32(nan:0xffffffff) * f32(nan:0xffbfffff) + f32(-inf:0xff800000)
res: f32(nan:0x7fbfffff) flags=INVALID (0/0)
@@ -574,6 +606,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding to zero
op : f32(nan:0xffffffff) * f32(nan:0xffbfffff) + f32(-inf:0xff800000)
res: f32(nan:0x7fbfffff) flags=INVALID (0/0)
@@ -766,3 +814,19 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
diff --git a/tests/tcg/mips64/float_madds.ref b/tests/tcg/mips64/float_madds.ref
index 2020c65d18e..b6eb0463eeb 100644
--- a/tests/tcg/mips64/float_madds.ref
+++ b/tests/tcg/mips64/float_madds.ref
@@ -190,6 +190,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding upwards
op : f32(nan:0xffffffff) * f32(nan:0xffbfffff) + f32(-inf:0xff800000)
res: f32(nan:0x7fbfffff) flags=INVALID (0/0)
@@ -382,6 +398,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-148:0x00000002) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000400000000000000p+52:0x59800002) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000400000000000000p+100:0x71c00002) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
### Rounding downwards
op : f32(nan:0xffffffff) * f32(nan:0xffbfffff) + f32(-inf:0xff800000)
res: f32(nan:0x7fbfffff) flags=INVALID (0/0)
@@ -574,6 +606,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding to zero
op : f32(nan:0xffffffff) * f32(nan:0xffbfffff) + f32(-inf:0xff800000)
res: f32(nan:0x7fbfffff) flags=INVALID (0/0)
@@ -766,3 +814,19 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
diff --git a/tests/tcg/mips64el/float_madds.ref b/tests/tcg/mips64el/float_madds.ref
index 2020c65d18e..b6eb0463eeb 100644
--- a/tests/tcg/mips64el/float_madds.ref
+++ b/tests/tcg/mips64el/float_madds.ref
@@ -190,6 +190,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding upwards
op : f32(nan:0xffffffff) * f32(nan:0xffbfffff) + f32(-inf:0xff800000)
res: f32(nan:0x7fbfffff) flags=INVALID (0/0)
@@ -382,6 +398,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-148:0x00000002) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000400000000000000p+52:0x59800002) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000400000000000000p+100:0x71c00002) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
### Rounding downwards
op : f32(nan:0xffffffff) * f32(nan:0xffbfffff) + f32(-inf:0xff800000)
res: f32(nan:0x7fbfffff) flags=INVALID (0/0)
@@ -574,6 +606,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding to zero
op : f32(nan:0xffffffff) * f32(nan:0xffbfffff) + f32(-inf:0xff800000)
res: f32(nan:0x7fbfffff) flags=INVALID (0/0)
@@ -766,3 +814,19 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
diff --git a/tests/tcg/mipsel/float_madds.ref b/tests/tcg/mipsel/float_madds.ref
index 2020c65d18e..b6eb0463eeb 100644
--- a/tests/tcg/mipsel/float_madds.ref
+++ b/tests/tcg/mipsel/float_madds.ref
@@ -190,6 +190,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding upwards
op : f32(nan:0xffffffff) * f32(nan:0xffbfffff) + f32(-inf:0xff800000)
res: f32(nan:0x7fbfffff) flags=INVALID (0/0)
@@ -382,6 +398,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-148:0x00000002) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000400000000000000p+52:0x59800002) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000400000000000000p+100:0x71c00002) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
### Rounding downwards
op : f32(nan:0xffffffff) * f32(nan:0xffbfffff) + f32(-inf:0xff800000)
res: f32(nan:0x7fbfffff) flags=INVALID (0/0)
@@ -574,6 +606,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding to zero
op : f32(nan:0xffffffff) * f32(nan:0xffbfffff) + f32(-inf:0xff800000)
res: f32(nan:0x7fbfffff) flags=INVALID (0/0)
@@ -766,3 +814,19 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
diff --git a/tests/tcg/or1k/float_madds.ref b/tests/tcg/or1k/float_madds.ref
index 2c7c35c8b47..b94d65c19e4 100644
--- a/tests/tcg/or1k/float_madds.ref
+++ b/tests/tcg/or1k/float_madds.ref
@@ -190,3 +190,19 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=OK (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=OK (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=OK (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=OK (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=OK (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=OK (39/0)
diff --git a/tests/tcg/ppc64/float_madds.ref b/tests/tcg/ppc64/float_madds.ref
index e66917cb801..a2f236127fd 100644
--- a/tests/tcg/ppc64/float_madds.ref
+++ b/tests/tcg/ppc64/float_madds.ref
@@ -190,6 +190,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding upwards
op : f32(-nan:0xffa00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffe00000) flags=INVALID (0/0)
@@ -382,6 +398,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-148:0x00000002) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000400000000000000p+52:0x59800002) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000400000000000000p+100:0x71c00002) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
### Rounding downwards
op : f32(-nan:0xffa00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffe00000) flags=INVALID (0/0)
@@ -574,6 +606,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding to zero
op : f32(-nan:0xffa00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffe00000) flags=INVALID (0/0)
@@ -766,3 +814,19 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
diff --git a/tests/tcg/ppc64le/float_madds.ref b/tests/tcg/ppc64le/float_madds.ref
index e66917cb801..a2f236127fd 100644
--- a/tests/tcg/ppc64le/float_madds.ref
+++ b/tests/tcg/ppc64le/float_madds.ref
@@ -190,6 +190,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding upwards
op : f32(-nan:0xffa00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffe00000) flags=INVALID (0/0)
@@ -382,6 +398,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-148:0x00000002) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000400000000000000p+52:0x59800002) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000400000000000000p+100:0x71c00002) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
### Rounding downwards
op : f32(-nan:0xffa00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffe00000) flags=INVALID (0/0)
@@ -574,6 +606,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding to zero
op : f32(-nan:0xffa00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffe00000) flags=INVALID (0/0)
@@ -766,3 +814,19 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
diff --git a/tests/tcg/riscv64/float_madds.ref b/tests/tcg/riscv64/float_madds.ref
index 5fe00031203..f534cdf7be3 100644
--- a/tests/tcg/riscv64/float_madds.ref
+++ b/tests/tcg/riscv64/float_madds.ref
@@ -190,6 +190,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding upwards
op : f32(nan:0xffa00000) * f32(nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(nan:0x7fc00000) flags=INVALID (0/0)
@@ -382,6 +398,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-148:0x00000002) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000400000000000000p+52:0x59800002) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000400000000000000p+100:0x71c00002) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
### Rounding downwards
op : f32(nan:0xffa00000) * f32(nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(nan:0x7fc00000) flags=INVALID (0/0)
@@ -574,6 +606,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding to zero
op : f32(nan:0xffa00000) * f32(nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(nan:0x7fc00000) flags=INVALID (0/0)
@@ -766,3 +814,19 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
diff --git a/tests/tcg/s390x/float_madds.ref b/tests/tcg/s390x/float_madds.ref
index 451cbec624d..1d3927fd8f1 100644
--- a/tests/tcg/s390x/float_madds.ref
+++ b/tests/tcg/s390x/float_madds.ref
@@ -190,6 +190,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding upwards
op : f32(-nan:0xffa00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffe00000) flags=INVALID (0/0)
@@ -382,6 +398,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-148:0x00000002) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000400000000000000p+52:0x59800002) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000400000000000000p+100:0x71c00002) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
### Rounding downwards
op : f32(-nan:0xffa00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffe00000) flags=INVALID (0/0)
@@ -574,6 +606,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding to zero
op : f32(-nan:0xffa00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffe00000) flags=INVALID (0/0)
@@ -766,3 +814,19 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
diff --git a/tests/tcg/sh4/float_madds.ref b/tests/tcg/sh4/float_madds.ref
index 6d96a2a5929..ceed6008ff8 100644
--- a/tests/tcg/sh4/float_madds.ref
+++ b/tests/tcg/sh4/float_madds.ref
@@ -190,6 +190,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding to zero
op : f32(nan:0xffa00000) * f32(nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(nan:0x7fbfffff) flags=INVALID (0/0)
@@ -382,3 +398,19 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
diff --git a/tests/tcg/x86_64/float_madds.ref b/tests/tcg/x86_64/float_madds.ref
index 79419f003e7..7bbcbab7975 100644
--- a/tests/tcg/x86_64/float_madds.ref
+++ b/tests/tcg/x86_64/float_madds.ref
@@ -190,6 +190,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding upwards
op : f32(-nan:0xffa00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffc00000) flags=INVALID (0/0)
@@ -382,6 +398,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-148:0x00000002) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000400000000000000p+52:0x59800002) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c200000000000000p-15:0x38059be1) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001200000000000000p+100:0x71880009) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000400000000000000p+100:0x71c00002) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
### Rounding downwards
op : f32(-nan:0xffa00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffc00000) flags=INVALID (0/0)
@@ -574,6 +606,22 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345ca00000000000000p+123:0xfd29a2e5) flags=INEXACT (39/0)
### Rounding to zero
op : f32(-nan:0xffa00000) * f32(-nan:0xffc00000) + f32(-inf:0xff800000)
res: f32(-nan:0xffc00000) flags=INVALID (0/0)
@@ -766,3 +814,19 @@ op : f32(0x0.00000000000000000000p+0:0000000000) * f32(0x1.00000000000000000000p
res: f32(0x0.00000000000000000000p+0:0000000000) flags=OK (31/0)
op : f32(0x1.00000000000000000000p-149:0x00000001) * f32(0x1.00000000000000000000p-149:0x00000001) + f32(0x1.00000000000000000000p-149:0x00000001)
res: f32(0x1.00000000000000000000p-149:0x00000001) flags=UNDERFLOW INEXACT (32/0)
+# Issue 5023
+op : f32(0x1.fffffe00000000000000p+127:0x7f7fffff) * f32(0x1.00000000000000000000p+1:0x40000000) + f32(-0x1.fffffe00000000000000p+127:0xff7fffff)
+res: f32(0x1.fffffe00000000000000p+127:0x7f7fffff) flags=OK (33/0)
+# Gist cases
+op : f32(0x1.00000000000000000000p+100:0x71800000) * f32(0x1.00000000000000000000p+100:0x71800000) + f32(-inf:0xff800000)
+res: f32(-inf:0xff800000) flags=OK (34/0)
+op : f32(0x1.fffffe00000000000000p+23:0x4b7fffff) * f32(0x1.00000400000000000000p+28:0x4d800002) + f32(0x1.fc000000000000000000p+5:0x427e0000)
+res: f32(0x1.00000200000000000000p+52:0x59800001) flags=INEXACT (35/0)
+op : f32(0x1.84ae3000000000000000p+125:0x7e425718) * f32(0x1.60000000000000000000p-141:0x00000160) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.0b37c000000000000000p-15:0x38059be0) flags=INEXACT (36/0)
+op : f32(0x1.00001000000000000000p+50:0x58800008) * f32(0x1.10000000000000000000p+50:0x58880000) + f32(0x1.00000000000000000000p-149:0x00000001)
+res: f32(0x1.10001000000000000000p+100:0x71880008) flags=INEXACT (37/0)
+op : f32(0x1.00000200000000000000p+50:0x58800001) * f32(0x1.80000000000000000000p+50:0x58c00000) + f32(-0x1.00000000000000000000p-149:0x80000001)
+res: f32(0x1.80000200000000000000p+100:0x71c00001) flags=INEXACT (38/0)
+op : f32(0x1.83bd7800000000000000p+4:0x41c1debc) * f32(-0x1.c0000000000000000000p+118:0xfae00000) + f32(-0x1.34410800000000000000p-2:0xbe9a2084)
+res: f32(-0x1.5345c800000000000000p+123:0xfd29a2e4) flags=INEXACT (39/0)
--
2.47.3
^ permalink raw reply related [flat|nested] 18+ messages in thread* [PATCH v2 6/6] tests/fp: add fp-test-hard
2026-12-01 11:29 [PATCH v2 0/6] [soft|hard]float: tests and bug fix for #5203 Alex Bennée
` (4 preceding siblings ...)
2026-12-01 11:30 ` [PATCH v2 5/6] fpu: promote force_soft_fma to force_soft_float Alex Bennée
@ 2026-12-01 11:30 ` Alex Bennée
5 siblings, 0 replies; 18+ messages in thread
From: Alex Bennée @ 2026-12-01 11:30 UTC (permalink / raw)
To: qemu-devel
Cc: Aurelien Jarno, Daniel P. Berrangé, Chinmay Rath,
Helge Deller, Chao Liu, Weiwei Li, David Hildenbrand,
Marc-André Lureau, LIU Zhiwei, Pierrick Bouvier, qemu-riscv,
qemu-s390x, Brian Cain, Alistair Francis, Ilya Leoshkevich,
Philippe Mathieu-Daudé, Song Gao, Palmer Dabbelt, qemu-arm,
Stafford Horne, Peter Maydell, Yoshinori Sato, qemu-ppc,
Daniel Henrique Barboza, Bibo Mao, Xianglai Li, Laurent Vivier,
Jiaxun Yang, Richard Henderson, Harsh Prateek Bora,
Alex Bennée, Nicholas Piggin, Aleksandar Rikalo,
Paolo Bonzini, Glenn Miles
We have had reports of hardfloat failures with various broken
toolchains. To avoid finding this out while running a translated guest
add a new test case to exercise the hardfloat code.
It iterates through a bunch of operations with a mixture of random and
edge case floats and runs the same operation while toggling
force_soft_float. It also ensures the status flags are set so
hardfloat can run. Any difference dump the output and exits with a
failing error code.
This is probably overkill at the moment as the toolchain errors tend
to be with places with libc gets involved with fallback
emulation (e.g. fma) rather than the raw ops themselves. However
testing all the potential hardfloat ops at least gives us a reference
point if enabling hardfloat ops on new host architectures.
AI-used-for: initial prototype, based off fp-test/fp-bench
Signed-off-by: Alex Bennée <alex.bennee@linaro.org>
---
tests/fp/fp-test-hard.c | 702 ++++++++++++++++++++++++++++++++++++++++
tests/fp/meson.build | 30 +-
2 files changed, 722 insertions(+), 10 deletions(-)
create mode 100644 tests/fp/fp-test-hard.c
diff --git a/tests/fp/fp-test-hard.c b/tests/fp/fp-test-hard.c
new file mode 100644
index 00000000000..f863f00554b
--- /dev/null
+++ b/tests/fp/fp-test-hard.c
@@ -0,0 +1,702 @@
+/*
+ * fp-test-hard.c - test QEMU's hardfloat against softfloat implementation
+ *
+ * Copyright (C) 2026, Linaro, Ltd.
+ *
+ * License: GNU GPL, version 2 or later.
+ * See the COPYING file in the top-level directory.
+ */
+#ifndef HW_POISON_H
+#error Must define HW_POISON_H to work around TARGET_* poisoning
+#endif
+
+#include "qemu/osdep.h"
+#include <float.h>
+#include "fpu/softfloat.h"
+
+#define NUM_OP_ITERATIONS 50000
+#define NUM_CONV_ITERATIONS 20000
+
+static unsigned int total_tests;
+
+typedef union {
+ float32 s;
+ float f;
+ uint32_t u;
+} ufloat32;
+
+typedef union {
+ float64 s;
+ double d;
+ uint64_t u;
+} ufloat64;
+
+static uint64_t prng_state = 0x123456789abcdef0ULL;
+
+static inline uint64_t prng_next(void)
+{
+ /* 64-bit xorshift */
+ uint64_t x = prng_state;
+ x ^= x << 13;
+ x ^= x >> 7;
+ x ^= x << 17;
+ prng_state = x;
+ return x;
+}
+
+static inline float32 prng_normal_f32(void)
+{
+ ufloat32 u;
+ do {
+ u.u = (uint32_t)prng_next();
+ } while (!float32_is_zero_or_normal(u.s));
+ return u.s;
+}
+
+static inline float64 prng_normal_f64(void)
+{
+ ufloat64 u;
+ do {
+ u.u = prng_next();
+ } while (!float64_is_zero_or_normal(u.s));
+ return u.s;
+}
+
+/* Static edge test inputs */
+static const float32 f32_edge_inputs[] = {
+ 0x00000000, /* +0.0 */
+ 0x80000000, /* -0.0 */
+ 0x3f800000, /* 1.0 */
+ 0xbf800000, /* -1.0 */
+ 0x40000000, /* 2.0 */
+ 0xc0000000, /* -2.0 */
+ 0x3f000000, /* 0.5 */
+ 0xbf000000, /* -0.5 */
+ 0x40400000, /* 3.0 */
+ 0x41200000, /* 10.0 */
+ 0x42c80000, /* 100.0 */
+ 0x00800000, /* FLT_MIN */
+ 0x01000000, /* 2 * FLT_MIN */
+ 0x7f7fffff, /* FLT_MAX */
+ 0xff7fffff, /* -FLT_MAX */
+ 0x7f7ffffe, /* nextafterf(FLT_MAX, 0) */
+ 0x7effffff, /* FLT_MAX / 2 */
+ 0x3eaaaaab, /* 1.0 / 3.0 */
+};
+
+static const float64 f64_edge_inputs[] = {
+ 0x0000000000000000ULL, /* +0.0 */
+ 0x8000000000000000ULL, /* -0.0 */
+ 0x3ff0000000000000ULL, /* 1.0 */
+ 0xbff0000000000000ULL, /* -1.0 */
+ 0x4000000000000000ULL, /* 2.0 */
+ 0xc000000000000000ULL, /* -2.0 */
+ 0x3fe0000000000000ULL, /* 0.5 */
+ 0xbfe0000000000000ULL, /* -0.5 */
+ 0x4008000000000000ULL, /* 3.0 */
+ 0x4024000000000000ULL, /* 10.0 */
+ 0x4059000000000000ULL, /* 100.0 */
+ 0x0010000000000000ULL, /* DBL_MIN */
+ 0x0020000000000000ULL, /* 2 * DBL_MIN */
+ 0x7fefffffffffffffULL, /* DBL_MAX */
+ 0xffefffffffffffffULL, /* -DBL_MAX */
+ 0x7feffffffffffffeULL, /* nextafter(DBL_MAX, 0) */
+ 0x7fdfffffffffffffULL, /* DBL_MAX / 2 */
+ 0x3fd5555555555555ULL, /* 1.0 / 3.0 */
+};
+
+/* Integer test inputs */
+static const int64_t int_edge_inputs[] = {
+ 0, 1, -1, 2, -2, 3, -3, 10, -10, 100, -100,
+ INT16_MIN, INT16_MAX,
+ INT32_MIN, INT32_MAX,
+ INT64_MIN, INT64_MAX,
+ (1LL << 24) - 1, (1LL << 24), (1LL << 24) + 1,
+ (1LL << 53) - 1, (1LL << 53), (1LL << 53) + 1,
+};
+
+static const uint64_t uint_edge_inputs[] = {
+ 0, 1, 2, 3, 10, 100,
+ UINT16_MAX,
+ UINT32_MAX,
+ UINT64_MAX,
+ (1ULL << 24) - 1, (1ULL << 24), (1ULL << 24) + 1,
+ (1ULL << 53) - 1, (1ULL << 53), (1ULL << 53) + 1,
+};
+
+/* Mix edge inputs with pseudo-random normal inputs */
+static inline float32 get_mixed_f32(void)
+{
+ /* 25% chance of returning an edge input */
+ if ((prng_next() & 3) == 0) {
+ size_t idx = prng_next() % ARRAY_SIZE(f32_edge_inputs);
+ return f32_edge_inputs[idx];
+ }
+ return prng_normal_f32();
+}
+
+static inline float64 get_mixed_f64(void)
+{
+ if ((prng_next() & 3) == 0) {
+ size_t idx = prng_next() % ARRAY_SIZE(f64_edge_inputs);
+ return f64_edge_inputs[idx];
+ }
+ return prng_normal_f64();
+}
+
+static inline int64_t get_mixed_int(void)
+{
+ if ((prng_next() & 3) == 0) {
+ size_t idx = prng_next() % ARRAY_SIZE(int_edge_inputs);
+ return int_edge_inputs[idx];
+ }
+ return (int64_t)prng_next();
+}
+
+static inline uint64_t get_mixed_uint(void)
+{
+ if ((prng_next() & 3) == 0) {
+ size_t idx = prng_next() % ARRAY_SIZE(uint_edge_inputs);
+ return uint_edge_inputs[idx];
+ }
+ return prng_next();
+}
+
+static inline void init_status(float_status *s)
+{
+ memset(s, 0, sizeof(*s));
+ /*
+ * can_use_fpu requires inexact flag to be already set and rounding mode
+ * to be float_round_nearest_even.
+ */
+ s->float_exception_flags = float_flag_inexact;
+ set_float_rounding_mode(float_round_nearest_even, s);
+ set_float_2nan_prop_rule(float_2nan_prop_s_ab, s);
+ set_float_3nan_prop_rule(float_3nan_prop_s_cab, s);
+ set_float_default_nan_pattern(0b01000000, s);
+ set_float_infzeronan_rule(float_infzeronan_dnan_if_qnan, s);
+}
+
+static G_NORETURN void report_fail_f32(const char *op_name,
+ float32 soft_res, uint8_t soft_flags,
+ float32 hard_res, uint8_t hard_flags,
+ const char *inputs_str)
+{
+ fprintf(stderr, "FAIL: %s\n", op_name);
+ fprintf(stderr, " inputs: %s\n", inputs_str);
+ fprintf(stderr, " soft: res=0x%08" PRIx32 " (flags=0x%02x)\n",
+ soft_res, soft_flags);
+ fprintf(stderr, " hard: res=0x%08" PRIx32 " (flags=0x%02x)\n",
+ hard_res, hard_flags);
+ exit(EXIT_FAILURE);
+}
+
+static G_NORETURN void report_fail_f64(const char *op_name,
+ float64 soft_res, uint8_t soft_flags,
+ float64 hard_res, uint8_t hard_flags,
+ const char *inputs_str)
+{
+ fprintf(stderr, "FAIL: %s\n", op_name);
+ fprintf(stderr, " inputs: %s\n", inputs_str);
+ fprintf(stderr, " soft: res=0x%016" PRIx64 " (flags=0x%02x)\n",
+ soft_res, soft_flags);
+ fprintf(stderr, " hard: res=0x%016" PRIx64 " (flags=0x%02x)\n",
+ hard_res, hard_flags);
+ exit(EXIT_FAILURE);
+}
+
+static inline void check_f32(const char *op_name,
+ float32 soft_res, uint8_t soft_flags,
+ float32 hard_res, uint8_t hard_flags,
+ const char *inputs_str)
+{
+ total_tests++;
+ if (unlikely(soft_res != hard_res || soft_flags != hard_flags)) {
+ report_fail_f32(op_name, soft_res, soft_flags,
+ hard_res, hard_flags, inputs_str);
+ }
+}
+
+static inline void check_f64(const char *op_name,
+ float64 soft_res, uint8_t soft_flags,
+ float64 hard_res, uint8_t hard_flags,
+ const char *inputs_str)
+{
+ total_tests++;
+ if (unlikely(soft_res != hard_res || soft_flags != hard_flags)) {
+ report_fail_f64(op_name, soft_res, soft_flags,
+ hard_res, hard_flags, inputs_str);
+ }
+}
+
+static void test_f32_op2(const char *op_name,
+ float32 (*op)(float32, float32, float_status *),
+ float32 a, float32 b)
+{
+ float_status status_soft, status_hard;
+ float32 res_soft, res_hard;
+ char inp[128];
+
+ init_status(&status_soft);
+ init_status(&status_hard);
+
+ force_soft_float = true;
+ res_soft = op(a, b, &status_soft);
+
+ force_soft_float = false;
+ res_hard = op(a, b, &status_hard);
+
+ snprintf(inp, sizeof(inp), "a=0x%08" PRIx32 ", b=0x%08" PRIx32, a, b);
+ check_f32(op_name, res_soft, status_soft.float_exception_flags,
+ res_hard, status_hard.float_exception_flags, inp);
+}
+
+static void test_f64_op2(const char *op_name,
+ float64 (*op)(float64, float64, float_status *),
+ float64 a, float64 b)
+{
+ float_status status_soft, status_hard;
+ float64 res_soft, res_hard;
+ char inp[128];
+
+ init_status(&status_soft);
+ init_status(&status_hard);
+
+ force_soft_float = true;
+ res_soft = op(a, b, &status_soft);
+
+ force_soft_float = false;
+ res_hard = op(a, b, &status_hard);
+
+ snprintf(inp, sizeof(inp), "a=0x%016" PRIx64 ", b=0x%016" PRIx64, a, b);
+ check_f64(op_name, res_soft, status_soft.float_exception_flags,
+ res_hard, status_hard.float_exception_flags, inp);
+}
+
+static void test_f32_muladd_case(float32 a, float32 b, float32 c, int flags)
+{
+ float_status status_soft, status_hard;
+ float32 res_soft, res_hard;
+ char inp[160];
+
+ init_status(&status_soft);
+ init_status(&status_hard);
+
+ force_soft_float = true;
+ res_soft = float32_muladd(a, b, c, flags, &status_soft);
+
+ force_soft_float = false;
+ res_hard = float32_muladd(a, b, c, flags, &status_hard);
+
+ snprintf(inp, sizeof(inp),
+ "a=0x%08" PRIx32 ", b=0x%08" PRIx32 ", c=0x%08" PRIx32
+ ", flags=0x%x", a, b, c, flags);
+ check_f32("f32_muladd", res_soft, status_soft.float_exception_flags,
+ res_hard, status_hard.float_exception_flags, inp);
+}
+
+static void test_f64_muladd_case(float64 a, float64 b, float64 c, int flags)
+{
+ float_status status_soft, status_hard;
+ float64 res_soft, res_hard;
+ char inp[180];
+
+ init_status(&status_soft);
+ init_status(&status_hard);
+
+ force_soft_float = true;
+ res_soft = float64_muladd(a, b, c, flags, &status_soft);
+
+ force_soft_float = false;
+ res_hard = float64_muladd(a, b, c, flags, &status_hard);
+
+ snprintf(inp, sizeof(inp),
+ "a=0x%016" PRIx64 ", b=0x%016" PRIx64 ", c=0x%016" PRIx64
+ ", flags=0x%x", a, b, c, flags);
+ check_f64("f64_muladd", res_soft, status_soft.float_exception_flags,
+ res_hard, status_hard.float_exception_flags, inp);
+}
+
+static void test_f32_sqrt_case(float32 a)
+{
+ float_status status_soft, status_hard;
+ float32 res_soft, res_hard;
+ char inp[64];
+
+ init_status(&status_soft);
+ init_status(&status_hard);
+
+ force_soft_float = true;
+ res_soft = float32_sqrt(a, &status_soft);
+
+ force_soft_float = false;
+ res_hard = float32_sqrt(a, &status_hard);
+
+ snprintf(inp, sizeof(inp), "a=0x%08" PRIx32, a);
+ check_f32("f32_sqrt", res_soft, status_soft.float_exception_flags,
+ res_hard, status_hard.float_exception_flags, inp);
+}
+
+static void test_f64_sqrt_case(float64 a)
+{
+ float_status status_soft, status_hard;
+ float64 res_soft, res_hard;
+ char inp[64];
+
+ init_status(&status_soft);
+ init_status(&status_hard);
+
+ force_soft_float = true;
+ res_soft = float64_sqrt(a, &status_soft);
+
+ force_soft_float = false;
+ res_hard = float64_sqrt(a, &status_hard);
+
+ snprintf(inp, sizeof(inp), "a=0x%016" PRIx64, a);
+ check_f64("f64_sqrt", res_soft, status_soft.float_exception_flags,
+ res_hard, status_hard.float_exception_flags, inp);
+}
+
+/* Binary FP operations runners */
+static void run_f32_binary(const char *name,
+ float32 (*op)(float32, float32, float_status *))
+{
+ size_t n_edge = ARRAY_SIZE(f32_edge_inputs);
+ size_t i, j;
+
+ for (i = 0; i < n_edge; i++) {
+ for (j = 0; j < n_edge; j++) {
+ test_f32_op2(name, op, f32_edge_inputs[i],
+ f32_edge_inputs[j]);
+ }
+ }
+
+ for (i = 0; i < NUM_OP_ITERATIONS; i++) {
+ float32 a = get_mixed_f32();
+ float32 b = get_mixed_f32();
+ test_f32_op2(name, op, a, b);
+ }
+}
+
+static void run_f64_binary(const char *name,
+ float64 (*op)(float64, float64, float_status *))
+{
+ size_t n_edge = ARRAY_SIZE(f64_edge_inputs);
+ size_t i, j;
+
+ for (i = 0; i < n_edge; i++) {
+ for (j = 0; j < n_edge; j++) {
+ test_f64_op2(name, op, f64_edge_inputs[i],
+ f64_edge_inputs[j]);
+ }
+ }
+
+ for (i = 0; i < NUM_OP_ITERATIONS; i++) {
+ float64 a = get_mixed_f64();
+ float64 b = get_mixed_f64();
+ test_f64_op2(name, op, a, b);
+ }
+}
+
+static void test_f32_add(void)
+{
+ run_f32_binary("f32_add", float32_add);
+}
+
+static void test_f32_sub(void)
+{
+ run_f32_binary("f32_sub", float32_sub);
+}
+
+static void test_f32_mul(void)
+{
+ run_f32_binary("f32_mul", float32_mul);
+}
+
+static void test_f32_div(void)
+{
+ run_f32_binary("f32_div", float32_div);
+}
+
+static void test_f64_add(void)
+{
+ run_f64_binary("f64_add", float64_add);
+}
+
+static void test_f64_sub(void)
+{
+ run_f64_binary("f64_sub", float64_sub);
+}
+
+static void test_f64_mul(void)
+{
+ run_f64_binary("f64_mul", float64_mul);
+}
+
+static void test_f64_div(void)
+{
+ run_f64_binary("f64_div", float64_div);
+}
+
+static void test_f32_muladd(void)
+{
+ static const int muladd_flags[] = {
+ 0,
+ float_muladd_negate_c,
+ float_muladd_negate_product,
+ float_muladd_negate_result,
+ float_muladd_negate_c | float_muladd_negate_product,
+ };
+ size_t nf = ARRAY_SIZE(muladd_flags);
+ size_t k;
+
+ /* Test bug 5023 vector: FLT_MAX * 2.0f - FLT_MAX */
+ float32 flt_max = 0x7f7fffff;
+ float32 two = 0x40000000;
+ float32 neg_flt_max = 0xff7fffff;
+
+ for (k = 0; k < nf; k++) {
+ int flags = muladd_flags[k];
+ test_f32_muladd_case(flt_max, two, neg_flt_max, flags);
+ test_f32_muladd_case(neg_flt_max, two, flt_max, flags);
+ test_f32_muladd_case(flt_max, 0x00000000, flt_max, flags);
+ test_f32_muladd_case(0x00000000, flt_max, flt_max, flags);
+ }
+
+ for (unsigned int i = 0; i < NUM_OP_ITERATIONS; i++) {
+ float32 a = get_mixed_f32();
+ float32 b = get_mixed_f32();
+ float32 c = get_mixed_f32();
+ int flags = muladd_flags[i % nf];
+ test_f32_muladd_case(a, b, c, flags);
+ }
+}
+
+static void test_f64_muladd(void)
+{
+ static const int muladd_flags[] = {
+ 0,
+ float_muladd_negate_c,
+ float_muladd_negate_product,
+ float_muladd_negate_result,
+ float_muladd_negate_c | float_muladd_negate_product,
+ };
+ size_t nf = ARRAY_SIZE(muladd_flags);
+ size_t k;
+
+ /* DBL_MAX * 2.0 - DBL_MAX */
+ float64 dbl_max = 0x7fefffffffffffffULL;
+ float64 two = 0x4000000000000000ULL;
+ float64 neg_dbl_max = 0xffefffffffffffffULL;
+
+ for (k = 0; k < nf; k++) {
+ int flags = muladd_flags[k];
+ test_f64_muladd_case(dbl_max, two, neg_dbl_max, flags);
+ test_f64_muladd_case(neg_dbl_max, two, dbl_max, flags);
+ test_f64_muladd_case(dbl_max, 0ULL, dbl_max, flags);
+ test_f64_muladd_case(0ULL, dbl_max, dbl_max, flags);
+ }
+
+ for (unsigned int i = 0; i < NUM_OP_ITERATIONS; i++) {
+ float64 a = get_mixed_f64();
+ float64 b = get_mixed_f64();
+ float64 c = get_mixed_f64();
+ int flags = muladd_flags[i % nf];
+ test_f64_muladd_case(a, b, c, flags);
+ }
+}
+
+static void test_f32_sqrt(void)
+{
+ size_t i;
+
+ for (i = 0; i < ARRAY_SIZE(f32_edge_inputs); i++) {
+ float32 val = f32_edge_inputs[i];
+ if (!float32_is_neg(val)) {
+ test_f32_sqrt_case(val);
+ }
+ }
+
+ for (i = 0; i < NUM_OP_ITERATIONS; i++) {
+ float32 a = get_mixed_f32() & 0x7fffffff; /* positive only */
+ test_f32_sqrt_case(a);
+ }
+}
+
+static void test_f64_sqrt(void)
+{
+ size_t i;
+
+ for (i = 0; i < ARRAY_SIZE(f64_edge_inputs); i++) {
+ float64 val = f64_edge_inputs[i];
+ if (!float64_is_neg(val)) {
+ test_f64_sqrt_case(val);
+ }
+ }
+
+ for (i = 0; i < NUM_OP_ITERATIONS; i++) {
+ float64 a = get_mixed_f64() & 0x7fffffffffffffffULL;
+ test_f64_sqrt_case(a);
+ }
+}
+
+#define GEN_INT_TO_FLOAT(name, in_t, out_t, func, check_fn, is_uint, fmt) \
+static void test_##name(void) \
+{ \
+ float_status status_soft, status_hard; \
+ out_t res_soft, res_hard; \
+ char inp[64]; \
+ size_t i; \
+ \
+ if (is_uint) { \
+ for (i = 0; i < ARRAY_SIZE(uint_edge_inputs); i++) { \
+ in_t a = (in_t)uint_edge_inputs[i]; \
+ init_status(&status_soft); \
+ init_status(&status_hard); \
+ force_soft_float = true; \
+ res_soft = func(a, &status_soft); \
+ force_soft_float = false; \
+ res_hard = func(a, &status_hard); \
+ snprintf(inp, sizeof(inp), "a=" fmt, a); \
+ check_fn(#name, res_soft, status_soft.float_exception_flags, \
+ res_hard, status_hard.float_exception_flags, inp); \
+ } \
+ } else { \
+ for (i = 0; i < ARRAY_SIZE(int_edge_inputs); i++) { \
+ in_t a = (in_t)int_edge_inputs[i]; \
+ init_status(&status_soft); \
+ init_status(&status_hard); \
+ force_soft_float = true; \
+ res_soft = func(a, &status_soft); \
+ force_soft_float = false; \
+ res_hard = func(a, &status_hard); \
+ snprintf(inp, sizeof(inp), "a=" fmt, a); \
+ check_fn(#name, res_soft, status_soft.float_exception_flags, \
+ res_hard, status_hard.float_exception_flags, inp); \
+ } \
+ } \
+ \
+ for (i = 0; i < NUM_CONV_ITERATIONS; i++) { \
+ in_t a = is_uint ? (in_t)get_mixed_uint() : (in_t)get_mixed_int(); \
+ init_status(&status_soft); \
+ init_status(&status_hard); \
+ force_soft_float = true; \
+ res_soft = func(a, &status_soft); \
+ force_soft_float = false; \
+ res_hard = func(a, &status_hard); \
+ snprintf(inp, sizeof(inp), "a=" fmt, a); \
+ check_fn(#name, res_soft, status_soft.float_exception_flags, \
+ res_hard, status_hard.float_exception_flags, inp); \
+ } \
+}
+
+GEN_INT_TO_FLOAT(i32_to_f32, int32_t, float32, int32_to_float32, \
+ check_f32, false, "%" PRId32)
+GEN_INT_TO_FLOAT(i64_to_f32, int64_t, float32, int64_to_float32, \
+ check_f32, false, "%" PRId64)
+GEN_INT_TO_FLOAT(ui32_to_f32, uint32_t, float32, uint32_to_float32, \
+ check_f32, true, "%" PRIu32)
+GEN_INT_TO_FLOAT(ui64_to_f32, uint64_t, float32, uint64_to_float32, \
+ check_f32, true, "%" PRIu64)
+GEN_INT_TO_FLOAT(i16_to_f32, int16_t, float32, int16_to_float32, \
+ check_f32, false, "%" PRId16)
+GEN_INT_TO_FLOAT(ui16_to_f32, uint16_t, float32, uint16_to_float32, \
+ check_f32, true, "%" PRIu16)
+
+GEN_INT_TO_FLOAT(i32_to_f64, int32_t, float64, int32_to_float64, \
+ check_f64, false, "%" PRId32)
+GEN_INT_TO_FLOAT(i64_to_f64, int64_t, float64, int64_to_float64, \
+ check_f64, false, "%" PRId64)
+GEN_INT_TO_FLOAT(ui32_to_f64, uint32_t, float64, uint32_to_float64, \
+ check_f64, true, "%" PRIu32)
+GEN_INT_TO_FLOAT(ui64_to_f64, uint64_t, float64, uint64_to_float64, \
+ check_f64, true, "%" PRIu64)
+GEN_INT_TO_FLOAT(i16_to_f64, int16_t, float64, int16_to_float64, \
+ check_f64, false, "%" PRId16)
+GEN_INT_TO_FLOAT(ui16_to_f64, uint16_t, float64, uint16_to_float64, \
+ check_f64, true, "%" PRIu16)
+
+#undef GEN_INT_TO_FLOAT
+
+typedef struct {
+ const char *name;
+ void (*func)(void);
+} OpTest;
+
+static const OpTest op_tests[] = {
+ { "f32_add", test_f32_add },
+ { "f32_sub", test_f32_sub },
+ { "f32_mul", test_f32_mul },
+ { "f32_div", test_f32_div },
+ { "f64_add", test_f64_add },
+ { "f64_sub", test_f64_sub },
+ { "f64_mul", test_f64_mul },
+ { "f64_div", test_f64_div },
+ { "f32_muladd", test_f32_muladd },
+ { "f64_muladd", test_f64_muladd },
+ { "f32_sqrt", test_f32_sqrt },
+ { "f64_sqrt", test_f64_sqrt },
+ { "i32_to_f32", test_i32_to_f32 },
+ { "i64_to_f32", test_i64_to_f32 },
+ { "ui32_to_f32", test_ui32_to_f32 },
+ { "ui64_to_f32", test_ui64_to_f32 },
+ { "i16_to_f32", test_i16_to_f32 },
+ { "ui16_to_f32", test_ui16_to_f32 },
+ { "i32_to_f64", test_i32_to_f64 },
+ { "i64_to_f64", test_i64_to_f64 },
+ { "ui32_to_f64", test_ui32_to_f64 },
+ { "ui64_to_f64", test_ui64_to_f64 },
+ { "i16_to_f64", test_i16_to_f64 },
+ { "ui16_to_f64", test_ui16_to_f64 },
+};
+
+static void usage(const char *prog)
+{
+ fprintf(stderr, "Usage: %s [operation ...]\n"
+ "Supported operations:\n", prog);
+ for (size_t i = 0; i < ARRAY_SIZE(op_tests); i++) {
+ fprintf(stderr, " %s\n", op_tests[i].name);
+ }
+}
+
+int main(int argc, char *argv[])
+{
+ bool initial_force_soft = force_soft_float;
+
+ if (argc > 1 && strcmp(argv[1], "-h") == 0) {
+ usage(argv[0]);
+ return EXIT_SUCCESS;
+ }
+
+ if (initial_force_soft) {
+ printf("NOTE: softfloat_init() detected broken host FPU;\n"
+ "hardfloat was globally disabled by default.\n");
+ }
+
+ /* If specific ops were requested on CLI */
+ int n_requested = argc - 1;
+
+ for (size_t i = 0; i < ARRAY_SIZE(op_tests); i++) {
+ if (n_requested > 0) {
+ bool found = false;
+ for (int a = 1; a < argc; a++) {
+ if (strcmp(argv[a], op_tests[i].name) == 0) {
+ found = true;
+ break;
+ }
+ }
+ if (!found) {
+ continue;
+ }
+ }
+
+ printf(">> Testing %s...\n", op_tests[i].name);
+ op_tests[i].func();
+ }
+
+ /* Restore initial state */
+ force_soft_float = initial_force_soft;
+
+ printf("In %u tests, no errors found.\n", total_tests);
+ return EXIT_SUCCESS;
+}
diff --git a/tests/fp/meson.build b/tests/fp/meson.build
index 9059a247521..4e444154f78 100644
--- a/tests/fp/meson.build
+++ b/tests/fp/meson.build
@@ -1,6 +1,26 @@
if 'CONFIG_TCG' not in config_all_accel
subdir_done()
endif
+
+fpcflags = [
+ # work around TARGET_* poisoning
+ '-DHW_POISON_H',
+ # define a target to match testfloat's implementation-defined choices, such as
+ # whether to raise the invalid flag when dealing with NaNs in muladd.
+ '-DTARGET_ARM',
+ # FIXME: uiZ may be used uninitialized in this function
+ '-Wno-uninitialized',
+]
+
+fptesthard = executable(
+ 'fp-test-hard',
+ ['fp-test-hard.c', '../../fpu/softfloat.c'],
+ dependencies: [qemuutil],
+ c_args: fpcflags,
+)
+test('fp-test-hard', fptesthard,
+ suite: ['softfloat', 'softfloat-hard'])
+
# There are namespace pollution issues on Windows, due to osdep.h
# bringing in Windows headers that define a FLOAT128 type.
if host_os == 'windows'
@@ -44,16 +64,6 @@ libtestfloat_proj = subproject('berkeley-testfloat-3', required: true,
libtestfloat = libtestfloat_proj.get_variable('libtestfloat_dep')
libslowfloat = libtestfloat_proj.get_variable('libslowfloat_dep')
-fpcflags = [
- # work around TARGET_* poisoning
- '-DHW_POISON_H',
- # define a target to match testfloat's implementation-defined choices, such as
- # whether to raise the invalid flag when dealing with NaNs in muladd.
- '-DTARGET_ARM',
- # FIXME: uiZ may be used uninitialized in this function
- '-Wno-uninitialized',
-]
-
fptest = executable(
'fp-test',
['fp-test.c', '../../fpu/softfloat.c'],
--
2.47.3
^ permalink raw reply related [flat|nested] 18+ messages in thread