Quantcast
Channel: Intel® Software - Intel® C++ Compiler
Viewing all articles
Browse latest Browse all 1175

ICC 17 and Auto Vectorization

$
0
0

Hello,

 

I have just recently begun experimenting with ICC 17 and its auto-vectorization features.   I was wondering if anyone could explain why the following code ('blah') can be auto-vectorized by ICC while ('blahblah') cannot ?  The difference being that variables a,b,c are declared on the stack in 'blahblah'.

const int numElems = 256;


void blah(double a[], double b[], double c[])
{
   int i = 0;

   // This vectorizes
   for (i = 0; i < numElems; i++)
   {
     a[i] = b[i] * c[i];
   }
}

void blahblah()
{
   double a[numElems];
   double b[numElems];
   double c[numElems];

   int i = 0;

   // This does not vectorize
   for (i = 0; i < numElems; i++)
   {
     a[i] = b[i] * c[i];
   }
}

Thanks in advance for any help.

 

 

Thread Topic: 

Question

Viewing all articles
Browse latest Browse all 1175

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>