3 ms·
Here's the code in godbolt: gcc: https://godbolt.org/z/6xG5dKjj9 https://godbolt.org/z/6xG5dKjj9 clang: https://godbolt.org/z/Mh9zozjvK https://godbolt.org/z/
by ninkendo 5y ago
Here's the code in godbolt:
gcc: https://godbolt.org/z/6xG5dKjj9 https://godbolt.org/z/6xG5dKjj9
clang: https://godbolt.org/z/Mh9zozjvK https://godbolt.org/z/Mh9zozjvK
I'm no asm expert, but it doesn't look like a lot of vector instructions in the gcc compilation of this, while the clang compilation seems to have more calls with the 128-bit xmm registers (at least on x86_64.) You can also just see visibly how many more instructions the gcc version outputs.
- mananaysiempre 5y agoThank you! Indeed GCC does not use SIMD here unless you set -O3 (... I seem to remember this enables some vectorization?) or allow it to use AVX with -mavx or -march=x86-64-v3. For some reason I’m unable to get it to use plain SSE (always available on x86-64) with any -mtune setting or even with -march=x86-64-v2.
- The_rationalist 5y agohttps://www.phoronix.com/scan.php?page=news_item&px=GCC-12-Auto-Vec-O2 https://www.phoronix.com/scan.php?page=news_item&px=GCC-12-A...