I want to vectorize a c
program.
I searched on the internet, YouTube but found very little (which was not helpful for beginner like me and most of them were about c++
). Whatever little I understood, is that I have to use compiler intrinsics (which can be found in Intel Intrinsics Guide). I have an old machine which supports SSE 4.1, SSE 4.2 instruction.
But I can not move forward with the little knowledge I have, so my question is, how can I vectorize a c
program?
As a demonstration, can you show how to optimize the following code:
float function(float* Array, int Initial, int Finishing_point)
{
int k = 0;
float VL = 0;
for (int i = Initial; i < Finishing_point; i++)
{
k++;
Vl = Vl + Array[i] * pow(2, k);
}
return Vl;
}
Please note that, I need an introductory example, thus I am using an example that includes summation, array operation and other simple programming.