[LLVMdev] Extending vector operations
David Greene
dag at cray.com
Wed Jul 23 09:20:11 PDT 2008
On Monday 21 July 2008 18:33, Eli Friedman wrote:
> > 2) Vector strunc, sext, zext, fptrunc and fpext
> >
> > Again, I think these are hopefully straightforward. Please let me know
> > if you expect any issues with vector operations that change element
> > sizes from the RHS to the LHS, e.g. around legalization.
>
> These are tricky to generate efficient code for because they change
> the size of the vector and most likely introduce illegal vectors.
> It'll be a lot of work to get these working well for non-trivial
> cases.
It depends on the architecture. For something like SSE, I can see that
this would be a real pain (the vector length changes). For a traditional Cray
vector machine (as an example), it's trivial.
> > 5) Vector comparisons that return <N x i1>
> It makes sense; the difficulty is making CodeGen generate efficient
> code for these constructs. Legalization has to transform illegal
> types into legal types, and as far as I know, none of the current
> transformations varies the type transformation based on what is using
> the value. I don't know exactly how hard it would be, though... maybe
> someone who's more familiar with the legalization infrastructure could
> say more?
Can you elaborate with a specific example? I'm having a hard time imagining
what transformations need to do. When I think of a vector mask, the length
of the mask is the same as the vector length of the operands. So a compare
of two vectors with four elements results in a four bit mask. If the input
types change to a different vector length, then the mask type changes as well.
-Dave
More information about the llvm-dev
mailing list