[LLVMdev] Fwd: No SSE instructions

Serg Anohovsky serg.anohovsky at gmail.com
Sun May 22 11:10:17 PDT 2011


---------- Forwarded message ----------
From: Serg Anohovsky <serg.anohovsky at gmail.com>
Date: 2011/5/22
Subject: Re: [LLVMdev] No SSE instructions
To: Chris Lattner <clattner at apple.com>




2011/5/22 Chris Lattner <clattner at apple.com>

>
> On May 22, 2011, at 10:47 AM, Justin Holewinski wrote:
>
> On Sun, May 22, 2011 at 1:07 PM, Serg Anohovsky <serg.anohovsky at gmail.com>wrote:
>
>> Hello.
>> I have compiled the simple program:
>>
>> #include <stdio.h>
>> #include <stdlib.h>
>>
>> int v1[10000];
>>
>> int main()
>> {
>>         int i;
>>
>>         for (i = 0; i < 10000; i++) {
>>                 v1[i] = i;
>>         }
>>
>>
> This loop is not really vectorizable, even if LLVM had an auto-vectorizer.
>  You need the same operation (floating-point or integer) applied to
> contiguous elements in a vector.  An example of a vectorizable loop body
> would be "v1[i] = v1[i] * v1[i]"  Then, you could use SSE (or any other
> vector instruction set) to get a substantial speed improvement.
>
>
> This is vectorizable.  Just start out with a vector of constants <0, 1, 2,
> 3>  and do a store of it every time through the loop, adding <4,4,4,4> as
> you go.
>
> -Chris
>
>
>
>>         for (i = 0; i < 10000; i++) {
>>                 printf("%d ", v1[i]);
>>         }
>>
>>         return 0;
>> }
>>
>> Next, I disasseble the executable file and have not found any SSE
>> instructions.
>> I know that LLVM support SSE.
>> So my questions:
>>   1. It is occur only in my computer?
>>   2. If it is not only my bug, then there are not SSE optimizations in
>> LLVM?
>>   3. Have anyone, already worked on this problem?
>>
>> --
>> Serg Anohovsky.
>>
>> _______________________________________________
>> LLVM Developers mailing list
>> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>>
>>
>
>
> --
>
> Thanks,
>
> Justin Holewinski
>
> _______________________________________________
> LLVM Developers mailing list
> LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev
>
>
> Thanks, for your notes. In my opinion, there are no different. So another
example:
#include <stdio.h>
#include <stdlib.h>

int v0[10000];
int v1[10000];

int main()
{
        int i;

        for (i = 0; i < 10000; i++) {
                v0[i] = i;
        }

        for (i = 0; i < 10000; i++) {
                v1[i] = v0[i] * v0[i] * 4;
        }

        for (i = 0; i < 10000; i++) {
                printf("%d ", v1[i]);
        }

        return 0;
}

This is should be optimized, but LLVM have not optimized this program. The
questions
were not about this specific example. I wont to understand, what vector
optimizations LLVM have?
How well implemented this theme in LLVM?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20110522/1d5e2c70/attachment.html>


More information about the llvm-dev mailing list