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

Simon Moll via Phabricator via cfe-commits cfe-commits at lists.llvm.org
Fri Aug 21 01:35:33 PDT 2020


simoll marked 4 inline comments as done.
simoll 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
----------------
rsandifo-arm wrote:
> 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.
> 
To be honest, i hadn't given alignment much thought before. Actually, i am not too happy about bringing in integer types here.

I guess it's sensible to do no different than for the other vector types: take the size rounded up to the next power-ot-two capped by the target's maximum vector alignment.



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