[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-devel] [PULL 033/118] target-ppc: Introduce DFP Multiply
From: |
Alexander Graf |
Subject: |
[Qemu-devel] [PULL 033/118] target-ppc: Introduce DFP Multiply |
Date: |
Wed, 4 Jun 2014 14:43:34 +0200 |
From: Tom Musta <address@hidden>
Add emulation of the PowerPC Decimal Floating Point Multiply instructions
dmul[q][.]
Signed-off-by: Tom Musta <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
---
target-ppc/dfp_helper.c | 23 +++++++++++++++++++++++
target-ppc/helper.h | 2 ++
target-ppc/translate.c | 4 ++++
3 files changed, 29 insertions(+)
diff --git a/target-ppc/dfp_helper.c b/target-ppc/dfp_helper.c
index d6d0c2d..e6c1098 100644
--- a/target-ppc/dfp_helper.c
+++ b/target-ppc/dfp_helper.c
@@ -261,6 +261,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)
\
{
\
@@ -302,3 +312,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 d560e53..ac23556 100644
--- a/target-ppc/helper.h
+++ b/target-ppc/helper.h
@@ -620,3 +620,5 @@ 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)
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index d4077c2..e1ab41f 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -8359,6 +8359,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 */
@@ -11290,6 +11292,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.8.1.4
- [Qemu-devel] [PULL 007/118] target-ppc: Create versionless CPU class per family if KVM, (continued)
- [Qemu-devel] [PULL 007/118] target-ppc: Create versionless CPU class per family if KVM, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 006/118] target-ppc: gdbstub allow byte swapping for reading/writing registers, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 013/118] target-ppc: Remove PVR check from migration, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 021/118] libdecnumber: Eliminate Unused Variable in decSetSubnormal, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 022/118] target-ppc: Enable Building of libdecnumber, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 019/118] libdecnumber: Change gstdint.h to stdint.h, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 012/118] target-ppc: Eliminate Magic Number MSR Masks, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 030/118] target-ppc: Introduce DFP Post Processor Utilities, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 025/118] libdecnumber: Fix decNumberSetBCD, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 017/118] libdecnumber: Prepare libdecnumber for QEMU include structure, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 033/118] target-ppc: Introduce DFP Multiply,
Alexander Graf <=
- [Qemu-devel] [PULL 029/118] target-ppc: Introduce DFP Helper Utilities, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 020/118] libdecnumber: Eliminate redundant declarations, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 027/118] target-ppc: Introduce Generator Macros for DFP Arithmetic Forms, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 026/118] target-ppc: Define FPR Pointer Type for Helpers, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 023/118] libdecnumber: Introduce decNumberFrom[U]Int64, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 024/118] libdecnumber: Introduce decNumberIntegralToInt64, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 016/118] libdecnumber: Eliminate #include *Symbols.h, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 037/118] target-ppc: Introduce DFP Test Data Group, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 032/118] target-ppc: Introduce DFP Subtract, Alexander Graf, 2014/06/04
- [Qemu-devel] [PULL 018/118] libdecnumber: Modify dconfig.h to Integrate with QEMU, Alexander Graf, 2014/06/04