[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Qemu-ppc] [V2 PATCH 25/37] target-ppc: Introduce DFP Test Significance
From: |
Tom Musta |
Subject: |
[Qemu-ppc] [V2 PATCH 25/37] target-ppc: Introduce DFP Test Significance |
Date: |
Mon, 21 Apr 2014 15:55:09 -0500 |
Add emulation of the PowerPC Decimal Floating Point Test Significance
instructions dtstsf[q][.].
Signed-off-by: Tom Musta <address@hidden>
---
V2: Modified post processor handling per Richard Henderson's review.
target-ppc/dfp_helper.c | 35 +++++++++++++++++++++++++++++++++++
target-ppc/helper.h | 2 ++
target-ppc/translate.c | 4 ++++
3 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/target-ppc/dfp_helper.c b/target-ppc/dfp_helper.c
index de4240b..c8ba108 100644
--- a/target-ppc/dfp_helper.c
+++ b/target-ppc/dfp_helper.c
@@ -533,3 +533,38 @@ uint32_t helper_##op(CPUPPCState *env, uint64_t *a,
uint64_t *b) \
DFP_HELPER_TSTEX(dtstex, 64)
DFP_HELPER_TSTEX(dtstexq, 128)
+
+#define DFP_HELPER_TSTSF(op, size) \
+uint32_t helper_##op(CPUPPCState *env, uint64_t *a, uint64_t *b) \
+{ \
+ struct PPC_DFP dfp; \
+ unsigned k; \
+ \
+ dfp_prepare_decimal##size(&dfp, 0, b, env); \
+ \
+ k = *a & 0x3F; \
+ \
+ if (unlikely(decNumberIsSpecial(&dfp.b))) { \
+ dfp.crbf = 1; \
+ } else if (k == 0) { \
+ dfp.crbf = 4; \
+ } else if (unlikely(decNumberIsZero(&dfp.b))) { \
+ /* Zero has no sig digits */ \
+ dfp.crbf = 4; \
+ } else { \
+ unsigned nsd = dfp.b.digits; \
+ if (k < nsd) { \
+ dfp.crbf = 8; \
+ } else if (k > nsd) { \
+ dfp.crbf = 4; \
+ } else { \
+ dfp.crbf = 2; \
+ } \
+ } \
+ \
+ dfp_set_FPCC_from_CRBF(&dfp); \
+ return dfp.crbf; \
+}
+
+DFP_HELPER_TSTSF(dtstsf, 64)
+DFP_HELPER_TSTSF(dtstsfq, 128)
diff --git a/target-ppc/helper.h b/target-ppc/helper.h
index af9d9c9..182e871 100644
--- a/target-ppc/helper.h
+++ b/target-ppc/helper.h
@@ -636,4 +636,6 @@ DEF_HELPER_3(dtstdg, i32, env, fprp, i32)
DEF_HELPER_3(dtstdgq, i32, env, fprp, i32)
DEF_HELPER_3(dtstex, i32, env, fprp, fprp)
DEF_HELPER_3(dtstexq, i32, env, fprp, fprp)
+DEF_HELPER_3(dtstsf, i32, env, fprp, fprp)
+DEF_HELPER_3(dtstsfq, i32, env, fprp, fprp)
#include "exec/def-helper.h"
diff --git a/target-ppc/translate.c b/target-ppc/translate.c
index 510c2a7..d059802 100644
--- a/target-ppc/translate.c
+++ b/target-ppc/translate.c
@@ -8374,6 +8374,8 @@ GEN_DFP_BF_A_DCM(dtstdg)
GEN_DFP_BF_A_DCM(dtstdgq)
GEN_DFP_BF_A_B(dtstex)
GEN_DFP_BF_A_B(dtstexq)
+GEN_DFP_BF_A_B(dtstsf)
+GEN_DFP_BF_A_B(dtstsfq)
/*** SPE extension ***/
/* Register moves */
@@ -11319,6 +11321,8 @@ GEN_DFP_BF_A_DCM(dtstdg, 0x02, 0x07),
GEN_DFP_BF_Ap_DCM(dtstdgq, 0x02, 0x07),
GEN_DFP_BF_A_B(dtstex, 0x02, 0x05),
GEN_DFP_BF_Ap_Bp(dtstexq, 0x02, 0x05),
+GEN_DFP_BF_A_B(dtstsf, 0x02, 0x15),
+GEN_DFP_BF_A_Bp(dtstsfq, 0x02, 0x15),
#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 31/37] target-ppc: Introduce DFP Convert to Fixed, (continued)
- [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
- [Qemu-ppc] [V2 PATCH 01/37] libdecnumber: Introduce libdecnumber Code, Tom Musta, 2014/04/21
- [Qemu-ppc] [V2 PATCH 35/37] target-ppc: Introduce DFP Extract Biased Exponent, Tom Musta, 2014/04/21
- [Qemu-ppc] [V2 PATCH 22/37] target-ppc: Introduce DFP Test Data Class, Tom Musta, 2014/04/21
- [Qemu-ppc] [V2 PATCH 27/37] target-ppc: Introduce DFP Reround, Tom Musta, 2014/04/21
- [Qemu-ppc] [V2 PATCH 26/37] target-ppc: Introduce DFP Quantize, Tom Musta, 2014/04/21
- [Qemu-ppc] [V2 PATCH 37/37] target-ppc: Introduce DFP Shift Significand, Tom Musta, 2014/04/21
- [Qemu-ppc] [V2 PATCH 25/37] target-ppc: Introduce DFP Test Significance,
Tom Musta <=
- [Qemu-ppc] [V2 PATCH 34/37] target-ppc: Introduce DFP Encode BCD to DPD, Tom Musta, 2014/04/21
- [Qemu-ppc] [V2 PATCH 36/37] target-ppc: Introduce DFP Insert Biased Exponent, Tom Musta, 2014/04/21