[cxx-abi-dev] mangling vector types

Doug Gregor doug.gregor at gmail.com
Tue Nov 10 23:45:57 UTC 2009


On Tue, Nov 10, 2009 at 3:06 PM, David Vandevoorde <daveed at edg.com> wrote:
>
> On Nov 10, 2009, at 5:49 PM, Mark Mitchell wrote:
>
>> Jason Merrill wrote:
>>
>>> to represent the type of vec in an element-based mangling, the number of
>>> elements would need to be expressed as I/sizeof(T), which is not more
>>> compact.
>>>
>>> That, and the fact that vector_size takes a number of bytes rather than
>>> elements suggests that maybe the former is more natural for working with
>>> vector hardware.
>>
>> From a language-design point of view, I don't understand why we're using
>> bytes there.  It seems unnecessarily low-level.  So, using a byte-based
>> mangling seems consistent with GCC's language extension, but I'm not
>> sure why that's a particularly good language extension.  Of course, if
>> it's a language extension that everyone has accepted and is therefore
>> standard (not in the ISO sense, but in the everyone-does-it sense), then
>> abstract goodness is irrelevant.
>
>
> Actually, other extensions (e.g., OpenCL) deal with "number of elements"
> instead of "number of bytes".

Right.

> Could GCC introduce a new attribute "vector" such that
> __attribute((vector(N))) is equivalent to
> __attribute((vector_size(N*sizeof(element_type)))) and only allow the
> "vector" variant with dependent signatures?

FWIW, we use the ext_vector attribute for exactly this purpose (it
introduces an OpenCL-compatible vector type) and we only allow the
ext_vector variant to have a dependent size.

  - Doug



More information about the cxx-abi-dev mailing list