summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorvisa <visa@openbsd.org>2018-12-31 12:42:07 +0000
committervisa <visa@openbsd.org>2018-12-31 12:42:07 +0000
commit8cf749acb22186b15a9bde5d5e6e73dd3e5ef049 (patch)
treeddd049656cfe804c3a46ee28af7d473b8d19ef56
parentCleanup bootloader code. Compile with -ffreestanding and add ffs.S as a (diff)
downloadwireguard-openbsd-8cf749acb22186b15a9bde5d5e6e73dd3e5ef049.tar.xz
wireguard-openbsd-8cf749acb22186b15a9bde5d5e6e73dd3e5ef049.zip
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@
-rw-r--r--sys/arch/mips64/mips64/fp_emulate.c12
1 files 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;