[llvm-dev] Issues with omp simd

hameeza ahmed via llvm-dev llvm-dev at lists.llvm.org
Tue Dec 26 01:01:52 PST 2017


hello,

i am trying to optimize omp simd loop as follows

int main(int argc, char **argv)
{
    const int size = 1000000;


    float a[size], b[size],c[size];



        #pragma omp simd
        for (int i=0; i<size; ++i)
        {
            c[i]= a[i] + b[i];
        }


    return 0;
}

i run it using the following command;

g++ -O0 --std=c++14 -fopenmp-simd lab.cpp  -Iinclude -S -o lab.s

when i compared it with code as follows without simd


int main(int argc, char **argv)
{
    const int size = 1000000;


    float a[size], b[size],c[size];



        for (int i=0; i<size; ++i)
        {
            c[i]= a[i] + b[i];
        }


    return 0;
}

using following command

g++ -O0 --std=c++14  lab.cpp -Iinclude -S -o lab.s

I am getting the same assembly. Why is that so? why not omp simd is more
efficient?

Please help
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20171226/6c2c0194/attachment.html>


More information about the llvm-dev mailing list