This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Auto-vectorization: need to know what to expect
- From: "H.J. Lu" <hjl dot tools at gmail dot com>
- To: Benoît Jacob <jacob at math dot jussieu dot fr>
- Cc: gcc at gcc dot gnu dot org, g dot gael at free dot fr
- Date: Mon, 17 Mar 2008 08:06:38 -0700
- Subject: Re: Auto-vectorization: need to know what to expect
- References: <200803171545.55905.jacob@math.jussieu.fr>
On Mon, Mar 17, 2008 at 03:45:49PM +0100, Benoît Jacob wrote:
> Dear All,
>
> I am currently (co-)developing a Free (GPL/LGPL) C++ library for vector/matrix
> math.
>
> A major decision that we need to take is, what to do regarding vectorization
> instructions (SSE). Either we rely on GCC to auto-vectorize, or we control
> explicitly the vectorization using GCC's special primitives. The latter
> solution is of course more difficult, and would to some degree obfuscate our
> source code, so we wish to know whether or not it's really necessary.
>
> GCC 4.3.0 does auto-vectorize our loops, but the resulting code has worse
> performance than a version with unrolled loops and no vectorization. By
> contrast, ICC auto-vectorizes the same loops in a way that makes them
> significantly faster than the unrolled-loops non-vectorized version.
>
> If you want to know, the loops in question typically look like:
> for(int i = 0; i < COMPILE_TIME_CONSTANT; i++)
> {
> // some abstract c++ code with deep recursive templates and
> // deep recursive inline functions, but resulting in only a
> // few assembly instructions
> a().b().c().d(i) = x().y().z(i);
> }
Are they for 64bit or 32bit targets? Are a/b/c/d/x/y/z arrays on
stack? I suggest you open a bug report so that gcc vectorizer
people can take a look.
H.J.