[llvm-commits] patch: generalize vector shuffle
Mon Ping Wang
wangmp at apple.com
Fri Oct 31 02:30:11 PDT 2008
Hi,
This is a patch that implements changing the shuffle vector definition
to
<result> = shufflevector <n x <ty>> <v1>, <n x <ty>> <v2>, <m x
i32> <mask> ; yields <m x <ty>>
As discussed in llvmdev, the reason for this change is to help
maintain the incoming vector structure of the user code instead of
converting to insert and extract.
During the SelectionDAG, we normalize the shuffle vector such that the
vectors and mask are the same size and then we legalize the shuffle
vectors. The normalization process tries to retain the structure of
the vector shuffle by trying to convert it to a series of concat
vectors, extract subvector, and vector shuffles. If it can't, it falls
back to using insert/extracts. This implementation normalizes during
DAG construction while in a earlier implementation normalized during
the Legalize phase. The pros of doing this way is that after DAG
construction, none of the DAG passes would have to worry about non-
normalized shuffles, we might be able to optimize the normalized
shuffles, and in LegalizeTypes, we wouldn't have to do a pass to
normalize the vector shuffles. (We could probably do normalization
when we iterate the DAG to build the worklist in LegalizeTypes). The
downside is no DAG optimization can generate a non-normalized
shufflevector and there may be cases where after normalization, we may
obscure the what the original structure is. Here is the patch. I've
a few more test cases that I didn't include in the patch.
Thanks,
-- Mon Ping
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20081031/652254a2/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: genshuffle2.patch
Type: application/octet-stream
Size: 64747 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20081031/652254a2/attachment.obj>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20081031/652254a2/attachment-0001.html>
More information about the llvm-commits
mailing list