ways to get compile-time indices for neon intrinsic

Hi,

currently I'm trying to optimize some code using NEON technology, and I ran into a problem bother me a lot. 

int8x8_t vext_s8(int8x8_t a, int8x8_t b, const int n)  //arm_neon.h

the third param of above function, it should be determined at compile time, or the gcc would complain about it.

I want a way like this as loop times may be different for different callers:

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

c = vext_s8(a,b,i);

// do something with c...

}

But it won't work. Do I have to write like below for N=4 case?

vext_s8(a,b,0)

//do something

vext_s8(a,b,1)

//do samething

vext_s8(a,b,2)

//do samething

vext_s8(a,b,3)

//do samething

it's ugly, but I have no other ways, and, I don't know if this is the right place to seek help either, 

Any ideas are appreciated.

More questions in this forum