Uncounted loop vectorization example doesn't work with unsigned index

Ionuț Nicula via Gcc <[email protected]>
Newsgroups gmane.comp.gcc.devel
Message-ID <RBlv2bEIAjMT7EObrykvjwAIayfw7zt694lcYZussS7znSTokffPSGSvvkr5BMTNeJDwORowmtXj12FGWUoHrFkt6fgv2O_aUQEsMOX3Cdk=@nicula.xyz>
Regarding the new uncounted loop vectorization capability in GCC 16: is
it a known current limitation that the 'simple' uncounted vectorization
example (i.e. gcc/testsuite/gcc.dg/vect/vect-uncounted_1.c) doesn't work
if you use an *unsigned* type for indexing?

This gets vectorized:

    int foo(int *haystack, int needle) {
        int i = 0;
        while (1) {
            if (haystack[i] == needle)
                return i;
            i++;
        }
    }

But this doesn't get vectorized:

    unsigned foo(int *haystack, int needle) {
        unsigned i = 0;
        while (1) {
            if (haystack[i] == needle)
                return i;
            i++;
        }
    }
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.