Commit 05020caa authored by Fabian Bauer's avatar Fabian Bauer
Browse files

mux only version

parent aa5533d0
Loading
Loading
Loading
Loading
Loading
+17 −21
Original line number Diff line number Diff line
@@ -2566,6 +2566,11 @@ Word16 BASOP_Util_Cmp_Mant32Exp /*!< o: flag: result of comparison */
*/

#if 1
static Word32 mux32( int decision, Word32 Lv1, Word32 Lv2 )
{
    return Q6_R_mux_pRR( decision, Lv1, Lv2 );
}

Word32 BASOP_Util_Add_Mant32Exp(
    Word32 Mant1,
    Word16 exp1,
@@ -2577,35 +2582,26 @@ Word32 BASOP_Util_Add_Mant32Exp(
    Word32 tmp1, tmp2, tmp_res;
    Word16 scale_tmp, scale_tmp2, scale_tmp3;

    int M1_iszero = EQ_32( Mant1, 0 );
    int M2_iszero = EQ_32( Mant2, 0 );
    exp2 = mux32( M2_iszero, exp1, exp2 );
    exp1 = mux32( M1_iszero, exp2, exp1 );

    if ( Mant1 == 0 )
    {
        exp1 = exp2;
        move16();
    }
    Word16 e1e2max = s_max( exp2, exp1 );
    Word32 M1_M2 = L_shl( Mant1, sub( exp1, e1e2max ) );
    Word32 M2_M1 = L_shl( Mant2, sub( exp2, e1e2max ) );

    if ( Mant2 == 0 )
    {
        exp2 = exp1;
        move16();
    }
    Mant1 = L_shr( mux32( M2_iszero, Mant1, M1_M2 ), 1 );
    Mant2 = L_shr( mux32( M1_iszero, Mant2, M2_M1 ), 1 );

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

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

    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 );
    }
    scale_tmp3 = mux32( EQ_32( tmp_res, 0 ), 0, sub( scale_tmp, scale_tmp2 ) );

    *exp_res = scale_tmp3;
    move16();