6 ms·
I wonder why GCC does not autovectorize the loop in bytesum.c even with -Ofast. With autovectorizer, GCC should make the plain loop as fast as SIMD intrinsics.
by sanxiyn 13y ago
I wonder why GCC does not autovectorize the loop in bytesum.c even with -Ofast. With autovectorizer, GCC should make the plain loop as fast as SIMD intrinsics. Autovectorizer can't handle complex cases, but this is as simple as it can get.
Anyone has ideas?
- rsp1984 13y agoMaybe I'm just oldschool but I found that auto-vectorization hardly ever does what one thinks it should do. I view it as a nice tool in my belt but I don't ever expect it to magically speed things up for me by large factors. If I want real SIMD I get down to intrinsics or assembler myself.
- jokoon 13y agoI don't think compilers are able to know when to use SIMD Isn't vectorization different than SIMD ?
- dbaupp 13y agoNo, vectorization is converting scalar operations (i.e. one piece of data at a time, e.g. summing one byte at a time) to vector ones (operating on multiple pieces of data at once, e.g. summing 16 bytes in parallel), and these operations are exactly what SIMD is.
- sanxiyn 13y agoCompilers certainly can, although they aren't exactly good.
- dbaupp 13y agopbsd investigated above[1] and found that the problem was the use of signed chars. [1]: https://news.ycombinator.com/item?id=7737582 https://news.ycombinator.com/item?id=7737582
- sanxiyn 13y agoArgh, this is annoying indeed. And yes, compiler is correct not to autovectorize in this case then.
- TheLoneWolfling 13y agoWhy?