[LLVMdev] Vector code

Nicolas Capens nicolas at capens.net
Thu May 8 11:35:20 PDT 2008


Hi Chris,

I don't know how to properly create vectors and add them. I can create
arrays, take individual elements and add them, but BinaryOperator::createAdd
doesn't work on vectors for me. The documentation is very extensive for
scalar types and there are plenty of examples, but I haven't found a
straightforward way to translate scalar code to vector code yet. Please bear
with me, I've only just started exploring LLVM's capabilities and I'm still
searching though the documentation for more details about vector types.

Thanks,

-Nicolas


-----Original Message-----
From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On
Behalf Of Chris Lattner
Sent: Thursday, 08 May, 2008 20:13
To: LLVM Developers Mailing List
Subject: Re: [LLVMdev] Vector code

On Thu, 8 May 2008, Nicolas Capens wrote:
> Thanks for the advise, but I'm actually not trying to compile code from
> text. For now I'm just trying to construct the function directly. Think of
> it as the vector equivalent of the HowToUseJIT.cpp example.

There is a one to one mapping between text and IR.  If you understand what 
to generate it is much easier to generate it.  Otherwise, if you have a 
specific question, we can help answer that.

-Chris

> -----Original Message-----
> From: llvmdev-bounces at cs.uiuc.edu [mailto:llvmdev-bounces at cs.uiuc.edu] On
> Behalf Of Chris Lattner
> Sent: Thursday, 08 May, 2008 19:14
> To: LLVM Developers Mailing List
> Subject: Re: [LLVMdev] Vector code
>
> On Thu, 8 May 2008, Nicolas Capens wrote:
>> I'm trying to use LLVM to generate SIMD code at runtime (in particular
> Intel
>> SSE). But I'm having a bit of trouble understanding how to create even
the
>> simplest function; adding two vectors of four single-precision
>> floating-point elements. I can get it to add the elements one at a time
> but
>> not using one vector instruction.
>
> I'd suggest writing code in C and seeing what llvm-gcc does with it.
> You can also look at (for example) llvm/test/CodeGen/X86/*.ll for many
> examples.
>
> -Chris
>
>

-Chris

-- 
http://nondot.org/sabre/
http://llvm.org/
_______________________________________________
LLVM Developers mailing list
LLVMdev at cs.uiuc.edu         http://llvm.cs.uiuc.edu
http://lists.cs.uiuc.edu/mailman/listinfo/llvmdev




More information about the llvm-dev mailing list