[PATCH] D94964: Describe vector layout in LangRef

Bjorn Pettersson via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jan 20 02:54:23 PST 2021


bjope added inline comments.


================
Comment at: llvm/docs/LangRef.rst:3161
+
+For vectors with sub-byte sized elements these rules are extended in the spirit
+of the rules governing bit field layout in the C language. Consider
----------------
Maybe it is just confusing to talk about sub-byte sized elements and C language here? I mean we need to define how it works for sizes larger than a byte as well. And the IR is source language agnostic (even if the motivation here might origin from C).

We could perhaps just state that the layout is packed. And that the vector could be seen as one large iN scalar (N given by the type store size in bits of the vector), with element zero being in the most significant bits for a big-endian target and in the least significant bits for a little-endian target.

I guess it isn't defined where padding goes if the type size is less than the type store size (e.g. <2 x i6> has a type size that is 12 bits, but the type store size is 16 bits).


================
Comment at: llvm/docs/LangRef.rst:10547
 or :ref:`ptrtoint <i_ptrtoint>` instructions first.
 
 Example:
----------------
I think if it might be good to add a caveat here about bitcasts involving vector types. For example that `bitcast <2 x i8> to i16` puts element zero of the vector in the least significant bits of the i16 for little-endian while element zero ends up in the most significant bits for big-endian.


Repository:
  rG LLVM Github Monorepo

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

https://reviews.llvm.org/D94964



More information about the llvm-commits mailing list