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

Maybe this should be "only set FINV if signaling 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 */

Thanks.  Changing the MC88100 call to pass fcmpu = 1 looks right
for the original reproducer.

BTW, I noticed a separate issue in fpu_compare().
When fcmpu is 1 and the first operand is a quiet NaN,
the helper goes to done before checking the second operand.
If the second operand is a signaling NaN, the helper returns
an unordered result without setting invalid.
This path already exists for MC88110 FCMPU.

The old m88100_fp.S checked the second operand for a signaling NaN
in this case (in S2sigcheck).

Thanks,
---
Izumi Tsutsui

Reply via email to