Fwd: vectorization with negative offsets

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



  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




[Index of Archives]     [Linux C Programming]     [Linux Kernel]     [eCos]     [Fedora Development]     [Fedora Announce]     [Autoconf]     [The DWARVES Debugging Tools]     [Yosemite Campsites]     [Yosemite News]     [Linux GCC]

  Powered by Linux