views:

1039

answers:

8

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?

+4  A: 

ICC

Doug Currie
ICC's optimizations for Intel CPUs is extraordinary.
orip
+5  A: 

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?
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.
LLVM is still a "new kind on the block" project but seems very promising.
Paulo Lopes
LLVM doesn't have autovectorization, just manual SIMD support.
alex strange
+1  A: 

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.

Blaisorblade
+2  A: 

Also PGI's compilers.

woggle
+2  A: 

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.

+1  A: 

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,...)

Adrian Grigore
+1  A: 

IBM's xlc can auto-vectorize C and C++ to some extent as well.

Novelocrat
+2  A: 

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.

saigon_from_europe
Enabling SSE is not the same as vectorization.
LiraNuna