On Wed, May 26, 2010 at 4:27 PM, roy rosen <roy.1ro...@gmail.com> wrote: > Hi, > > I have tried vectorization and encountered a problem which I can see > is common to some ports (I tried ia64 and bfin). > > For this function: > > #define ts unsigned short > void f(ts* __restrict__ a, ts* __restrict__ b, ts* __restrict__ x) > { > int i; > for (i=0;i<1024;i++) > x[i] = a[i] + b[i]; > } > > the loop is vectorized. > But if I define ts as follows: #define ts short > then the loop is not vectorized. The message I get is: > > ./a.c:21: note: no optab. > ./a.c:21: note: not vectorized: relevant stmt not supported: D.1279_12 > = (short unsigned int) D.1278_11; > > I have tried to look a bit in the vectorizer code and it seems that > for this stmt I get to vectorizable_operation with code==NOP_EXPR > which is not handled. > > Does anyone knows anything about this problem?
The addition is done in type int (according to promotion rules), but we fold it to an unsigned short addition. You probably lack a vector unsigned short -> vector short conversion operation (which the middle-end should handle transparently). Please file a bugreport. Richard. > > Thanks, Roy. >