This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Auto-vectorization: need to know what to expect


On Mon, Mar 17, 2008 at 06:33:23PM +0100, Benoît Jacob wrote:
> I have looked more closely at the messages generated by the gcc 4.3 vectorizer 
> and it seems that they fall into two categories:
> 
> 1) complaining about aligmnent.
> 
> For example:
> 
> Unknown alignment for access: D.33485
> Unknown alignment for access: m
> 
> I don't understand, as all my data is statically allocated doubles (no dynamic 
> memory allocation) and I am using -malign-double. What more can I do?

However, SSE instructions need 128-bit alignment, not 64-bit alignment that
-malign-double would give.  You can align the arrays yourself with the
__attribute__((__aligned__(16))) declaration, or use a union that has an
element with 16-byte alignment (vector element, such as __m128, __m128d,
__m128i or long double and -m128bit-long-double).  Note, if the arrays are auto
rather than static, you probably need to use the -mstackrealign and
-mpreferred-stack-boundary=16 as well.

It might be nice to think about an option that automatically aligns large
arrays without having to do the declaration (or even have the vectorizer
override the alignment for statics/auto).

-- 
Michael Meissner, AMD
90 Central Street, MS 83-29, Boxborough, MA, 01719, USA
michael.meissner@amd.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]