> FCMP should report unordered without raising IEEE invalid for a quiet NaN.
> The MC88100 User's Manual, second edition, section 2.4.5.1,
> distinguishes software completion from IEEE exceptions.
> The MC88110 User's Manual, section 4.3.2.4, item 2 on page 4-20,
> explicitly specifies quiet NaN FCMP completion without an IEEE exception.
[...]
> The 2014-06-09 C replacement m88100_fp.c uses the common fpu_compare()
> helper. Its single/double-precision NaN path contains:
>
> ```
> case FTYPE_SNG:
> if (float32_is_nan(s1->sng)) {
> if (!fcmpu || float32_is_signaling_nan(s1->sng))
> ^^^^^^
> float_set_invalid();
> cc = CC_UN;
> goto done;
> }
> if (float32_is_nan(s2->sng)) {
> if (!fcmpu || float32_is_signaling_nan(s2->sng))
> ^^^^^^
> float_set_invalid();
> cc = CC_UN;
> goto done;
> }
> break;
> case FTYPE_DBL:
> if (float64_is_nan(s1->dbl)) {
> if (!fcmpu || float64_is_signaling_nan(s1->dbl))
> ^^^^^^
> float_set_invalid();
> cc = CC_UN;
> goto done;
> }
> if (float64_is_nan(s2->dbl)) {
> if (!fcmpu || float64_is_signaling_nan(s2->dbl))
> ^^^^^^
> float_set_invalid();
> cc = CC_UN;
> goto done;
> }
> break;
> }
> ```
>
> MC88100 FCMP passes fcmpu=0, so this condition causes invalid to be
> set even for a quiet NaN. The FCMP/FCMPU exception selection for quiet
> NaNs appears reversed.
You are right that the results on 88100 in this particular case are
wrong.
However, the polarity of the fcmpu check in the above tests is correct,
for the 88110.
It turns out that, at least according to the documentation, the 88100
fcmp should behave as the 88110 fcmpu (only set FINV if quiet NaN).
Therefore, I think the following diff should fix this bug (not tested
yet):
Index: sys/arch/m88k/m88k/m88100_fp.c
===================================================================
RCS file: /OpenBSD/src/sys/arch/m88k/m88k/m88100_fp.c,v
diff -u -p -r1.10 m88100_fp.c
--- sys/arch/m88k/m88k/m88100_fp.c 15 Jul 2026 18:42:37 -0000 1.10
+++ sys/arch/m88k/m88k/m88100_fp.c 7 Nov 2026 15:50:46 -0000
@@ -278,7 +278,8 @@ m88100_fpu_emulate(struct trapframe *fra
tmax = fpu_precision(t1, t2, IGNORE_PRECISION);
m88100_fpu_fetch(frame, 1, t1, tmax, &arg1);
m88100_fpu_fetch(frame, 2, t2, tmax, &arg2);
- fpu_compare(frame, &arg1, &arg2, tmax, rd, 0);
+ /* 88100 fcmp behaves as 88110 fcmpu wrt quiet NaNs */
+ fpu_compare(frame, &arg1, &arg2, tmax, rd, 1);
break;
case 0x09: /* int */