qemu-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Qemu-devel] [PULL 032/118] target-ppc: Introduce DFP Subtract


From: Alexander Graf
Subject: [Qemu-devel] [PULL 032/118] target-ppc: Introduce DFP Subtract
Date: Wed, 4 Jun 2014 14:43:33 +0200

From: Tom Musta <address@hidden>

Add emulation of the PowerPC Decimal Floating Point Subtract instructions
dsub[q][.]

Signed-off-by: Tom Musta <address@hidden>
Signed-off-by: Alexander Graf <address@hidden>
---
 target-ppc/dfp_helper.c | 18 ++++++++++++++++++
 target-ppc/helper.h     |  2 ++
 target-ppc/translate.c  |  5 ++++-
 3 files changed, 24 insertions(+), 1 deletion(-)

diff --git a/target-ppc/dfp_helper.c b/target-ppc/dfp_helper.c
index 9f4cd33..d6d0c2d 100644
--- a/target-ppc/dfp_helper.c
+++ b/target-ppc/dfp_helper.c
@@ -256,6 +256,11 @@ static void dfp_check_for_VXISI_add(struct PPC_DFP *dfp)
     dfp_check_for_VXISI(dfp, 0);
 }
 
+static void dfp_check_for_VXISI_subtract(struct PPC_DFP *dfp)
+{
+    dfp_check_for_VXISI(dfp, 1);
+}
+
 #define DFP_HELPER_TAB(op, dnop, postprocs, size)                              
\
 void helper_##op(CPUPPCState *env, uint64_t *t, uint64_t *a, uint64_t *b)      
\
 {                                                                              
\
@@ -284,3 +289,16 @@ static void ADD_PPs(struct PPC_DFP *dfp)
 
 DFP_HELPER_TAB(dadd, decNumberAdd, ADD_PPs, 64)
 DFP_HELPER_TAB(daddq, decNumberAdd, ADD_PPs, 128)
+
+static void SUB_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_VXISI_subtract(dfp);
+}
+
+DFP_HELPER_TAB(dsub, decNumberSubtract, SUB_PPs, 64)
+DFP_HELPER_TAB(dsubq, decNumberSubtract, SUB_PPs, 128)
diff --git a/target-ppc/helper.h b/target-ppc/helper.h
index 99e6198..d560e53 100644
--- a/target-ppc/helper.h
+++ b/target-ppc/helper.h
@@ -618,3 +618,5 @@ DEF_HELPER_3(store_601_batu, void, env, i32, tl)
 
 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)
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index b65b848..d4077c2 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -8357,7 +8357,8 @@ static void gen_##name(DisasContext *ctx)          \
 
 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)
 /***                           SPE extension                               ***/
 /* Register moves */
 
@@ -11287,6 +11288,8 @@ _GEN_DFP_QUADx2(name, op1, op2, 0x00210000)
 
 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),
 #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




reply via email to

[Prev in Thread] Current Thread [Next in Thread]