LLVM Bugzilla is read-only and represents the historical archive of all LLVM issues filled before November 26, 2021. Use github to submit LLVM bugs

Bug 2957 - Change vector_shuffle into a variadic SDNode
Summary: Change vector_shuffle into a variadic SDNode
Status: RESOLVED FIXED
Alias: None
Product: new-bugs
Classification: Unclassified
Component: new bugs (show other bugs)
Version: unspecified
Hardware: Other Linux
: P enhancement
Assignee: Unassigned LLVM Bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2008-10-27 10:06 PDT by Duncan Sands
Modified: 2009-04-24 00:54 PDT (History)
4 users (show)

See Also:
Fixed By Commit(s):


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Duncan Sands 2008-10-27 10:06:37 PDT
Currently codegen represents a vector_shuffle
as a node with three operands.  The third operand
is a mask, which *must* be a BUILD_VECTOR node of
constant integers (a different kind of node that
produces a result of the right vector type isn't
good enough).  This causes problems during type
legalization because it is not always possible to
create a legal BUILD_VECTOR usable as the vector
shuffle mask.  (LegalizeDAG ignores the legality
or not of the mask argument, but LegalizeTypes
insists on legalizing the types of all nodes,
which I think is the right thing to do).

I think the best plan is to incorporate the mask
directly into the vector shuffle node, by turning
into a node with 2+N operands: the first two the
same as now, followed by the N mask elements.

This seems fairly straightforward to do, but involves
a lot of tedious work.  I don't have time for it right
now so I've opened this PR in the hope that someone
else will take it on :)
Comment 1 Chris Lattner 2008-10-27 13:10:41 PDT
Would it be better to introduce a ShuffleSDNode that kept the shuffle mask as an array of integers?
Comment 2 Chris Lattner 2008-10-27 13:11:07 PDT
In any case, either solution would be dramatically better than the current shuffle with buildvector as mask!
Comment 3 Duncan Sands 2008-10-28 05:51:10 PDT
Lots of places want to examine masks to see if they have special
properties etc.  One advantage of a special node type containing
the mask as a vector is that just the mask can be passed to such
routines rather than the whole node (with the variadic node scheme
you would have to pass the entire shuffle vector node, which is
kind of sucky).
Comment 5 Chris Lattner 2009-04-24 00:54:24 PDT
woohoo