3 ms·
My experience has been that icc (the C compiler) does a very good job of auto-vectorization. xlc does as well, provided you avoid the horribly misdesigned POWE
by vonmoltke 11y ago
My experience has been that icc (the C compiler) does a very good job of auto-vectorization. xlc does as well, provided you avoid the horribly misdesigned POWER6 architecture.
I agree that gcc sucks for this; we didn't have LLVM last time I was doing this kind of work, so I can't comment on that.
- valarauca1 11y agoLLVM is about on par with the GCC. You just keep moving variables around it decides the moons of Jupiter are properly positioned to vectorize your code. System intrinsics are always your best bet, just really annoying.
- vonmoltke 11y agoWe ended up doing some hand-rolled vectorization that way on the POWER7, because SIMD only really worked well if the data was aligned with the SIMD register width. Intel fixed that problem with a relatively low-cost unaligned load instruction.
- CyberDildonics 11y agoIf you want to really use SIMD units (on x86) check out ISPC. I recommend writing small functions in it that work over large chunks of memory so that SIMD can run at full speed with good cache locality. This ends up being -very- fast.
- valarauca1 11y agoLink for the lazy: https://github.com/ispc/ispc/ https://github.com/ispc/ispc/