Commit d3c8861d authored by Fabian Bauer's avatar Fabian Bauer
Browse files

set new addmant32exp as inline

parent aa83b914
Loading
Loading
Loading
Loading
+1 −48
Original line number Diff line number Diff line
@@ -2512,54 +2512,7 @@ Word16 BASOP_Util_Cmp_Mant32Exp /*!< o: flag: result of comparison */
     headroom is introduced into acc
*/

#if 1
Word32 BASOP_Util_Add_Mant32Exp(
  Word32 Mant1,
  Word16 exp1,
  Word32 Mant2,
  Word16 exp2,
  Word16* exp_res)
{

  Word32 tmp1, tmp2, tmp_res;
  Word16 scale_tmp, scale_tmp2, scale_tmp3;


    if ( Mant1 == 0 )
    {
        exp1 = exp2;
        move16();
    }

    if ( Mant2 == 0 )
    {
        exp2 = exp1;
        move16();
    }

    scale_tmp = add( s_max( exp2, exp1 ), 1 );
    tmp1 = L_shl( Mant1, sub( exp1, scale_tmp ) );

    tmp2 = L_shl( Mant2, sub( exp2, scale_tmp ) );
    tmp_res = L_add( tmp1, tmp2 );

  scale_tmp2 = norm_l(tmp_res);
  tmp_res = L_shl(tmp_res, scale_tmp2);

    scale_tmp3 = 0;
    move16();

    if ( tmp_res != 0 )
    {
        scale_tmp3 = sub( scale_tmp, scale_tmp2 );
    }

  *exp_res = scale_tmp3;
  move16();

  return tmp_res;
}
#else
#ifndef ISSUE_2247_Accelerate_AddMant32Exp
Word32 BASOP_Util_Add_Mant32Exp /* o  : normalized result mantissa */
    ( Word32 a_m,               /* i  : Mantissa of 1st operand a  */
      Word16 a_e,               /* i  : Exponent of 1st operand a  */
+50 −0
Original line number Diff line number Diff line
@@ -59,6 +59,56 @@
#define CHEAP_NORM_SIZE 161
#endif

#ifdef ISSUE_2247_Accelerate_AddMant32Exp
static __inline Word32 BASOP_Util_Add_Mant32Exp(
    Word32 Mant1,
    Word16 exp1,
    Word32 Mant2,
    Word16 exp2,
    Word16 *exp_res )
{

    Word32 tmp1, tmp2, tmp_res;
    Word16 scale_tmp, scale_tmp2, scale_tmp3;


    if ( Mant1 == 0 )
    {
        exp1 = exp2;
        move16();
    }

    if ( Mant2 == 0 )
    {
        exp2 = exp1;
        move16();
    }

    scale_tmp = add( s_max( exp2, exp1 ), 1 );
    tmp1 = L_shl( Mant1, sub( exp1, scale_tmp ) );

    tmp2 = L_shl( Mant2, sub( exp2, scale_tmp ) );
    tmp_res = L_add( tmp1, tmp2 );

    scale_tmp2 = norm_l( tmp_res );
    tmp_res = L_shl( tmp_res, scale_tmp2 );

    scale_tmp3 = 0;
    move16();

    if ( tmp_res != 0 )
    {
        scale_tmp3 = sub( scale_tmp, scale_tmp2 );
    }

    *exp_res = scale_tmp3;
    move16();

    return tmp_res;
}

#endif

static __inline Word16 limitScale16( Word16 s )
{
    /* It is assumed, that s is calculated just before, therefore we can switch upon sign */