[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [V2 PATCH 19/37] target-ppc: Introduce DFP Multiply
From: |
Tom Musta |
Subject: |
[Qemu-ppc] [V2 PATCH 19/37] target-ppc: Introduce DFP Multiply |
Date: |
Mon, 21 Apr 2014 15:55:03 -0500 |
Add emulation of the PowerPC Decimal Floating Point Multiply instructions
dmul[q][.]
Signed-off-by: Tom Musta <address@hidden>
---
V2: Make post-processor list static const per Richard Henderson's review.
target-ppc/dfp_helper.c | 23 +++++++++++++++++++++++
target-ppc/helper.h | 2 ++
target-ppc/translate.c | 4 ++++
3 files changed, 29 insertions(+), 0 deletions(-)
diff --git a/target-ppc/dfp_helper.c b/target-ppc/dfp_helper.c
index 2d38204..c7fda21 100644
--- a/target-ppc/dfp_helper.c
+++ b/target-ppc/dfp_helper.c
@@ -259,6 +259,16 @@ static void dfp_check_for_VXISI_subtract(struct PPC_DFP
*dfp)
dfp_check_for_VXISI(dfp, 1);
}
+static void dfp_check_for_VXIMZ(struct PPC_DFP *dfp)
+{
+ if (dfp->context.status & DEC_Invalid_operation) {
+ if ((decNumberIsInfinite(&dfp->a) && decNumberIsZero(&dfp->b)) ||
+ (decNumberIsInfinite(&dfp->b) && decNumberIsZero(&dfp->a))) {
+ dfp_set_FPSCR_flag(dfp, FP_VX | FP_VXIMZ, FP_VE);
+ }
+ }
+}
+
#define DFP_HELPER_TAB(op, dnop, postprocs, size)
\
void helper_##op(CPUPPCState *env, uint64_t *t, uint64_t *a, uint64_t *b)
\
{
\
@@ -299,3 +309,16 @@ static void SUB_PPs(struct PPC_DFP *dfp)
DFP_HELPER_TAB(dsub, decNumberSubtract, SUB_PPs, 64)
DFP_HELPER_TAB(dsubq, decNumberSubtract, SUB_PPs, 128)
+
+static void MUL_PPs(struct PPC_DFP *dfp)
+{
+ dfp_set_FPRF_from_FRT(dfp);
+ dfp_check_for_OX(dfp);
+ dfp_check_for_UX(dfp);
+ dfp_check_for_XX(dfp);
+ dfp_check_for_VXSNAN(dfp);
+ dfp_check_for_VXIMZ(dfp);
+}
+
+DFP_HELPER_TAB(dmul, decNumberMultiply, MUL_PPs, 64)
+DFP_HELPER_TAB(dmulq, decNumberMultiply, MUL_PPs, 128)
diff --git a/target-ppc/helper.h b/target-ppc/helper.h
index 7ae8d03..17c75ab 100644
--- a/target-ppc/helper.h
+++ b/target-ppc/helper.h
@@ -622,4 +622,6 @@ DEF_HELPER_4(dadd, void, env, fprp, fprp, fprp)
DEF_HELPER_4(daddq, void, env, fprp, fprp, fprp)
DEF_HELPER_4(dsub, void, env, fprp, fprp, fprp)
DEF_HELPER_4(dsubq, void, env, fprp, fprp, fprp)
+DEF_HELPER_4(dmul, void, env, fprp, fprp, fprp)
+DEF_HELPER_4(dmulq, void, env, fprp, fprp, fprp)
#include "exec/def-helper.h"
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 80dc53c..a36ead4 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -8360,6 +8360,8 @@ GEN_DFP_T_A_B_Rc(dadd)
GEN_DFP_T_A_B_Rc(daddq)
GEN_DFP_T_A_B_Rc(dsub)
GEN_DFP_T_A_B_Rc(dsubq)
+GEN_DFP_T_A_B_Rc(dmul)
+GEN_DFP_T_A_B_Rc(dmulq)
/*** SPE extension ***/
/* Register moves */
@@ -11291,6 +11293,8 @@ GEN_DFP_T_A_B_Rc(dadd, 0x02, 0x00),
GEN_DFP_Tp_Ap_Bp_Rc(daddq, 0x02, 0x00),
GEN_DFP_T_A_B_Rc(dsub, 0x02, 0x10),
GEN_DFP_Tp_Ap_Bp_Rc(dsubq, 0x02, 0x10),
+GEN_DFP_T_A_B_Rc(dmul, 0x02, 0x01),
+GEN_DFP_Tp_Ap_Bp_Rc(dmulq, 0x02, 0x01),
#undef GEN_SPE
#define GEN_SPE(name0, name1, opc2, opc3, inval0, inval1, type) \
GEN_OPCODE_DUAL(name0##_##name1, 0x04, opc2, opc3, inval0, inval1, type,
PPC_NONE)
--
1.7.1
- [Qemu-ppc] [V2 PATCH 08/37] target-ppc: Enable Building of libdecnumber, (continued)
- [Qemu-ppc] [V2 PATCH 08/37] target-ppc: Enable Building of libdecnumber, Tom Musta, 2014/04/21
- [Qemu-ppc] [V2 PATCH 09/37] libdecnumber: Introduce decNumberFrom[U]Int64, Tom Musta, 2014/04/21
- [Qemu-ppc] [V2 PATCH 10/37] libdecnumber: Introduce decNumberIntegralToInt64, Tom Musta, 2014/04/21
- [Qemu-ppc] [V2 PATCH 12/37] target-ppc: Define FPR Pointer Type for Helpers, Tom Musta, 2014/04/21
- [Qemu-ppc] [V2 PATCH 11/37] libdecnumber: Fix decNumberSetBCD, Tom Musta, 2014/04/21
- [Qemu-ppc] [V2 PATCH 13/37] target-ppc: Introduce Generator Macros for DFP Arithmetic Forms, Tom Musta, 2014/04/21
- [Qemu-ppc] [V2 PATCH 14/37] target-ppc: Introduce Decoder Macros for DFP, Tom Musta, 2014/04/21
- [Qemu-ppc] [V2 PATCH 16/37] target-ppc: Introduce DFP Post Processor Utilities, Tom Musta, 2014/04/21
- [Qemu-ppc] [V2 PATCH 17/37] target-ppc: Introduce DFP Add, Tom Musta, 2014/04/21
- [Qemu-ppc] [V2 PATCH 18/37] target-ppc: Introduce DFP Subtract, Tom Musta, 2014/04/21
- [Qemu-ppc] [V2 PATCH 19/37] target-ppc: Introduce DFP Multiply,
Tom Musta <=
- [Qemu-ppc] [V2 PATCH 20/37] target-ppc: Introduce DFP Divide, Tom Musta, 2014/04/21
- [Qemu-ppc] [V2 PATCH 28/37] target-ppc: Introduce DFP Round to Integer, Tom Musta, 2014/04/21
- [Qemu-ppc] [V2 PATCH 29/37] target-ppc: Introduce DFP Convert to Long/Extended, Tom Musta, 2014/04/21
- [Qemu-ppc] [V2 PATCH 30/37] target-ppc: Introduce Round to DFP Short/Long, Tom Musta, 2014/04/21
- [Qemu-ppc] [V2 PATCH 32/37] target-ppc: Introduce DFP Convert to Fixed, Tom Musta, 2014/04/21
- [Qemu-ppc] [V2 PATCH 33/37] target-ppc: Introduce DFP Decode DPD to BCD, Tom Musta, 2014/04/21
- [Qemu-ppc] [V2 PATCH 31/37] target-ppc: Introduce DFP Convert to Fixed, Tom Musta, 2014/04/21
- [Qemu-ppc] [V2 PATCH 23/37] target-ppc: Introduce DFP Test Data Group, Tom Musta, 2014/04/21
- [Qemu-ppc] [V2 PATCH 24/37] target-ppc: Introduce DFP Test Exponent, Tom Musta, 2014/04/21
- [Qemu-ppc] [V2 PATCH 21/37] target-ppc: Introduce DFP Compares, Tom Musta, 2014/04/21