[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Re: cortex / arm-hardfloat-linux-gnueabi (was Re: armelfp: new architecture name for an armel variant)



> > In libm.so, I took sinf() -a very often used function, absolutely
> > necessary for any trig stuff- and tried to actually find the differences
> > using
> >
> > objdump:
> >...
> >
> > Do the math, there are 6 more vmov instructions (all between rX and sX
> > registers) in the softfp versions. Ok, if one gives a stall of 20 cycles,
> > how many cycles do we lose in sinf() alone?
> 
> Depends how the function is called. Worst case we loose 17 cycles, best
> case we should be ~10 cycles faster.

A simple benchmark confirms this hypothesis.
softfp is actually faster in many cases.

Paul

#include <math.h>
#define N 100
float x[N], y[N];
void __attribute__((noinline)) foo(void)
{
  int i;

  for (i = 0; i < N; i++)
    {
      // uncomment one of these.
      //x[i] = sinf(y[i]); // hard 15% slower 
      //x[i] = sinf(y[i]) + 1.0; // hard 5% slower
      //x[i] = sinf(y[i] + 1.0); // hard 0.5% slower
      //x[i] = sinf(y[i] + 1.0) + 1.0; // softfp 2.5% slower
    }

}

int main()
{
  int i;
  for (i = 0; i < N; i++)
    y[i] = i / (float) N;
  for (i = 0; i < 100000; i++)
    foo();
  return 0;
}



Reply to: