--- nono/fpe/fpu_emulate.c 2026/04/29 17:05:27 1.1.1.4 +++ nono/fpe/fpu_emulate.c 2026/04/29 17:05:31 1.1.1.5 @@ -948,7 +948,6 @@ test_cc(struct fpemu *fe, int pred) int fpsr; fpsr = fe->fe_fpsr; - fpsr &= ~FPSR_EXCP; /* clear all exceptions */ DPRINTF(("%s: fpsr=0x%08x\n", __func__, fpsr)); pred &= 0x3f; /* lowest 6 bits */ @@ -1022,6 +1021,10 @@ test_cc(struct fpemu *fe, int pred) if (sig_bsun && (fpsr & FPSR_NAN)) { fpsr |= FPSR_BSUN; } + /* if BSUN is set, IOP is set */ + if ((fpsr & FPSR_BSUN)) { + fpsr |= FPSR_AIOP; + } /* put fpsr back */ fe->fe_fpframe->fpf_fpsr = fe->fe_fpsr = fpsr; @@ -1192,3 +1195,23 @@ fpu_emul_brcc(struct fpemu *fe, struct i return 0; } #endif /* !XM6i_FPE */ + +#if defined(XM6i_FPE) +// fpn のタグ情報のうち、ゼロ、Inf、NAN、それ以外(ここでは正規化数)を返す。 +// 非正規化数とアンノーマル数はここに来る前に弾いてある。 +// 68040 の FSAVE で使う。 +int +fpu_gettag(const struct fpn *fpn) +{ + if (ISZERO(fpn)) { + return 1; + } + if (ISINF(fpn)) { + return 2; + } + if (ISNAN(fpn)) { + return 3; + } + return 0; +} +#endif