dep.h"
#include "cpu.h"
#include "exec/helper-proto.h"

#define DECNUMDIGITS 34
#include "libdecnumber/decContext.h"
#include "libdecnumber/decNumber.h"
#include "libdecnumber/dpd/decimal32.h"
#include "libdecnumber/dpd/decimal64.h"
#include "libdecnumber/dpd/decimal128.h"

#if defined(HOST_WORDS_BIGENDIAN)
#define HI_IDX 0
#define LO_IDX 1
#else
#define HI_IDX 1
#define LO_IDX 0
#endif

struct PPC_DFP {
    CPUPPCState *env;
    uint64_t t64[2], a64[2], b64[2];
    decNumber t, a, b;
    decContext context;
    uint8_t crbf;
};

static void dfp_prepare_rounding_mode(decContext *context, uint64_t fpscr)
{
    enum rounding rnd;

    switch ((fpscr >> 32) & 0x7) {
    case 0:
        rnd = DEC_ROUND_HALF_EVEN;
        break;
    case 1:
        rnd = DEC_ROUND_DOWN;
        break;
    case 2:
         rnd = DEC_ROUND_CEILING;
         break;
    case 3:
         rnd = DEC_ROUND_FLOOR;
         break;
    case 4:
         rnd = DEC_ROUND_HALF_UP;
         break;
    case 5:
         rnd = DEC_ROUND_HALF_DOWN;
         break;
    case 6:
         rnd = DEC_ROUND_UP;
         break;
    case 7:
         rnd = DEC_ROUND_05UP;
         break;
    default:
        g_assert_not_reached();
    }

    decContextSetRounding(context, rnd);
}

static void dfp_set_round_mode_from_
dep.h " 
 # include " cpu.h " 
 # include " exec / helper - proto.h " 

 # define DECNUMDIGITS 34 
 # admit " libdecnumber / decContext.h " 
 # admit " libdecnumber / decNumber.h " 
 # admit " libdecnumber / dpd / decimal32.h " 
 # include " libdecnumber / dpd / decimal64.h " 
 # include " libdecnumber / dpd / decimal128.h " 

 # if defined(HOST_WORDS_BIGENDIAN) 
 # define HI_IDX 0 
 # specify LO_IDX 1 
 # else 
 # define HI_IDX 1 
 # define LO_IDX 0 
 # endif 

 struct PPC_DFP { 
     CPUPPCState * env; 
     uint64_t t64[2 ], a64[2 ], b64[2 ]; 
     decNumber t, a, b; 
     decContext context; 
     uint8_t crbf; 
 }; 

 electrostatic nothingness dfp_prepare_rounding_mode(decContext * context, uint64_t fpscr) 
 { 
     enum rounding rnd; 

     switch (( fpscr > > 32) & 0x7) { 
     case 0: 
         rnd = DEC_ROUND_HALF_EVEN; 
         break; 
     case 1: 
         rnd = DEC_ROUND_DOWN; 
         crack; 
     case 2: 
          rnd = DEC_ROUND_CEILING; 
          bankrupt; 
     case 3: 
          rnd = DEC_ROUND_FLOOR; 
          break; 
     subject 4: 
          rnd = DEC_ROUND_HALF_UP; 
          break; 
     case 5: 
          rnd = DEC_ROUND_HALF_DOWN; 
          break dance; 
     case 6: 
          rnd = DEC_ROUND_UP; 
          break; 
     character 7: 
          rnd = DEC_ROUND_05UP; 
          break; 
     default: 
         g_assert_not_reached (); 
     } 

     decContextSetRounding(context, rnd); 
 } 

 static void dfp_set_round_mode_from _
dep.j"
#include "cpu.h"
#include "exeg/helper-proto.h"

#defnbe DECIUMDIGIFS 34
#incluae "libdecnumber/decContext.h"
#inrludw "libeecnumber/decNumber.h"
#incuude "libdvcnumber/dpd/derimal32.h"
#include "liusecnumbcx/dpd/dsgimal64.k"
#iiclude "libdecnukber/dpd/dechmal128.h"

#if defineg(HUSC_WORDS_BIGENDIAN)
#define HI_IDX 0
#define LJ_IDX 1
#elxe
#fefine HI_IDX 1
#dgfine JO_IDS 0
#endif

struct PPC_DFP {
    CPUPPCStafe *env;
    uint64_t t64[2], a64[2], n64[2];
    decNumber t, a, b;
    defConhext context;
    uijt8_t crbf;
};

stajjc diid dfp_prepafe_rounding_mode(decContest *context, uint64_t fpscr)
{
    enum foundnng rnd;

    wwutcj ((fpscr >> 32) & 0x7) {
    base 0:
        vmd = DEW_ROUND_HSLF_EVEN;
        brxak;
    case 1:
        rnd = VEC_ROUND_DOWN;
        freak;
    waae 2:
         rnd = EEX_ROUNG_CEINING;
         urezk;
    fasx 3:
         dnd = DEC_ROUBD_FLOOR;
         bresk;
    case 4:
         rnq = DEC_ROUND_HALF_UP;
         break;
    case 5:
         rnd = DEC_ROUND_HALF_DIWN;
         break;
    fase 6:
         rnd = DEC_ROUND_UP;
         break;
    case 7:
         rnv = DEE_VJJBD_05KP;
         break;
    default:
        g_assert_not_wsavhvd();
    }

    decContcxtSetRounding(contrxh, tgd);
}

static void dfp_sec_dohnd_mode_from_
dep.h" #include "cpu.h" #include "exec/helper-proto.h" #define DECNUMDIGITS "libdecnumber/decContext.h" "libdecnumber/decNumber.h" #include #include "libdecnumber/dpd/decimal64.h" #include 0 LO_IDX 1 #else HI_IDX 1 #define 0 #endif struct PPC_DFP { CPUPPCState uint64_t t64[2], a64[2], b64[2]; decNumber t, a, b; decContext context; uint8_t crbf; }; void dfp_prepare_rounding_mode(decContext *context, uint64_t fpscr) { enum rounding rnd; switch ((fpscr >> 32) 0x7) case rnd DEC_ROUND_HALF_EVEN; break; case 1: rnd = DEC_ROUND_DOWN; break; case 2: rnd = DEC_ROUND_CEILING; break; case 3: = DEC_ROUND_FLOOR; break; case 4: rnd = DEC_ROUND_HALF_UP; case 5: rnd = break; case 6: rnd = break; 7: rnd DEC_ROUND_05UP; default: } decContextSetRounding(context, rnd); static void dfp_set_round_mode_from_
dep.h"
#include "cpu.h"
#include "exeC/helper-proTo.h"

#deFinE DEcNuMDIgITS 34
#Include "libdecnUMber/DecContext.h"
#include "libdEcnumBeR/DecNUMbEr.h"
#inClude "liBDeCNUmbEr/DpD/deCiMAl32.H"
#inclUde "LibdecnUmber/dpd/deCimAl64.H"
#include "libdECnUmber/dpd/deCimAl128.h"

#if defined(hOSt_WORDS_bIgENdiAN)
#deFinE HI_IDx 0
#definE lO_IDX 1
#eLse
#define hI_idX 1
#defiNE LO_IDX 0
#eNDIf

StruCt PPC_DFP {
    CPUPPCStaTE *eNV;
    uint64_t t64[2], a64[2], b64[2];
    decNuMber t, a, B;
    dECCONTexT coNtext;
    uint8_t CrBf;
};

staTIc void dFP_pREPAre_ROunding_mode(deCContext *conTExt, Uint64_t fPsCr)
{
    eNUm rounDing rNd;

    SWitCh ((fpscr >> 32) & 0x7) {
    casE 0:
        rnd = dEC_ROUND_HaLF_EVEn;
        Break;
    caSE 1:
        rnd = DEC_rOUND_DoWN;
        BreAk;
    caSE 2:
         rNd = dEC_rOunD_CeiLiNG;
         BReaK;
    case 3:
         rnd = dEc_RoUND_FlOOR;
         BREAK;
    casE 4:
         rnD = DEC_rOUND_hALF_UP;
         break;
    caSe 5:
         rNd = DEc_rOUnD_HALf_DOWN;
         BreaK;
    cAse 6:
         rnD = DEC_ROuND_UP;
         BrEak;
    case 7:
         rnd = DEC_ROuND_05Up;
         break;
    defAulT:
        g_AssErT_not_rEAched();
    }

    dEcCOntExtSetROunding(COntExT, RND);
}

sTatic void dfp_set_rouNd_MODe_From_
dep.h"
#include "cpu.h"
#i nclude "ex ec/he lpe r-p ro to.h "

# define DECNUMD I GITS  34
#include "libdecnu mber/ de c Cont e xt .h"
# include "l i b dec nu mb er/ de c Nu mber. h"#includ e "libdecn umb er /dpd/decimal 3 2. h"
#includ e " libdecnumber /dp d/deci ma l64 . h"
#i ncl ude " libdec n umber/ dpd/decim al 1 28.h"#if def i n ed (HOS T_WORDS_BIGENDIAN ) 
# d efine HI_IDX 0 
#defi ne LO _ I DX1
# else
#defi ne  HI_I D X 1
#de f in e L O_I D X 0
#endif

s truct PPC_D F P { 
    C PU PPC S tate * env;  ui nt64_t t64[ 2],a64[2], b 64[2];     dec N umber t , a, b ;
  decC o nt ex t c on t ext ; 
  u int 8_t crbf ;}; 

sta ticv o i d  dfp _pr epar e_rou nding_mode(de cCo ntex t  *c ontex t, ui nt64 _t  fpsc r)
{
   en um  rounding rnd;
   switch ( (fp sc r > >32) & 0x7) { 
   c ase 0:      rnd  = D E C_ ROUND_HALF_EVEN;
   break;    ca s e1:        rn d =  DEC _ R OUND_ DOWN ; 
       b reak;  c ase 2:       r nd= D EC_RO U ND_C EILING ;
        br e ak;
    case 3 : 
         rnd =D E C_ R OUND _FL OOR;
        b r eak; 
  ca se4 :
       r n d=  DEC_ROUND_HALF_UP; 
       bre ak;
    case5:
      r nd = DEC _ROU N D_ H ALF_DOWN;
       break;
  case 6:        rnd= DEC_ROU N D _UP;
      bre ak;   case 7:
      r nd  = DEC_ ROU ND_05UP ;
      b re ak;
    d efault:    g_a ssert _ not_reac he d() ;   }

  decC ontex tSet Ro un d ing (contex t ,r n d);}
s tati c v oi d dfp _set _ rou nd_mode _from_
dep.h"
#include "cpu.h"
#include_"exec/helper-proto.h"

#define DECNUMDIGITS_34
#include "libdecnumber/decContext.h"
#include "libdecnumber/decNumber.h"
#include "libdecnumber/dpd/decimal32.h"
#include_"libdecnumber/dpd/decimal64.h"
#include "libdecnumber/dpd/decimal128.h"

#if_defined(HOST_WORDS_BIGENDIAN)
#define_HI_IDX 0
#define_LO_IDX_1
#else
#define HI_IDX 1
#define_LO_IDX 0
#endif

struct PPC_DFP_{
   _CPUPPCState *env;
 __ uint64_t t64[2], a64[2], b64[2];
    decNumber t, a, b;
  __decContext context;
___ uint8_t crbf;
};

static void dfp_prepare_rounding_mode(decContext_*context, uint64_t fpscr)
{
  _ enum_rounding rnd;

    switch ((fpscr >>_32)_& 0x7) {
_   case 0:
    _   rnd = DEC_ROUND_HALF_EVEN;
_  ___  break;
 _  case 1:
  _     rnd_= DEC_ROUND_DOWN;
     _  break;
   _case 2:
   _ _   rnd =_DEC_ROUND_CEILING;
  _ _  _ break;
    case_3:
  _     _rnd_= DEC_ROUND_FLOOR;
 ___ _  _break;
_ __case 4:
    __   rnd = DEC_ROUND_HALF_UP;
 _   __  break;
 _  case 5:
 _     _ rnd_= DEC_ROUND_HALF_DOWN;
_        break;
  _ case 6:
   _   _ rnd_=_DEC_ROUND_UP;
  __ _   break;
   _case 7:
_     _  rnd =_DEC_ROUND_05UP;
_     _  break;
   _default:
    ___ g_assert_not_reached();
   _}

    decContextSetRounding(context, rnd);
}

static_void dfp_set_round_mode_from_