summaryrefslogtreecommitdiffstats
path: root/target-ppc/dfp_helper.c
diff options
context:
space:
mode:
authorTom Musta <tommusta@gmail.com>2014-04-21 15:55:03 -0500
committerAlexander Graf <agraf@suse.de>2014-06-16 13:24:30 +0200
commit8de6a1cc672d94e6ca793a1a7fcccf48b65b2e89 (patch)
tree87143c5b35518d1db38d7bb2f0687c1c8a287435 /target-ppc/dfp_helper.c
parent2128f8a57e1f1db97b8ba03eae4d8e5d94bf1ea5 (diff)
downloadhqemu-8de6a1cc672d94e6ca793a1a7fcccf48b65b2e89.zip
hqemu-8de6a1cc672d94e6ca793a1a7fcccf48b65b2e89.tar.gz
target-ppc: Introduce DFP Multiply
Add emulation of the PowerPC Decimal Floating Point Multiply instructions dmul[q][.] Signed-off-by: Tom Musta <tommusta@gmail.com> Signed-off-by: Alexander Graf <agraf@suse.de>
Diffstat (limited to 'target-ppc/dfp_helper.c')
-rw-r--r--target-ppc/dfp_helper.c23
1 files changed, 23 insertions, 0 deletions
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)
OpenPOWER on IntegriCloud