Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/alpha/alpha - compare_{le,lt)(): Use float64_{le,lt...
details: https://anonhg.NetBSD.org/src/rev/0ef413b2a814
branches: trunk
changeset: 938073:0ef413b2a814
user: thorpej <thorpej%NetBSD.org@localhost>
date: Tue Sep 01 08:22:36 2020 +0000
description:
- compare_{le,lt)(): Use float64_{le,lt}_quiet() to avoid raising
exceptions on QNaNs.
- alpha_fp_interpret(): Instructions are 32-bits wide, so don't use a
uint64_t to contain them.
- alpha_fp_complete(): Operations on NaNs trap on Alpha, but the exception
summary reports INV (invalid operation) rather than SWC (software
completion) in this case. So also interpret the instruction if INV
is set in the exception summary. This will emulate operations on
NaN and correctly suppress FP traps for QNaNs.
This fixes bin/55633, which was caused by:
-> Input string "nanotime" is passed to awk's internal is_number().
-> strtod() interprets as "nan" and returns QNaN as the result.
-> Result compared against HUGE_VAL, blows up because cmptle is called
with a NaN operand, and the hardware doesn't care that it's quiet.
diffstat:
sys/arch/alpha/alpha/fp_complete.c | 16 +++++++++-------
1 files changed, 9 insertions(+), 7 deletions(-)
diffs (61 lines):
diff -r 97f1bbaf2c6c -r 0ef413b2a814 sys/arch/alpha/alpha/fp_complete.c
--- a/sys/arch/alpha/alpha/fp_complete.c Tue Sep 01 04:19:16 2020 +0000
+++ b/sys/arch/alpha/alpha/fp_complete.c Tue Sep 01 08:22:36 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: fp_complete.c,v 1.23 2019/03/25 19:24:30 maxv Exp $ */
+/* $NetBSD: fp_complete.c,v 1.24 2020/09/01 08:22:36 thorpej Exp $ */
/*-
* Copyright (c) 2001 Ross Harvey
@@ -35,7 +35,7 @@
#include <sys/cdefs.h> /* RCS ID & Copyright macro defns */
-__KERNEL_RCSID(0, "$NetBSD: fp_complete.c,v 1.23 2019/03/25 19:24:30 maxv Exp $");
+__KERNEL_RCSID(0, "$NetBSD: fp_complete.c,v 1.24 2020/09/01 08:22:36 thorpej Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@@ -199,13 +199,13 @@
static float64
compare_lt(float64 a, float64 b)
{
- return CMP_RESULT(float64_lt(a, b));
+ return CMP_RESULT(float64_lt_quiet(a, b));
}
static float64
compare_le(float64 a, float64 b)
{
- return CMP_RESULT(float64_le(a, b));
+ return CMP_RESULT(float64_le_quiet(a, b));
}
static float64
@@ -502,7 +502,7 @@
*/
static void
-alpha_fp_interpret(alpha_instruction *pc, struct lwp *l, uint64_t bits)
+alpha_fp_interpret(alpha_instruction *pc, struct lwp *l, uint32_t bits)
{
s_float sfa, sfb, sfc;
t_float tfa, tfb, tfc;
@@ -634,13 +634,15 @@
pc = (alpha_instruction *)l->l_md.md_tf->tf_regs[FRAME_PC];
trigger_pc = pc - 1; /* for ALPHA_AMASK_PAT case */
if (cpu_amask & ALPHA_AMASK_PAT) {
- if (a0 & 1 || alpha_fp_sync_complete) {
+ /* SWC | INV */
+ if (a0 & 3 || alpha_fp_sync_complete) {
sig = alpha_fp_complete_at(trigger_pc, l, ucode);
goto done;
}
}
*ucode = a0;
- if (!(a0 & 1))
+ /* SWC | INV */
+ if (!(a0 & 3))
return sig;
/*
* At this point we are somewhere in the trap shadow of one or more instruc-
Home |
Main Index |
Thread Index |
Old Index