Commit 5aae8ccc authored by Manuel Jander's avatar Manuel Jander
Browse files

Reduce WMOPS by approx. 300 for test case in issue #1010

parent f683bb94
Loading
Loading
Loading
Loading
Loading
+44 −1
Original line number Diff line number Diff line
@@ -1038,9 +1038,52 @@ 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;

    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);
    *px_e = add(shl(*px_e, 1), shift);
    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;
    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;
@@ -1086,7 +1129,7 @@ Word32 BASOP_Util_Divide3232_Scale_cadence( Word32 x, Word32 y, Word16 *s )
    {
        z = L_negate( z );
    }

#endif
    return z;
}

+324 −2

File changed.

Preview size limit exceeded, changes collapsed.