AnsweredAssumed Answered

fract in C for Sharc

Question asked by bookevg on Nov 8, 2011
Latest reply on Nov 25, 2013 by MikeP

I start to use fract type in C VDSP++.Update10 for Sharc.

My code in C:

/*****************************************************************************
* Fract.c
*****************************************************************************/
#include "stdfix.h"

 

fract ADC[32];
fract Coeff[32];
fract Corr[32];

int Run( void )
{
fract               *pDataDst_Sig          = (fract               *)&ADC[0];
fract               *pDataDst_Coeff          = (fract               *)&Coeff[0];
fract               *pDataSrc_Sig          = (fract               *)&Corr[0];
int i;
for (i     = 0; i < 32; i++)
{
fract               x     = *pDataDst_Sig++;
fract               k     = *pDataDst_Coeff++;
fract               y     = k*x;
*pDataSrc_Sig++          = y << 1;
}
return 0;
}

 

int main( void )
{
Run();
return 0;
}

 

I can't understand why

*pDataSrc_Sig++          = y << 1;

waste so much asm intructions:

*pDataSrc_Sig++          = y << 1;
[124383] r2=lshift r2 by 0x1;
[124386] r2=r2 or lshift r1 by 0xffffffe1;
[124389] MRF=r2*r12(ssi);
[12438B] r1=lshift r1 by 0x1;
[12438E] mr0f=r1;
[124390] lcntr=0xf, do (pc,0x1c) until lce;
[124393] mr1f=r2, r2=dm(i4,0x2);
[124396] r1=sat MRF(si), r0=dm(i5,0x2);
[124399] MRF=r0*r2(ssf), dm(i3,0x2)=r1;
[12439E] r0=lshift r1 by 0x1;
[1243A3] r2=lshift r2 by 0x1;
[1243A6] r2=r2 or lshift r1 by 0xffffffe1;
[1243A9] MRF=r2*r12(ssi);
[1243AC] mr0f=r0;
[1243AF] mr1f=r2;
[1243B1] r2=sat MRF(si);
[1243B3] dm(i3,0x2)=r2;

Outcomes