AnsweredAssumed Answered

mac instrinsic

Question asked by BlackFinner on Sep 12, 2011
Latest reply on Sep 16, 2011 by BlackFinner

Hi,

In blackfin documentatation, i did not find any instrinsic for multiply and accumulate operation. There are saperate  instrinsics for multiply and add but none of them provides 40 bits acumulation.

 

I am trying to accumulate with a higher precision.

/*original code*/

int64 acc = 0;
   for (i = 0; i < N; i++)

  {
    acc+ = ((in[i] * *coeff++) << 1);
   }
      /* Saturate */
      if (acc> (int64)MAX_INT_32)
      {
        *out++ = (int16_t)0x7FFF;
      }
      else if (acc< (int64)MIN_INT_32)
      {
             *out++ = (int16_t)0x8000;
      }
      else
      {
        *out++ = (int16_t)(acc>> 16);
      }

 

using

/*code with intrinsics*/

fract32 acc =0;

for (i = 0; i < N; i++)

{

acc = add_fr1x32(acc,mult_fr1x32x32(x[i],a[i]));

}

 

*out++ = sat_fr1x32(acc);

 

declaring acc as a fract32 wont help.

are there instrinsics available for 64 bit operations?

is there any alternative?

Outcomes