gcc-ow...@gcc.gnu.org wrote on 11/12/2009 20:25:33:
> Allan Sandfeld Jensen <li...@carewolf.com> > Hi > > I hope someone can help me. I've been trying to write some tight > integer loops > in way that could be auto-vectorized, saving me to write assembler or using > specific vectorization extensions. Unfortunately I've not yet managed to make > gcc vectorize any of them. > > I've simplified the case to just perform the very first operation inthe loop; > converting from two's complement to sign-and-magnitude. > > I've then used -ftree-vectorizer-verbose to examine if and if not, > why not the > loops were not vectorized, but I am afraid I don't understand the output. > > The simplest version of the loop is here (it appears the branch is not a > problem, but I have another version without). > > inline uint16_t transsign(int16_t v) { > if (v<0) { > return 0x8000U | (1-v); > } else { > return v; > } > } > > It very simply converts in a fashion that maintains the full effective bit- > width. > > The error from the vectorizer is: > vectorizesign.cpp:42: note: not vectorized: relevant stmt not supported: > v.1_16 = (uint16_t) D.2157_11; > > It appears the unsupported operation in vectorization is the typecast from > int16_t to uint16_t, can this really be the case, or is the output misleading? Yes, the problem is in signed->unsigned cast. I think it is related to PR 26128. Ira > > If it is the case, then is there good reason for it, or can I fix itmyself by > adding additional vectorizable operations? > > I've attached both test case and full output of ftree-vectorized-verbose=9 > > Best regards > `Allan > > [attachment "vectorizesign.cpp" deleted by Ira Rosen/Haifa/IBM] > [attachment "vectorizesign-debug.txt" deleted by Ira Rosen/Haifa/IBM]