GCC can vectorize loops automatically when certain options are specified and given the right conditions. Are there other compilers widely available that can do the same?
9 Answers

- 40,708
- 1
- 95
- 119
-
1ICC's optimizations for Intel CPUs is extraordinary. – orip Jan 12 '09 at 08:09
llvm can also do it and vector pascal too and one that is not free VectorC. These are just some I remember.
-
VectorC hits the nail on the head. Vector Pascal is interesting, in that it reads like Pascal, but is influenced by APL; that is, it is a vector processing language in itself. However, the LLVM project does not seem to mention SIMD output anywhere? – casualcoder Jan 04 '09 at 18:06
-
OK, finally found the reference to SSE2 code generation for LLVM! Good stuff! Not sure why it is not more clearly mentioned on the site. – casualcoder Jan 04 '09 at 18:13
-
LLVM is still a "new kind on the block" project but seems very promising. – Paulo Lopes Jan 08 '09 at 09:34
-
1
The Mono project, the Open Source alternative to Microsoft's Silverlight project, has added objects that use SIMD instructions. While not a compiler, the Mono CLR is the first managed code system to generate vector operations natively.

- 4,770
- 6
- 29
- 35
Visual C++ (I'm using VS2005) can be forced to use SSE instructions. It seems not to be as good as Intel's compiler, but if someone already uses VC++, there's no reason not to turn this option on.
Go to project's properties, Configuration properties, C/C++, Code Generation: Enable Enhanced Instruction Set. Set "Streaming SIMD Instructios" or "Streaming SIMD Instructios 2". You will have to set floating point model to fast. Some other options will have to be changed too, but compiler will tell you about that.
Actually, in many cases GCC used to be quite worse than ICC for automatic code vectorization, I don't know if it recently improved enough, but I doubt it.

- 6,438
- 1
- 43
- 76
VectorC can do this too. You can also specify all target CPU so that it takes advantage of different instruction sets (e.g. MMX, SIMD, SIMD2,...)

- 33,034
- 36
- 130
- 210
Even though this is an old thread, I though I'd add to this list - Visual Studio 11 will also have auto vectorisation.

- 396
- 4
- 20