<div dir="ltr">Hello,<div><br></div><div>i am unable to vectorize the stream cluster distance code through llvm. the code is as follows:</div><div><div><br></div><div><br></div><div><br></div><div>typedef struct {</div><div>  float weight;</div><div>  float *coord;</div><div>  long assign;  /* number of point where this one is assigned */</div><div>  float cost;  /* cost of that assignment, weight*distance */</div><div>} Point;</div><div><br></div><div>int main()</div><div>{</div><div><br></div><div>clock_t begin, end; double time_spent;</div><div><br></div><div>  float coordr[100000], coordri[100000];</div><div><br></div><div>for (int j=0;j<100000;j++)</div><div>{coordr[j]=j+1;</div><div>coordri[j]=2*j+1;</div><div>}</div><div>Point p1, p2;</div><div>p1.weight=2.0;</div><div>p1.coord=coordr;</div><div>p1.assign=5.0;</div><div>p1.cost=10.0;</div><div><br></div><div>p2.weight=5.0;</div><div>p2.coord=coordri;</div><div>p2.assign=8.0;</div><div>p2.cost=20.0;</div><div><br></div><div><br></div><div>int dim=100000;</div><div>int i;</div><div>  float result=0.0;</div><div> begin = clock();</div><div>  for (i=0;i<dim;i++)</div><div>   result += (p1.coord[i] - p2.coord[i])*(p1.coord[i] - p2.coord[i]);</div><div><br></div><div><br></div><div>end = clock();</div><div>time_spent = (double)(end - begin) / CLOCKS_PER_SEC;</div><div><br></div><div>printf("time spent in daxpy is %f \n", time_spent);</div><div>  return 0;</div><div>}</div></div><div><br></div><div><br></div><div>Is this llvm bug? or what is my mistake?</div><div><br></div><div>please help.</div><div><br></div><div>Thank You</div></div>