This patch series adds emulation of the PowerPC Decimal Floating Point (DFP) instructions. The complete set of DFP instructions defined by the Power ISA is introduced.
The foundation of the emulation code is libdecnumber, a software library that models DFP numbers and operations in a manner similar to how softfloat models IEEE Binary Floating Point. A subset of the libdecnumber source (from GCC) is dropped into the QEMU source tree and modified slightly; only libdecnumber files containing code that is required to implement the PowerPC DFP instructions are copied. The DFP instructions are implemented via helpers. A typical helper does the following: - The contents of the source registers (PPC FPRs) are converted to libdecnumber's internal representation, the decNumber type. Inputs are either 64 bit (Long) or 128 bit (Extended or Quad) densely packed decimal (DPD), depending on the specific instruction being emulated. - A libdecnumber operation is invoked, producing a decNumber result as well as status flags. - A chain of post-processors is executed to convert status flags and/or input and output data to PPC status (usually FPSCR bits). - The decNumber result is converted back to DPD format and written into the target FPR(s). V2: - modified post-processor handling per Richard Henderson's comments; eliminated the use of lists of function pointers, replacing with aggregated, static functions. - cleaned up int64 to decNumber converter. Tom Musta (37): libdecnumber: Introduce libdecnumber Code libdecnumber: Eliminate #include *Symbols.h libdecnumber: Prepare libdecnumber for QEMU include structure libdecnumber: Modify dconfig.h to Integrate with QEMU libdecnumber: Change gstdint.h to stdint.h libdecnumber: Eliminate redundant declarations libdecnumber: Eliminate Unused Variable in decSetSubnormal target-ppc: Enable Building of libdecnumber libdecnumber: Introduce decNumberFrom[U]Int64 libdecnumber: Introduce decNumberIntegralToInt64 libdecnumber: Fix decNumberSetBCD target-ppc: Define FPR Pointer Type for Helpers target-ppc: Introduce Generator Macros for DFP Arithmetic Forms target-ppc: Introduce Decoder Macros for DFP target-ppc: Introduce DFP Helper Utilities target-ppc: Introduce DFP Post Processor Utilities target-ppc: Introduce DFP Add target-ppc: Introduce DFP Subtract target-ppc: Introduce DFP Multiply target-ppc: Introduce DFP Divide target-ppc: Introduce DFP Compares target-ppc: Introduce DFP Test Data Class target-ppc: Introduce DFP Test Data Group target-ppc: Introduce DFP Test Exponent target-ppc: Introduce DFP Test Significance target-ppc: Introduce DFP Quantize target-ppc: Introduce DFP Reround target-ppc: Introduce DFP Round to Integer target-ppc: Introduce DFP Convert to Long/Extended target-ppc: Introduce Round to DFP Short/Long target-ppc: Introduce DFP Convert to Fixed target-ppc: Introduce DFP Convert to Fixed target-ppc: Introduce DFP Decode DPD to BCD target-ppc: Introduce DFP Encode BCD to DPD target-ppc: Introduce DFP Extract Biased Exponent target-ppc: Introduce DFP Insert Biased Exponent target-ppc: Introduce DFP Shift Significand Makefile.target | 6 + default-configs/ppc-linux-user.mak | 1 + default-configs/ppc-softmmu.mak | 1 + default-configs/ppc64-linux-user.mak | 1 + default-configs/ppc64-softmmu.mak | 1 + include/libdecnumber/dconfig.h | 40 + include/libdecnumber/decContext.h | 257 + include/libdecnumber/decDPD.h | 1215 +++++ include/libdecnumber/decNumber.h | 202 + include/libdecnumber/decNumberLocal.h | 665 +++ include/libdecnumber/dpd/decimal128.h | 100 + include/libdecnumber/dpd/decimal128Local.h | 47 + include/libdecnumber/dpd/decimal32.h | 98 + include/libdecnumber/dpd/decimal64.h | 100 + libdecnumber/decContext.c | 434 ++ libdecnumber/decNumber.c | 8194 ++++++++++++++++++++++++++++ libdecnumber/dpd/decimal128.c | 564 ++ libdecnumber/dpd/decimal128Local.h | 42 + libdecnumber/dpd/decimal32.c | 489 ++ libdecnumber/dpd/decimal64.c | 850 +++ target-ppc/Makefile.objs | 1 + target-ppc/dfp_helper.c | 1314 +++++ target-ppc/helper.h | 54 + target-ppc/translate.c | 386 ++ 24 files changed, 15062 insertions(+), 0 deletions(-) create mode 100644 include/libdecnumber/dconfig.h create mode 100644 include/libdecnumber/decContext.h create mode 100644 include/libdecnumber/decDPD.h create mode 100644 include/libdecnumber/decNumber.h create mode 100644 include/libdecnumber/decNumberLocal.h create mode 100644 include/libdecnumber/dpd/decimal128.h create mode 100644 include/libdecnumber/dpd/decimal128Local.h create mode 100644 include/libdecnumber/dpd/decimal32.h create mode 100644 include/libdecnumber/dpd/decimal64.h create mode 100644 libdecnumber/decContext.c create mode 100644 libdecnumber/decNumber.c create mode 100644 libdecnumber/dpd/decimal128.c create mode 100644 libdecnumber/dpd/decimal128Local.h create mode 100644 libdecnumber/dpd/decimal32.c create mode 100644 libdecnumber/dpd/decimal64.c create mode 100644 target-ppc/dfp_helper.c