[LLVMdev] a possible alternative for pre-legalize extended ValueTypes
Chris Lattner
sabre at nondot.org
Fri Jun 22 15:31:58 PDT 2007
On Fri, 22 Jun 2007, Dan Gohman wrote:
> After doing a bunch of work for moving pre-legalize extended ValueTypes
> into a table in SelectionDAG, I may have just found a simpler approach.
ooh simple is good :)
> There are under 32 simple ValueType values, so we only really need 5 bits
> to represent those. ValueType is already a 32-bit type on most hosts; what
> if we make use of the remaining 27 bits instead of using an external
> table?
Hrm, interesting. If you do this, please reserve 6 bits for the simple
VTs, to permit future expansion without having to shuffle bits around.
> If we can assume that vector lengths will always be a fixed multiple of 2,
> we can encode vector lengths for extended vector types as the log2 of the
> length, biased by one. Using only 6 bits gets us vector lengths up to
> (2**64)-2, which Ought To Be Enough For Anyone. The bias allows an all-zero
> pattern to be available to be interpreted as a scalar type, while still
> permitting encodings of vectors with length 1, distinct from scalars.
As Christopher says, I think that non-power-of-two vectors are going to be
important in the future. That said, I wouldn't have a problem with
limiting vector width to be something capped, say at 4096 elements? If
people want really large vectors we could bump this up in the future.
> I don't have any code written yet; I wanted to run the idea by the list
> first :-).
Sounds very interesting!
-Chris
--
http://nondot.org/sabre/
http://llvm.org/
More information about the llvm-dev
mailing list