Commit ea2c4fda authored by Manuel Jander's avatar Manuel Jander
Browse files

Revert OPT_BASOP_Util_Divide3232_Scale_cadence optimization attempt.

parent ce0482b4
Loading
Loading
Loading
Loading
Loading
+1 −60
Original line number Diff line number Diff line
@@ -1038,68 +1038,9 @@ Word32 div_w( Word32 L_num, Word32 L_den )
    }
}

#define OPT_BASOP_Util_Divide3232_Scale_cadence

#ifdef OPT_BASOP_Util_Divide3232_Scale_cadence
static
Word32 BASOP_Util_Inv32(Word32 x, Word16 *px_e)
{
    Word16 sign, shift, shift2;

    /* Avoid result 0 with inconvenient exponent returned. */
    IF( x == (Word32) 0 )
    {
        *px_e = 31;
        return ( (Word32) MAX_32 );
    }

    sign = 0;
    move16();
    if (x < 0) {
        sign = 1;
    }
    if (sign) {
        x = L_negate(x);
    }

    shift = norm_l(x);
    x = L_shl(x, shift);
    *px_e = 0;
    move16();
    x = ISqrt32norm(x, px_e);
    x = Mpy_32_32(x, x);
    shift2 = norm_l(x);
    x = L_shl(x, shift2);
    *px_e = add(shl(*px_e, 1), sub(shift, shift2));
    move16();

    if (sign) {
        x = L_negate(x);
    }
    return x;
}
#endif

Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s )
{
    Word32 z;

#ifdef OPT_BASOP_Util_Divide3232_Scale_cadence
    Word16 shift, s2;

    IF( x == (Word32) 0 )
    {
        *s = 0;
        return ( (Word32) 0 );
    }

    z = BASOP_Util_Inv32(y, &s2);
    shift = norm_l(x);
    z = Mpy_32_32_r(L_shl(x, shift), z);
    *s = sub(s2, shift);
    move16();
#else

    Word16 sx;
    Word16 sy;
    Word32 sign;
@@ -1145,7 +1086,7 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s )
    {
        z = L_negate( z );
    }
#endif

    return z;
}