Commit ec690d62 authored by Sandesh Venkatesh's avatar Sandesh Venkatesh
Browse files

Merge branch '1770-replace-shr_ro-by-overflow-free-alternatives' into 'main'

Resolve "Replace shr_ro by overflow-free alternatives"

Closes #1770

See merge request !1826
parents 574a190e 54a3b922
Loading
Loading
Loading
Loading
Loading
+1 −0
Original line number Diff line number Diff line
@@ -100,5 +100,6 @@

#define FIX_1762_COMPILER_ISSUE                 /* FhG: fix compiler issues with W_mac_32_32() + ONE_IN_Q30 */
#define ISSUE_1751_replace_shl_ro               /*FhG: replace shl_ro by overflow-free alternatives*/
#define ISSUE_1770_replace_shr_ro               /* FhG: replace by non-overflow-alternative - BE */

#endif
+8 −0
Original line number Diff line number Diff line
@@ -3144,7 +3144,11 @@ void add_vec_fx(
    {
        FOR( i = 0; i < N; i++ )
        {
#ifdef ISSUE_1770_replace_shr_ro
            y[i] = add_o( x1[i], shr_r_sat( x2[i], Qyx2 ), &Overflow );
#else
            y[i] = add_o( x1[i], shr_ro( x2[i], Qyx2, &Overflow ), &Overflow );
#endif
            move16();
        }
    }
@@ -3152,7 +3156,11 @@ void add_vec_fx(
    {
        FOR( i = 0; i < N; i++ )
        {
#ifdef ISSUE_1770_replace_shr_ro
            y[i] = add_o( shr_r_sat( x1[i], Qyx1 ), shr_r_sat( x2[i], Qyx2 ), &Overflow );
#else
            y[i] = add_o( shr_ro( x1[i], Qyx1, &Overflow ), shr_ro( x2[i], Qyx2, &Overflow ), &Overflow );
#endif
            move16();
        }
    }
+6 −0
Original line number Diff line number Diff line
@@ -32,9 +32,11 @@ static Word16 find_ener_decrease_fx( /* o : maximum
    Word16 wtmp0, wtmp1;
    Word32 maxEnr, minEnr;
    Word16 dE2, exp0, exp1;
#ifndef ISSUE_1770_replace_shr_ro
#ifdef BASOP_NOGLOB_DECLARE_LOCAL
    Flag Overflow = 0;
    move32();
#endif
#endif

    dE2 = 0;
@@ -76,7 +78,11 @@ static Word16 find_ener_decrease_fx( /* o : maximum
    exp1 = sub( norm_l( maxEnr ), 1 );
    wtmp1 = extract_h( L_shl( maxEnr, exp1 ) );
    wtmp1 = div_s( wtmp1, wtmp0 );
#ifdef ISSUE_1770_replace_shr_ro
    dE2 = shr_r_sat( wtmp1, add( sub( exp1, exp0 ), 15 - 10 ) ); /*Q10*/
#else
    dE2 = shr_ro( wtmp1, add( sub( exp1, exp0 ), 15 - 10 ), &Overflow ); /*Q10*/
#endif

    return dE2;
}