From ba4272df063a21cb8963bde2b64b89e7823ff178 Mon Sep 17 00:00:00 2001 From: Visa Hankala Date: Mon, 31 Dec 2018 12:42:08 +0000 Subject: Set floating point condition code even if the result of an emulated floating point comparison is unordered. The setting should be skipped only if an invalid operation exception is taken. This fixes incorrect emulated compare behaviour with NaN values. NaN issue on octeon reported by afresh1@; OK miod@ --- sys/arch/mips64/mips64/fp_emulate.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/sys/arch/mips64/mips64/fp_emulate.c b/sys/arch/mips64/mips64/fp_emulate.c index cb497b85e7f..725cb0aabed 100644 --- a/sys/arch/mips64/mips64/fp_emulate.c +++ b/sys/arch/mips64/mips64/fp_emulate.c @@ -1,4 +1,4 @@ -/* $OpenBSD: fp_emulate.c,v 1.20 2018/10/22 17:31:25 krw Exp $ */ +/* $OpenBSD: fp_emulate.c,v 1.21 2018/12/31 12:42:07 visa Exp $ */ /* * Copyright (c) 2010 Miodrag Vallat. @@ -935,12 +935,12 @@ fpu_c(struct proc *p, struct trapframe *tf, uint fmt, uint ft, uint fs, /* comparison result intentionaly not written */ goto skip; } - } else { - if ((uo | eq | lt) & op) - tf->fsr |= FPCSR_CONDVAL(cc); - else - tf->fsr &= ~FPCSR_CONDVAL(cc); } + + if ((uo | eq | lt) & op) + tf->fsr |= FPCSR_CONDVAL(cc); + else + tf->fsr &= ~FPCSR_CONDVAL(cc); skip: return 0; -- cgit v1.2.3