[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH 06/35] softfloat: Add flag specific to convert non-nan to int
From: |
Richard Henderson |
Subject: |
[PATCH 06/35] softfloat: Add flag specific to convert non-nan to int |
Date: |
Fri, 19 Nov 2021 17:04:33 +0100 |
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>
---
include/fpu/softfloat-types.h | 1 +
fpu/softfloat-parts.c.inc | 14 +++++++-------
2 files changed, 8 insertions(+), 7 deletions(-)
diff --git a/include/fpu/softfloat-types.h b/include/fpu/softfloat-types.h
index 33224b5f22..9ca50e930b 100644
--- a/include/fpu/softfloat-types.h
+++ b/include/fpu/softfloat-types.h
@@ -157,6 +157,7 @@ enum {
float_flag_invalid_idi = 0x0200, /* inf / inf */
float_flag_invalid_zdz = 0x0400, /* 0 / 0 */
float_flag_invalid_sqrt = 0x0800, /* sqrt(-x) */
+ float_flag_invalid_cvti = 0x1000, /* non-nan to integer */
};
/*
diff --git a/fpu/softfloat-parts.c.inc b/fpu/softfloat-parts.c.inc
index cc8c2c3aee..ce580347dd 100644
--- a/fpu/softfloat-parts.c.inc
+++ b/fpu/softfloat-parts.c.inc
@@ -1055,7 +1055,7 @@ static int64_t partsN(float_to_sint)(FloatPartsN *p,
FloatRoundMode rmode,
break;
case float_class_inf:
- flags = float_flag_invalid;
+ flags = float_flag_invalid | float_flag_invalid_cvti;
r = p->sign ? min : max;
break;
@@ -1077,11 +1077,11 @@ static int64_t partsN(float_to_sint)(FloatPartsN *p,
FloatRoundMode rmode,
if (r <= -(uint64_t)min) {
r = -r;
} else {
- flags = float_flag_invalid;
+ flags = float_flag_invalid | float_flag_invalid_cvti;
r = min;
}
} else if (r > max) {
- flags = float_flag_invalid;
+ flags = float_flag_invalid | float_flag_invalid_cvti;
r = max;
}
break;
@@ -1120,7 +1120,7 @@ static uint64_t partsN(float_to_uint)(FloatPartsN *p,
FloatRoundMode rmode,
break;
case float_class_inf:
- flags = float_flag_invalid;
+ flags = float_flag_invalid | float_flag_invalid_cvti;
r = p->sign ? 0 : max;
break;
@@ -1138,15 +1138,15 @@ static uint64_t partsN(float_to_uint)(FloatPartsN *p,
FloatRoundMode rmode,
}
if (p->sign) {
- flags = float_flag_invalid;
+ flags = float_flag_invalid | float_flag_invalid_cvti;
r = 0;
} else if (p->exp > DECOMPOSED_BINARY_POINT) {
- flags = float_flag_invalid;
+ flags = float_flag_invalid | float_flag_invalid_cvti;
r = max;
} else {
r = p->frac_hi >> (DECOMPOSED_BINARY_POINT - p->exp);
if (r > max) {
- flags = float_flag_invalid;
+ flags = float_flag_invalid | float_flag_invalid_cvti;
r = max;
}
}
--
2.25.1
- [RFC PATCH for-7.0 00/35] target/ppc fpu fixes and cleanups, Richard Henderson, 2021/11/19
- [PATCH 01/35] softfloat: Extend float_exception_flags to 16 bits, Richard Henderson, 2021/11/19
- [PATCH 04/35] softfloat: Add flags specific to Inf / Inf and 0 / 0, Richard Henderson, 2021/11/19
- [PATCH 02/35] softfloat: Add flag specific to Inf - Inf, Richard Henderson, 2021/11/19
- [PATCH 03/35] softfloat: Add flag specific to Inf * 0, Richard Henderson, 2021/11/19
- [PATCH 07/35] softfloat: Add flag specific to signaling nans, Richard Henderson, 2021/11/19
- [PATCH 08/35] target/ppc: Update float_invalid_op_addsub for new flags, Richard Henderson, 2021/11/19
- [PATCH 05/35] softfloat: Add flag specific to sqrt(-x), Richard Henderson, 2021/11/19
- [PATCH 06/35] softfloat: Add flag specific to convert non-nan to int,
Richard Henderson <=
- [PATCH 10/35] target/ppc: Update float_invalid_op_div for new flags, Richard Henderson, 2021/11/19
- [PATCH 11/35] target/ppc: Move float_check_status from FPU_FCTI to translate, Richard Henderson, 2021/11/19
- [PATCH 09/35] target/ppc: Update float_invalid_op_mul for new flags, Richard Henderson, 2021/11/19
- [PATCH 12/35] target/ppc: Update float_invalid_cvt for new flags, Richard Henderson, 2021/11/19
- [PATCH 15/35] target/ppc: Use FloatRoundMode in do_fri, Richard Henderson, 2021/11/19
- [PATCH 16/35] target/ppc: Tidy inexact handling in do_fri, Richard Henderson, 2021/11/19
- [PATCH 17/35] target/ppc: Clean up do_fri, Richard Henderson, 2021/11/19
- [PATCH 18/35] target/ppc: Update fmadd for new flags, Richard Henderson, 2021/11/19
- [PATCH 13/35] target/ppc: Fix VXCVI return value, Richard Henderson, 2021/11/19
- [PATCH 14/35] target/ppc: Remove inline from do_fri, Richard Henderson, 2021/11/19