<div dir="ltr">Hello,<div><br></div><div>I am trying to vectorize following stencil code;</div><div><br></div><div><div>#include <stdio.h></div><div>#define N 100351</div><div> </div><div>// This function computes 2D-5 point Jacobi stencil </div><div>void stencil(int a[restrict][N])</div><div>{</div><div>   int i, j, k;</div><div>   for (k = 0; k < 100; k++)</div><div>     {  for (i = 1; i <= N-2; i++)</div><div>         {  for (j = 1; j <= N-2; j++)</div><div>        <span style="white-space:pre">  </span>{ a[i][j] = 0.25 * (a[i][j] + a[i-1][j] + a[i+1][j] + a[i][j-1] + a[i][j+1]);</div><div>              }</div><div>}</div><div>}}</div></div><div><br></div><div>I have used the following commands</div><div><br></div><div>clang  -S -emit-llvm stencil.c -march=knl -O3 -mllvm -disable-llvm-optzns -o stencil.ll<br></div><div><br></div><div>opt  -S -O3 stencil.ll -o stencil_o3.ll<br></div><div><br></div><div>llc -x86-asm-syntax=intel stencil_o3.ll -o stencil.s<br></div><div><br></div><div>But the code is not vectorized. It still uses the scalar instructions;</div><div><br></div><div>Please correct me.</div><div><br></div><div>Thank You</div><div><br></div><div><br></div><div><br></div><div><br></div></div>