[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [PULL 11/22] target/ppc: Split out float_invalid_op_div
From: |
David Gibson |
Subject: |
[Qemu-ppc] [PULL 11/22] target/ppc: Split out float_invalid_op_div |
Date: |
Thu, 8 Nov 2018 23:16:35 +1100 |
From: Richard Henderson <address@hidden>
Signed-off-by: Richard Henderson <address@hidden>
Signed-off-by: David Gibson <address@hidden>
---
target/ppc/fpu_helper.c | 52 +++++++++++++++++++----------------------
1 file changed, 24 insertions(+), 28 deletions(-)
diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c
index ef251d062f..127c08bcec 100644
--- a/target/ppc/fpu_helper.c
+++ b/target/ppc/fpu_helper.c
@@ -715,6 +715,21 @@ float64 helper_fmul(CPUPPCState *env, float64 arg1,
float64 arg2)
return ret;
}
+static void float_invalid_op_div(CPUPPCState *env, bool set_fprc,
+ uintptr_t retaddr, int classes)
+{
+ classes &= ~is_neg;
+ if (classes == is_inf) {
+ /* Division of infinity by infinity */
+ float_invalid_op_vxidi(env, set_fprc, retaddr);
+ } else if (classes == is_zero) {
+ /* Division of zero by zero */
+ float_invalid_op_vxzdz(env, set_fprc, retaddr);
+ } else if (classes & is_snan) {
+ float_invalid_op_vxsnan(env, retaddr);
+ }
+}
+
/* fdiv - fdiv. */
float64 helper_fdiv(CPUPPCState *env, float64 arg1, float64 arg2)
{
@@ -723,18 +738,9 @@ float64 helper_fdiv(CPUPPCState *env, float64 arg1,
float64 arg2)
if (unlikely(status)) {
if (status & float_flag_invalid) {
- /* Determine what kind of invalid operation was seen. */
- if (float64_is_infinity(arg1) && float64_is_infinity(arg2)) {
- /* Division of infinity by infinity */
- float_invalid_op_vxidi(env, 1, GETPC());
- } else if (float64_is_zero(arg1) && float64_is_zero(arg2)) {
- /* Division of zero by zero */
- float_invalid_op_vxzdz(env, 1, GETPC());
- } else if (float64_is_signaling_nan(arg1, &env->fp_status) ||
- float64_is_signaling_nan(arg2, &env->fp_status)) {
- /* sNaN division */
- float_invalid_op_vxsnan(env, GETPC());
- }
+ float_invalid_op_div(env, 1, GETPC(),
+ float64_classify(arg1) |
+ float64_classify(arg2));
}
if (status & float_flag_divbyzero) {
float_zero_divide_excp(env, GETPC());
@@ -1969,14 +1975,9 @@ void helper_##op(CPUPPCState *env, uint32_t opcode)
\
env->fp_status.float_exception_flags |= tstat.float_exception_flags; \
\
if (unlikely(tstat.float_exception_flags & float_flag_invalid)) { \
- if (tp##_is_infinity(xa.fld) && tp##_is_infinity(xb.fld)) { \
- float_invalid_op_vxidi(env, sfprf, GETPC()); \
- } else if (tp##_is_zero(xa.fld) && tp##_is_zero(xb.fld)) { \
- float_invalid_op_vxzdz(env, sfprf, GETPC()); \
- } else if (tp##_is_signaling_nan(xa.fld, &tstat) || \
- tp##_is_signaling_nan(xb.fld, &tstat)) { \
- float_invalid_op_vxsnan(env, GETPC()); \
- } \
+ float_invalid_op_div(env, sfprf, GETPC(), \
+ tp##_classify(xa.fld) | \
+ tp##_classify(xb.fld)); \
} \
if (unlikely(tstat.float_exception_flags & float_flag_divbyzero)) { \
float_zero_divide_excp(env, GETPC()); \
@@ -2020,14 +2021,9 @@ void helper_xsdivqp(CPUPPCState *env, uint32_t opcode)
env->fp_status.float_exception_flags |= tstat.float_exception_flags;
if (unlikely(tstat.float_exception_flags & float_flag_invalid)) {
- if (float128_is_infinity(xa.f128) && float128_is_infinity(xb.f128)) {
- float_invalid_op_vxidi(env, 1, GETPC());
- } else if (float128_is_zero(xa.f128) && float128_is_zero(xb.f128)) {
- float_invalid_op_vxzdz(env, 1, GETPC());
- } else if (float128_is_signaling_nan(xa.f128, &tstat) ||
- float128_is_signaling_nan(xb.f128, &tstat)) {
- float_invalid_op_vxsnan(env, GETPC());
- }
+ float_invalid_op_div(env, 1, GETPC(),
+ float128_classify(xa.f128) |
+ float128_classify(xb.f128));
}
if (unlikely(tstat.float_exception_flags & float_flag_divbyzero)) {
float_zero_divide_excp(env, GETPC());
--
2.19.1
- [Qemu-ppc] [PULL 00/22] ppc-for-3.1 queue 20181108, David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 02/22] ppc440_pcix: convert SysBus init method to a realize method, David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 03/22] ppc4xx_pci: convert SysBus init method to a realize method, David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 08/22] target/ppc: Introduce fp number classification, David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 10/22] target/ppc: Split out float_invalid_op_mul, David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 04/22] PPC: e500: convert SysBus init method to a realize method, David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 11/22] target/ppc: Split out float_invalid_op_div,
David Gibson <=
- [Qemu-ppc] [PULL 19/22] hw/ppc/ppc440_uc: Remove dead code in sdram_size(), David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 13/22] spapr_pci: convert g_malloc() to g_new(), David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 09/22] target/ppc: Split out float_invalid_op_addsub, David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 20/22] This patch fixes processing of rfi instructions in icount mode., David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 05/22] hw/ppc/spapr_rng: Introduce CONFIG_SPAPR_RNG switch for spapr_rng.c, David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 18/22] MAINTAINERS: PPC: Remove myself, David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 22/22] ppc/spapr_caps: Add SPAPR_CAP_NESTED_KVM_HV, David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 12/22] target/ppc: Split out float_invalid_cvt, David Gibson, 2018/11/08
- [Qemu-ppc] [PULL 06/22] target/ppc: Split up float_invalid_op_excp, David Gibson, 2018/11/08