Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Can this loop be vectorized?

0 views
Skip to first unread message

Wolfgang Thomsen

unread,
Nov 28, 2008, 1:01:35 PM11/28/08
to
Hello,

is there a way to convince the Intel compiler to (auto-)vectorize the
following?

double a[N], b[N];
int c[2N];

for(int i=0; i<N; i++) {
a[i] = b[c[i*2]];
}

It does not vectorize presumably because c[] is a different data type than
a[] and b[].


Any help greatly appreciated!
Wolf

دريد عبد الله

unread,
Nov 28, 2008, 1:21:06 PM11/28/08
to
Or why don't you type:

Jeff Schwab

unread,
Nov 28, 2008, 1:26:06 PM11/28/08
to

Are my eyes failing in my old age, or is that identical to the OP's code
except for the addition of two blank lines? What is that supposed to
accomplish?

دريد عبد الله

unread,
Nov 28, 2008, 1:27:36 PM11/28/08
to
Sory For Mistake
Tyy To Type:

double a[N], b[N];
int c[2N];

for(int i=0; i<N; i++) {

tmp = c[i*2]; // All now are integers
a[i] = b[tmp];

}
Please try this..
But for knowing
I tryed your code on turbo c++ 4.5 . It was running..

red floyd

unread,
Nov 28, 2008, 2:22:56 PM11/28/08
to

That wasn't what OP was asking. To the OP, you're better off asking in
a group dedicated to your compiler -- ISO/IEC 14882:2003 doesn't discuss
vectorization at all.

0 new messages