[PATCH] D81083: [Clang] Allow "vector_size" applied to Booleans

Richard Sandiford via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Jul 31 10:06:18 PDT 2020


rsandifo-arm added a subscriber: lenary.
rsandifo-arm added inline comments.


================
Comment at: clang/docs/LanguageExtensions.rst:473
+architectures.  The size parameter of a boolean vector type is the number of
+bits in the vector (for all non-bool vectors, the number refers to the number
+of bytes in the vector).
----------------
simoll wrote:
> lenary wrote:
> > It would be nice if this aside about non-bool vectors was more prominently displayed - it's something I hadn't realised before.
> Yep. that caught me by surprise too. I'll move that sentence to the paragraph about GCC vectors above.
Sorry for the extremely late comment.  Like @lenary I hadn't thought about this.  I'd assumed that the vector woiuld still be a multiple of 8 bits in size, but I agree that's probably too restrictive to be the only option available.

In that case, would it make sense to add a separate attribute instead?  I think it's too surprising to change the units of the existing attribute based on the element type.  Perhaps we should even make it take two parameters: the total number of elements, and the number of bits per element.  That might be more natural for some AVX and SVE combinations.  We wouldn't need to supporrt all combinations from the outset, it's just a question whether we should make the syntax general enough to support it in future.

Perhaps we could do both: support `vector_size` for `bool` using byte sizes (and not allowing subbyte vector lengths), and add a new, more general attribute that allows subbyte lengths and explicit subbyte element sizes.


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D81083/new/

https://reviews.llvm.org/D81083



More information about the cfe-commits mailing list