[LLVMdev] Vector troubles

Chris Lattner sabre at nondot.org
Fri Sep 28 15:03:19 PDT 2007


On Sep 28, 2007, at 2:31 PM, Chuck Rose III wrote:
> Hola LLVMers,
Hey Chuck,

I'm not certain (Evan and Anton should chime in :), but here is some  
info:
>  I’m working on engaging SSE via the LLVM vector ops on x86.  I had  
> some questions a while back that you all helped out on, but I’m  
> seeing similar issues and was hoping you’d have some ideas.  Below  
> is the dump of the LLVM IR of a program which is designed to take a  
> vector stored in a float*, build an LLVM vector from it, copy it to  
> another vector, and then take it apart and store it back out in  
> another float*.  This will live on the boundary of our system and  
> would be a function designed to promote a raw, potentially  
> unaligned, value into a vector that the LLVM system can work with a  
> whole bunch.
Two issues with alignment come to mind.  First, LLVM has some issues  
apparently still on systems that don't have a 16-byte aligned stack:   
http://llvm.org/bugs/show_bug.cgi?id=1649

The other issue can be that you're emitting an LLVM load to a pointer  
that is not on the stack and that doesn't have the right alignment.   
In this case, a movaps will be generated and you'll get a fault.  In  
this case, you can mark the load as having an alignment of one byte,  
and the codegen will produce movups instead.  Using this is generally  
more efficient than doing 4 scalar loads and insertelements.
> It is dying trying to store a our working vector into one of the  
> LLVM vectors created on the stack.  Despite the align-16 directive  
> on the alloca instruction, it is not always aligning to a 16-byte  
> boundary.
This sounds like the bugzilla entry.

-Chris


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-dev/attachments/20070928/841b32e5/attachment.html>


More information about the llvm-dev mailing list