[cfe-dev] VectorType supported sizes

Sam McCall via cfe-dev cfe-dev at lists.llvm.org
Thu Apr 2 04:51:28 PDT 2020


Hi folks,

VectorType supports arbitrary vector sizes up to 2047, and nothing above
that.
GCC supports sizes up to 2**62, but only powers of 2.
Would it make sense to support e.g. arbitrary sizes up to 256, and powers
of two above that?
I'm not familiar with all the ways vector types are used, but want to
reduce pressure on the size of the bitfields.

Currently VectorType stores its size in "all the remaining bits" left by
Type.
This was 11 bits, so clang supported sizes <2048. We accidentally regressed
this to 10 bits <1024 in 6f428e09 when adding another bit to Type, and it
turns out people have code with vector_size(1024).
https://bugs.llvm.org/show_bug.cgi?id=45387

If it would be useful, my proposal is to store a "largesize" flag and an
8-bit size. If largesize is set then the real size is 1<<size. This would
save an additional bit and support big sizes.
If that _doesn't_ make sense, I'd probably just start treating size=0 as
1024, with the assumption that nobody was making use of sizes 1025-2043.

Cheers, Sam
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20200402/bc385d5b/attachment.html>


More information about the cfe-dev mailing list