Fwd: vectorization with negative offsets
Nagaraju Mekala
gnuuser.raj@gmail.com
Fri Aug 30 18:43:00 GMT 2013
I was working with X86 gcc-4.7.2 version. I found that gcc was not
able to vectorize small simple loops with negative offsets...
assume ntimes & LEN to be some constant. In my case they are 200000
int abc()
{
for (int nl = 0; nl < ntimes*3; nl++) {
for (int i = LEN - 1; i >= 0; i--) {
a[i] = b[i] + (float) 1.;
}
}}
if we modify the above code as below Gcc has vectorized them.
int abc()
{
for (int nl = 0; nl < ntimes*3; nl++) {
for (int i = 0; i <= LEN - 1; i++) {
a[i] = b[i] + (float) 1.;
}
}}
Can anyone explain why GCC is not able to vectorize is..
Thanks,
Nagaraju
More information about the Gcc-help
mailing list