[llvm-dev] Unable to vectorize stream_cluster distance code
hameeza ahmed via llvm-dev
llvm-dev at lists.llvm.org
Thu Oct 19 12:01:50 PDT 2017
Hello,
i am unable to vectorize the stream cluster distance code through llvm. the
code is as follows:
typedef struct {
float weight;
float *coord;
long assign; /* number of point where this one is assigned */
float cost; /* cost of that assignment, weight*distance */
} Point;
int main()
{
clock_t begin, end; double time_spent;
float coordr[100000], coordri[100000];
for (int j=0;j<100000;j++)
{coordr[j]=j+1;
coordri[j]=2*j+1;
}
Point p1, p2;
p1.weight=2.0;
p1.coord=coordr;
p1.assign=5.0;
p1.cost=10.0;
p2.weight=5.0;
p2.coord=coordri;
p2.assign=8.0;
p2.cost=20.0;
int dim=100000;
int i;
float result=0.0;
begin = clock();
for (i=0;i<dim;i++)
result += (p1.coord[i] - p2.coord[i])*(p1.coord[i] - p2.coord[i]);
end = clock();
time_spent = (double)(end - begin) / CLOCKS_PER_SEC;
printf("time spent in daxpy is %f \n", time_spent);
return 0;
}
Is this llvm bug? or what is my mistake?
please help.
Thank You
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171020/1625174b/attachment.html>
More information about the llvm-dev
mailing list