[cfe-dev] [llvm-dev] vectorization for X86
Mehdi Amini via cfe-dev
cfe-dev at lists.llvm.org
Wed Mar 16 14:34:45 PDT 2016
You need to enable an optimization level, this vectorizes for me:
clang -S x.c --target=x86_64-pc-gnu -mtune=core-avx2 -O3 -S -o -
--
Mehdi
> On Mar 16, 2016, at 2:29 PM, Rail Shafigulin via llvm-dev <llvm-dev at lists.llvm.org> wrote:
>
> I'm trying to vectorize a simple C code. My problem is that I don't quite understand the relationship between clang --target option and the cores mentioned in X86.td as well as other X86 related options (such as -mtune). Below are the command and the code that I'm trying to vectorize. The code compiles but I don't see any vectors. What am I doing wrong? Any help is appreciated.
>
> clang -S x.c --target=x86_64-pc-gnu -mtune=core-avx2 -o x.x86.s -fvectorize -fno-lax-vector-conversions -fslp-vectorize-aggressive -fslp-vectorize
>
> #define N 32
>
> int main () {
>
> int a[N], b[N];
> int c[N];
>
> for (int i = 0; i < N; ++i)
> c[i] = a[i] + b[i];
>
> int sum=0;
> for (int i = 0; i < N; ++i)
> sum += c[i];
>
> return sum;
> }
>
>
>
> --
> Rail Shafigulin
> Software Engineer
> Esencia Technologies
> _______________________________________________
> LLVM Developers mailing list
> llvm-dev at lists.llvm.org
> http://lists.llvm.org/cgi-bin/mailman/listinfo/llvm-dev
More information about the cfe-dev
mailing list