[Dwarf-discuss] ISSUE: vector types. V2

Pedro Alves pedro@palves.net
Wed Apr 12 13:33:48 GMT 2023


On 2023-04-06 12:03 p.m., Jakub Jelinek via Dwarf-discuss wrote:

> In GCC, one uses vector_size attribute to define such types, so say
> typedef int V __attribute__((vector_size (64)));
> where 64 is number of bytes the vector has (so for 4 byte int it is 16
> elements).
> I think Clang supports both these vectors and also ext_vector_size
> attribute, where the latter specifies number of elements rather than size
> and I think has a little bit different other properties.

Hmm.  So in the same program it is possible to have different flavors of
vector types.

Honza's blog post here talks about some of the differences
between Clang's ext_vector_size vectors and GNU vectors:

  http://hubicka.blogspot.com/2018/12/even-more-fun-with-building-and.html

and then Clang's documentation of the vector types lists the different
supported vector extensions:

  https://clang.llvm.org/docs/LanguageExtensions.html#vectors-and-extended-vectors

  "Supports the GCC, OpenCL, AltiVec, NEON and SVE vector extensions."

So now I'm wondering whether a consumer needs to distinguish the vector flavors.
Do we need some kind of encoding?  E.g., go back to array_type + vector attribute,
and give the new attribute an optional value to identifies the vector flavor?

Pedro Alves

> On 64-bit ARM at least (unsure about RISCV), one can also have variable
> number element vectors, where the number of elements of the vector is
> determined by reading some hw register.
> 


More information about the Dwarf-discuss mailing list