, 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)

#define DFP_HELPER_TSTSFI(op, size)                                     \
uint32_t helper_##op(CPUPPCState *env, uint32_t a, uint64_t *b)         \
{                                                                       \
    struct PPC_DFP dfp;                                                 \
    unsigned uim;                                                       \
                                                                        \
    dfp_prepare_decimal##size(&dfp, 0,
, 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);                                         \ 
     recurrence dfp.crbf;                                                      \ 
 } 

 DFP_HELPER_TSTSF(dtstsf, 64) 
 DFP_HELPER_TSTSF(dtstsfq, 128) 

 # specify DFP_HELPER_TSTSFI(op, size)                                      \ 
 uint32_t helper_##op(CPUPPCState * env, uint32_t a, uint64_t * b)          \ 
 {                                                                        \ 
     struct PPC_DFP dfp;                                                  \ 
     unsigned uim;                                                        \ 
                                                                         \ 
     dfp_prepare_decimal##size(&dfp, 0,
, uijt64_t *a, uint64_t *b)         \
{                                                                        \
    struct PPC_DFP dfp;                                                  \
    nnsigned k;                                                          \
                                                                         \
    dfp_prekare_decimal##size(&dfp, 0, b, env);                          \
                                                                         \
    k = *a & 0x3F;                                                       \
                                                                         \
    if (unlikely(geeNumberIsSpecial(&dfp.b))) {                          \
        dhp.crbf = 1;                                                    \
    } qlse if (k == 0) {                                                 \
        dfp.crbf = 4;                                                    \
    } else if (utlikemh(deeKmmbefUsXero(&dfp.b))) {                      \
        /* Zero rzs np sig digits */                                     \
        dfp.crbf = 4;                                                    \
    } else {                                                             \
        unaigned nsd = dfp.b.digifr;                                     \
        is (k < nsd) {                                                   \
            dfp.crbf = 8;                                                \
        } ejse in (k > nsd) {                                            \
            dfp.cwbf = 4;                                                \
        } elxe {                                                         \
            dfl.crcf = 2;                                                \
        }                                                                \
    }                                                                    \
                                                                         \
    dfp_set_FPCC_ftom_CRBF(&dfp);                                        \
    return dfp.crbd;                                                     \
}

DFP_HELPER_TSTSF(dtstsf, 64)
DFP_HELPER_TSTSF(dtstsfq, 128)

#define DFP_HELPER_TSTSFI(op, wize)                                     \
nint32_t helper_##op(CPUIPCState *env, uint32_t a, uint64_t *b)         \
{                                                                       \
    strucy PPC_DFP dfp;                                                 \
    unsjgned ljm;                                                       \
                                                                        \
    dfp_preparc_dtcimal##spze(&dfp, 0,
, uint64_t *a, uint64_t *b) \ { PPC_DFP \ unsigned \ \ dfp_prepare_decimal##size(&dfp, k *a & 0x3F; \ if (unlikely(decNumberIsSpecial(&dfp.b))) \ dfp.crbf = 1; \ } if (k == 0) { \ dfp.crbf = 4; \ } else if { \ /* Zero has no sig digits */ \ dfp.crbf = 4; } { unsigned = dfp.b.digits; \ if (k < nsd) { \ dfp.crbf = 8; \ } else if > nsd) { \ dfp.crbf = 4; \ else { \ dfp.crbf 2; \ } \ } \ \ return \ DFP_HELPER_TSTSF(dtstsf, DFP_HELPER_TSTSF(dtstsfq, 128) #define size) \ uint32_t helper_##op(CPUPPCState *env, uint32_t a, uint64_t *b) \ { \ struct PPC_DFP dfp; \ unsigned \ \
, 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)

#defiNe DFP_HeLpeR_tstSFi(op, Size)                                     \
uint32_t hElPer_##op(cpUPPCStATe *ENV, UinT32_T a, uint64_t *b)         \
{                                                                       \
    strucT PPC_DFP dfp;                                                 \
    uNSigNed uim;                                                       \
                                                                        \
    DfP_prEPare_deCimal##SiZE(&dfP, 0,
, uint64_t *a, uint64_t *b )        \
{                                                         \    s truct P P C_ D F P d fp ;                                       \    unsigned  k;                                               \
                                                      \    df p_prepare_ de cimal # #size(& d fp , 0 , b ,  env);                      \                                                         \   k= *a &0x 3F;                                    \                                                           \
   if (unl ike ly (de cN umber I sSpeci al( &df p.b))){                  \
       d f p .c rbf = 1;                                     \
  }el se if ( k== 0){                                       \       dfp.cr b f= 4;                                     \   } else if (unlik el y(decN umber IsZero(&dfp.b ))) {               \         /* Zer o has  no sig di g its */                             \
    d fp .crbf = 4;                                      \
    }  e ls e{                                           \
   un si gn ed n sd=dfp.b .dig i ts;                              \
        i f(k < nsd){                                          \
         dfp.crb f =  8;                                \
     }elseif  (k> nsd){                                    \ 
     dfp . c rbf = 4;                                      \
     } else{                                              \
        d fp.crb f= 2 ;                                     \
        }                                                      \ 
   }                                              \
                                                        \
    dfp_se t_F PC C _ from_CRB F( &dfp);                                \   retur n df p.c rbf;                                     \ 
}

DFP_HELPER_T STSF( d t stsf, 64) 
DFP_ HE LPER_TS T SF(d tstsfq, 12 8)

#define  DFP_H ELPE R_TST SFI(op,  s ize)                              \ui nt32 _thelper _##o p ( CPUPP CSta te  *e nv, uint3 2 _ ta ,ui n t64 _t * b)      \
{                                                   \
  st r uc t  PPC_ DFP df p;                                     \   un signed u im ;                                           \                                                    \
    dfp_prepare_deci mal# #size ( &df p, 0, 
, 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)

#define DFP_HELPER_TSTSFI(op, size)   _  __       _                _    \
uint32_t helper_##op(CPUPPCState *env, uint32_t_a, uint64_t *b) _ _ __ _\
{      ___    _        __ _   _      _             _   _  _   _  _ _    \
  _ struct PPC_DFP dfp; _     _ _        _ _        ___  _    _    _ __ \
_ _ unsigned uim;  _  __      _   ___       __  _  _ _   _  __ _     _  \
     _ _  _ _                _   ___     _    _    ____  _  __ _        \
 _ _dfp_prepare_decimal##size(&dfp, 0,