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

Richard Sandiford via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 21 01:15:48 PDT 2020


rsandifo-arm added inline comments.


================
Comment at: clang/docs/LanguageExtensions.rst:492
+
+The memory representation of a boolean vector is the smallest fitting
+power-of-two integer. The alignment is the alignment of that integer type.  This
----------------
simoll wrote:
> rsandifo-arm wrote:
> > It might be worth clarifying this.  With the alignment referring specifically to “integer type”, I wasn't sure what something like:
> > 
> >   bool __attribute__((vector_size(256)))
> > 
> > would mean on targets that don't provide 256-byte integer types.  Is the type still 256-byte aligned?
> Not exactly: It is the alignment of the corresponding integer type.
> For example the following C code:
> 
>     typedef bool bool256 __attribute__((vector_size(256)));
>     bool256 P;
> 
> gives you (x86_64 host, no machine flags specified):
> 
>     %P = alloca i2048, align 32
I guess my point is pedantic, but what I meant was: does the concept of “the corresponding integer type” necessarily exist at the C/C++ level?  E.g. how would you end up with the same LLVM IR statement using C integer types instead of vectors?

My worry was that “the alignment of the corresponding integer type” would only be meaningful to the user if they could identify what the corresponding (C) integer type actually was, and be able to determine its alignment that way.



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