[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v4 42/47] target/ppc: Refactor VSX_MAX_MINC helper
From: |
matheus . ferst |
Subject: |
[PATCH v4 42/47] target/ppc: Refactor VSX_MAX_MINC helper |
Date: |
Tue, 22 Feb 2022 11:36:40 -0300 |
From: Víctor Colombo <victor.colombo@eldorado.org.br>
Refactor xs{max,min}cdp VSX_MAX_MINC helper to prepare for
xs{max,min}cqp implementation.
Signed-off-by: Víctor Colombo <victor.colombo@eldorado.org.br>
Signed-off-by: Matheus Ferst <matheus.ferst@eldorado.org.br>
---
target/ppc/fpu_helper.c | 23 +++++++++--------------
1 file changed, 9 insertions(+), 14 deletions(-)
diff --git a/target/ppc/fpu_helper.c b/target/ppc/fpu_helper.c
index 7ae576cba9..f6eb8bf2d8 100644
--- a/target/ppc/fpu_helper.c
+++ b/target/ppc/fpu_helper.c
@@ -2536,27 +2536,22 @@ VSX_MAX_MIN(xsmindp, minnum, 1, float64, VsrD(0))
VSX_MAX_MIN(xvmindp, minnum, 2, float64, VsrD(i))
VSX_MAX_MIN(xvminsp, minnum, 4, float32, VsrW(i))
-#define VSX_MAX_MINC(name, max) \
+#define VSX_MAX_MINC(name, op, tp, fld) \
void helper_##name(CPUPPCState *env, \
ppc_vsr_t *xt, ppc_vsr_t *xa, ppc_vsr_t *xb) \
{ \
ppc_vsr_t t = { }; \
bool vxsnan_flag = false, vex_flag = false; \
\
- if (unlikely(float64_is_any_nan(xa->VsrD(0)) || \
- float64_is_any_nan(xb->VsrD(0)))) { \
- if (float64_is_signaling_nan(xa->VsrD(0), &env->fp_status) || \
- float64_is_signaling_nan(xb->VsrD(0), &env->fp_status)) { \
+ if (unlikely(tp##_is_any_nan(xa->fld) || \
+ tp##_is_any_nan(xb->fld))) { \
+ if (tp##_is_signaling_nan(xa->fld, &env->fp_status) || \
+ tp##_is_signaling_nan(xb->fld, &env->fp_status)) { \
vxsnan_flag = true; \
} \
- t.VsrD(0) = xb->VsrD(0); \
- } else if ((max && \
- !float64_lt(xa->VsrD(0), xb->VsrD(0), &env->fp_status)) || \
- (!max && \
- float64_lt(xa->VsrD(0), xb->VsrD(0), &env->fp_status))) { \
- t.VsrD(0) = xa->VsrD(0); \
+ t.fld = xb->fld; \
} else { \
- t.VsrD(0) = xb->VsrD(0); \
+ t.fld = tp##_##op(xa->fld, xb->fld, &env->fp_status); \
} \
\
vex_flag = fpscr_ve & vxsnan_flag; \
@@ -2568,8 +2563,8 @@ void helper_##name(CPUPPCState *env,
\
} \
} \
-VSX_MAX_MINC(XSMAXCDP, 1);
-VSX_MAX_MINC(XSMINCDP, 0);
+VSX_MAX_MINC(XSMAXCDP, maxnum, float64, VsrD(0));
+VSX_MAX_MINC(XSMINCDP, minnum, float64, VsrD(0));
#define VSX_MAX_MINJ(name, max) \
void helper_##name(CPUPPCState *env, \
--
2.25.1
- Re: [PATCH v4 38/47] target/ppc: Refactor VSX_SCALAR_CMP_DP, (continued)
[PATCH v4 39/47] target/ppc: Implement xscmp{eq,ge,gt}qp, matheus . ferst, 2022/02/22
[PATCH v4 41/47] target/ppc: Move xs{max, min}[cj]dp to use do_helper_XX3, matheus . ferst, 2022/02/22
[PATCH v4 43/47] target/ppc: Implement xs{max,min}cqp, matheus . ferst, 2022/02/22
[PATCH v4 40/47] target/ppc: Move xscmp{eq,ge,gt}dp to decodetree, matheus . ferst, 2022/02/22
[PATCH v4 42/47] target/ppc: Refactor VSX_MAX_MINC helper,
matheus . ferst <=
[PATCH v4 44/47] target/ppc: Implement xvcvbf16spn and xvcvspbf16 instructions, matheus . ferst, 2022/02/22
[PATCH v4 45/47] target/ppc: implement plxsd/pstxsd, matheus . ferst, 2022/02/22
[PATCH v4 46/47] target/ppc: implement plxssp/pstxssp, matheus . ferst, 2022/02/22
[PATCH v4 47/47] target/ppc: implement lxvr[bhwd]/stxvr[bhwd]x, matheus . ferst, 2022/02/22