[LAD] GCC Vector extensions

Robin Gareus robin at gareus.org
Wed Jul 20 15:47:07 UTC 2011


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

On 07/20/2011 10:27 AM, Maurizio De Cecco wrote:
> I am playing around with GCC and Clang vector extensions, on Linux and
> Mac OS X, and i am getting some strange behaviour.
> 
> I am working on jMax Phoenix, and its dsp engine, in its current state,
> is very memory bound; it is based on the aggregation of very small
> granularity operations, like vector sum or multiply, each of them
> executed independently from and to memory.
> 
> I tried to implements all this 'primitive' operations using the vector
> types.
> 
> On clang/MacOSX i get an impressive improvement in performance,
> around 4x on the operations, even just using the vector types for
> copying data; my impression is that the compiler use some kind of vector
> load/store instruction that properly use the available memory bandwidth,
> but unfortunately i do not know more about the x86 architecture.
> 
> On gcc/Linux, (gcc 4.5.2) the same code produce a *slow down* of around
> 2.5x.
> 
> Well, anybody have an idea of why ?
> 
> I am actually running linux (Ubuntu 11.04) under a VMWare virtual
> machine, i do not know is this may have any implications.

Maybe. A better comparison would be: clang/Linux vs. gcc/Linux and
clang/MacOSX vs gcc/MacOSX compiled binaries.

Also as Dan already pointed out: gcc has a whole lot of optimization
flags which are not enabled by default. try '-O3 -msse2 -ffast-math'.
 '-ftree-vectorizer-verbose=2' is handy while optimizing code.

have fun,
robin
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.11 (GNU/Linux)

iEYEARECAAYFAk4m+HsACgkQeVUk8U+VK0LgtQCfcL9Jvrtf4kN9iPDMrpKQ/1M7
spwAni358xLLAb4n6LeOEMhiqS/kWnYb
=DmSC
-----END PGP SIGNATURE-----



More information about the Linux-audio-dev mailing list