mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-03 07:43:54 -06:00
target-ppc: Introduce DFP Test Significance
Add emulation of the PowerPC Decimal Floating Point Test Significance instructions dtstsf[q][.]. Signed-off-by: Tom Musta <tommusta@gmail.com> Signed-off-by: Alexander Graf <agraf@suse.de>
This commit is contained in:
parent
f3d2b0bce0
commit
f6022a7684
3 changed files with 41 additions and 0 deletions
|
@ -536,3 +536,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)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue