This is the mail archive of the
gcc-help@gcc.gnu.org
mailing list for the GCC project.
Re: using vector extension in gcc slows down my code
- From: Da Zheng <zhengda1936 at gmail dot com>
- To: Brian Budge <brian dot budge at gmail dot com>
- Cc: gcc-help at gcc dot gnu dot org
- Date: Wed, 10 Feb 2010 23:58:13 +0800
- Subject: Re: using vector extension in gcc slows down my code
- References: <4B722DED.4090404@gmail.com> <5b7094581002100657t4e2c4b03o1b1165de76b1a5da@mail.gmail.com>
Hi,
On 10-2-10 äå10:57, Brian Budge wrote:
> Hi -
>
> To me it is not at all surprising. These hairy strides and mods
> certainly aren't going to help. You're doing very little math vs
> load/store which means that you're not going to get much out of the
This is what my code needs to do. I cannot change it. I see GCC can
auto-vectorize the code like:
for (i=0; i<256; i++){
a[i] = b[i] + c[i];
}
It has even less math, but vectorization should achieve better performance in
the code since GCC does it.
> vector units. Really you need more of a struct-of-arrays type layout
> (pack your doubles together so you can load them in a less strided
> fashion, and pack your ints together. This may have the extra benefit
> of unobfuscating the code :)
I don't understand. What do you mean by less strided fashion? Do you mean all
elements in the array should be of the v2df type and then I access each element
in the loop by i++? Why will this make difference?
Best regards,
Zheng Da