[llvm-dev] Jacobi 5 Point Stencil Code not Vectorizing
hameeza ahmed via llvm-dev
llvm-dev at lists.llvm.org
Sat Jul 1 04:08:52 PDT 2017
Hello,
I am trying to vectorize following stencil code;
#include <stdio.h>
#define N 100351
// This function computes 2D-5 point Jacobi stencil
void stencil(int a[restrict][N])
{
int i, j, k;
for (k = 0; k < 100; k++)
{ for (i = 1; i <= N-2; i++)
{ for (j = 1; j <= N-2; j++)
{ a[i][j] = 0.25 * (a[i][j] + a[i-1][j] + a[i+1][j] + a[i][j-1] +
a[i][j+1]);
}
}
}}
I have used the following commands
clang -S -emit-llvm stencil.c -march=knl -O3 -mllvm -disable-llvm-optzns
-o stencil.ll
opt -S -O3 stencil.ll -o stencil_o3.ll
llc -x86-asm-syntax=intel stencil_o3.ll -o stencil.s
But the code is not vectorized. It still uses the scalar instructions;
Please correct me.
Thank You
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20170701/79dd3c84/attachment.html>
More information about the llvm-dev
mailing list