[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PULL 026/101] softfloat: Add flag specific to signaling nans
From: |
Cédric Le Goater |
Subject: |
[PULL 026/101] softfloat: Add flag specific to signaling nans |
Date: |
Thu, 16 Dec 2021 21:24:59 +0100 |
From: Richard Henderson <richard.henderson@linaro.org>
PowerPC has this flag, and it's easier to compute it here
than after the fact.
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
Message-Id: <20211119160502.17432-8-richard.henderson@linaro.org>
Signed-off-by: Cédric Le Goater <clg@kaod.org>
---
include/fpu/softfloat-types.h | 1 +
fpu/softfloat.c | 4 +++-
fpu/softfloat-parts.c.inc | 18 ++++++++++++------
3 files changed, 16 insertions(+), 7 deletions(-)
diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h
index 9ca50e930b8d..8abd9ab4ec9c 100644
--- a/include/fpu/softfloat-types.h
+++ b/include/fpu/softfloat-types.h
@@ -158,6 +158,7 @@ enum {
float_flag_invalid_zdz = 0x0400, /* 0 / 0 */
float_flag_invalid_sqrt = 0x0800, /* sqrt(-x) */
float_flag_invalid_cvti = 0x1000, /* non-nan to integer */
+ float_flag_invalid_snan = 0x2000, /* any operand was snan */
};
/*
diff --git a/fpu/softfloat.c b/fpu/softfloat.c
index 9a28720d82a5..834ed3a054f7 100644
--- a/fpu/softfloat.c
+++ b/fpu/softfloat.c
@@ -2543,8 +2543,10 @@ floatx80 floatx80_mod(floatx80 a, floatx80 b,
float_status *status)
static void parts_float_to_ahp(FloatParts64 *a, float_status *s)
{
switch (a->cls) {
- case float_class_qnan:
case float_class_snan:
+ float_raise(float_flag_invalid_snan, s);
+ /* fall through */
+ case float_class_qnan:
/*
* There is no NaN in the destination format. Raise Invalid
* and return a zero with the sign of the input NaN.
diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc
index ce580347dda6..db3e1f393dfb 100644
--- a/fpu/softfloat-parts.c.inc
+++ b/fpu/softfloat-parts.c.inc
@@ -19,7 +19,7 @@ static void partsN(return_nan)(FloatPartsN *a, float_status
*s)
{
switch (a->cls) {
case float_class_snan:
- float_raise(float_flag_invalid, s);
+ float_raise(float_flag_invalid | float_flag_invalid_snan, s);
if (s->default_nan_mode) {
parts_default_nan(a, s);
} else {
@@ -40,7 +40,7 @@ static FloatPartsN *partsN(pick_nan)(FloatPartsN *a,
FloatPartsN *b,
float_status *s)
{
if (is_snan(a->cls) || is_snan(b->cls)) {
- float_raise(float_flag_invalid, s);
+ float_raise(float_flag_invalid | float_flag_invalid_snan, s);
}
if (s->default_nan_mode) {
@@ -68,7 +68,7 @@ static FloatPartsN *partsN(pick_nan_muladd)(FloatPartsN *a,
FloatPartsN *b,
int which;
if (unlikely(abc_mask & float_cmask_snan)) {
- float_raise(float_flag_invalid, s);
+ float_raise(float_flag_invalid | float_flag_invalid_snan, s);
}
which = pickNaNMulAdd(a->cls, b->cls, c->cls,
@@ -1049,8 +1049,10 @@ static int64_t partsN(float_to_sint)(FloatPartsN *p,
FloatRoundMode rmode,
switch (p->cls) {
case float_class_snan:
+ flags |= float_flag_invalid_snan;
+ /* fall through */
case float_class_qnan:
- flags = float_flag_invalid;
+ flags |= float_flag_invalid;
r = max;
break;
@@ -1114,8 +1116,10 @@ static uint64_t partsN(float_to_uint)(FloatPartsN *p,
FloatRoundMode rmode,
switch (p->cls) {
case float_class_snan:
+ flags |= float_flag_invalid_snan;
+ /* fall through */
case float_class_qnan:
- flags = float_flag_invalid;
+ flags |= float_flag_invalid;
r = max;
break;
@@ -1341,7 +1345,9 @@ static FloatRelation partsN(compare)(FloatPartsN *a,
FloatPartsN *b,
}
if (unlikely(ab_mask & float_cmask_anynan)) {
- if (!is_quiet || (ab_mask & float_cmask_snan)) {
+ if (ab_mask & float_cmask_snan) {
+ float_raise(float_flag_invalid | float_flag_invalid_snan, s);
+ } else if (!is_quiet) {
float_raise(float_flag_invalid, s);
}
return float_relation_unordered;
--
2.31.1
- [PULL v2 000/101] ppc queue, Cédric Le Goater, 2021/12/16
- [PULL 003/101] target/ppc: Fixed call to deferred exception, Cédric Le Goater, 2021/12/16
- [PULL 001/101] pseries: Update SLOF firmware image, Cédric Le Goater, 2021/12/16
- [PULL 010/101] ivshmem-test.c: enable test_ivshmem_server for ppc64 arch, Cédric Le Goater, 2021/12/16
- [PULL 002/101] hw/ppc/mac.h: Remove MAX_CPUS macro, Cédric Le Goater, 2021/12/16
- [PULL 004/101] test/tcg/ppc64le: test mtfsf, Cédric Le Goater, 2021/12/16
- [PULL 005/101] target/ppc: ppc_store_fpscr doesn't update bits 0 to 28 and 52, Cédric Le Goater, 2021/12/16
- [PULL 009/101] ivshmem.c: change endianness to LITTLE_ENDIAN, Cédric Le Goater, 2021/12/16
- [PULL 027/101] target/ppc: Update float_invalid_op_addsub for new flags, Cédric Le Goater, 2021/12/16
- [PULL 026/101] softfloat: Add flag specific to signaling nans,
Cédric Le Goater <=
- [PULL 012/101] docs: Minor updates on the powernv documentation., Cédric Le Goater, 2021/12/16
- [PULL 007/101] target/ppc: Implement Vector Extract Mask, Cédric Le Goater, 2021/12/16
- [PULL 011/101] pci-host: Allow extended config space access for PowerNV PHB4 model, Cédric Le Goater, 2021/12/16
- [PULL 006/101] target/ppc: Implement Vector Expand Mask, Cédric Le Goater, 2021/12/16
- [PULL 023/101] softfloat: Add flags specific to Inf / Inf and 0 / 0, Cédric Le Goater, 2021/12/16
- [PULL 025/101] softfloat: Add flag specific to convert non-nan to int, Cédric Le Goater, 2021/12/16
- [PULL 015/101] ppc/pnv.c: fix "system-id" FDT when -uuid is set, Cédric Le Goater, 2021/12/16
- [PULL 008/101] target/ppc: Implement Vector Mask Move insns, Cédric Le Goater, 2021/12/16
- [PULL 018/101] docs: Rename ppc-spapr-hcalls.txt to ppc-spapr-hcalls.rst., Cédric Le Goater, 2021/12/16
- [PULL 019/101] Link new ppc-spapr-hcalls.rst file to pseries.rst., Cédric Le Goater, 2021/12/16