[llvm-commits] Patch: generalize vector shuffle

Mon Ping Wang monping at apple.com
Tue Nov 4 15:54:35 PST 2008


Hi,

I added a new class to share utilities that can be used by both  
LegalizeTypes and  LegalizeDAGs.
I moved the common functions in there.  Once LegalizeType is required,  
I can move those functions into LegalizeTypes as they will no longer  
be necessary.  For splitting the vector shuffle, I didn't find a nice  
way to split that function into pieces.  It could be split cleanly if  
I remove the optimization that tries to reuse subvectors (it tries to  
extract only the subvectors that it needs to split the vector  
shuffle).  I have added more comments that tries to describe what is  
going on in that routine.  Please let me know if anyone has any  
comments.

Thanks,
   -- Mon Ping

-------------- next part --------------
A non-text attachment was scrubbed...
Name: genshuffle4.patch
Type: application/octet-stream
Size: 61801 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20081104/cf28b5a1/attachment.obj>
-------------- next part --------------





On Nov 3, 2008, at 10:17 AM, Mon Ping Wang wrote:

> Hi Evan,
>
> There are a few functions that duplicated between LegalizeTypes and
> LegalizeDAG.  I wasn't sure if the right thing to do here.  If
> LegalizeType will remain optional for sometime, I would have the two
> use the same function and have them shared (I don't think there is
> such a case today).   If LegalizeType was be required soon, I thought
> it would be easier to duplicate the two and delete it from LegalizeDAG
> as it wouldn't be necessary anymore.  However, it seems that I made a
> mistake of doing the 2nd way as this would cause some maintenance
> headaches until LegalizeType is required as well as making the patch
> more painful to digest.  I'll look for a place to house these
> utilities functions so they can be shared.  I'll clean up the early
> exit stuff and try to factor out more of SplitVecRes_VECTOR_SHUFFLE
> stuff.
>
> Thanks,
> -- Mon Ping
>
>
>
> On Nov 2, 2008, at 11:47 PM, Evan Cheng wrote:
>
>> Hi Mon Ping,
>>
>> Thanks for doing this. It's an important improvement.
>>
>> However, this patch is hard (at least for me) to digest. It's just a
>> lot of code. :-) Some of the functions have become so big that it's
>> hard to follow. For example, SplitVecRes_VECTOR_SHUFFLE. Is it
>> possible to factor some stuff out?
>>
>> Also, some of code seems to be replicated in several functions  
>> (please
>> correct me if that's not the case). For example, the code that
>> determines how an element is used.
>>
>> A stylistic nitpick:
>>
>> +    if (VT1NumElems*2 == NumElems && SequentialMask(Mask, 0)) {
>> +      setValue(&I, DAG.getNode(ISD::CONCAT_VECTORS, VT, V1, V2));
>> +      return;
>> +    }
>> +    else {
>>
>> The else { } isn't needed because of the early exit. Same issue here:
>>
>> +    if (VT1NumElems == NumElems && SequentialMask(Mask,0)) {
>> +      setValue(&I, V1);
>> +      return;
>> +    } else if (VT1NumElems == NumElems &&
>> SequentialMask(Mask,NumElems)) {
>> +      setValue(&I, V2);
>> +      return;
>> +    } else {
>> +      // Analyze the access pattern of the vector to see if we can
>> extract
>> +      // two subvectors and do the shuffle.
>>
>> Don't forget to end comment sentences with periods. :-)
>>
>> Evan
>>
>> On Oct 31, 2008, at 7:56 PM, Mon Ping Wang wrote:
>>
>>> <genshuffle3.patch>
>>
>> _______________________________________________
>> llvm-commits mailing list
>> llvm-commits at cs.uiuc.edu
>> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits
>
> _______________________________________________
> llvm-commits mailing list
> llvm-commits at cs.uiuc.edu
> http://lists.cs.uiuc.edu/mailman/listinfo/llvm-commits



More information about the llvm-commits mailing list