[llvm-commits] [llvm] r90417 - in /llvm/trunk: lib/Target/ARM/ARMISelLowering.cpp test/CodeGen/ARM/2009-12-02-vtrn-undef.ll

Bob Wilson bob.wilson at apple.com
Thu Dec 3 09:35:57 PST 2009


On Dec 3, 2009, at 1:00 AM, Duncan Sands wrote:

> Hi Bob,
> 
>> Recognize canonical forms of vector shuffles where the same vector is used for
>> both source operands.  In the canonical form, the 2nd operand is changed to an
>> undef and the shuffle mask is adjusted to only reference elements from the 1st
>> operand.  Radar 7434842.
> 
> this sounds like a general optimization, i.e. not ARM specific.  How about doing
> this in the DAG combiner instead?

Maybe I don't understand your suggestion, but I don't see how that would work.  Besides the obvious problem that we may have code that is relying on these shuffles being in this canonical form, transforming them out of canonical form is very target-specific.  For example, if you have:

shuffle v, undef, <0, 0, 2, 2>

you could transform it to any of the following:

shuffle v, v, <0, 4, 2, 6>
shuffle v, v, <4, 0, 6, 2>
shuffle v, v, <4, 4, 2, 2>
etc.

To make this useful, you have to know what shuffle masks the target can support.  For some shuffles, e.g., NEON's vrev instructions, the target may only support operations with one source operand, so you wouldn't want to change those at all.



More information about the llvm-commits mailing list