[cfe-dev] Implementing Altivec vector support questions
clattner at apple.com
Tue Dec 8 11:36:50 PST 2009
On Dec 8, 2009, at 11:30 AM, John Thompson wrote:
> Thanks, Chris.
> I don't know how much magic is inherent in this language extension.
> Would it be bad to to make __vector *always* be on when AltiVec is
> enabled (whether or not it is followed by a 'numeric type
> keyword')? We could then make 'vector' be fuzzier. I'm still
> vaguely uncomfortable with 'vector' changing semantics depending on
> its lexical context, but understand that you probably don't have a
> choice here :)
> I think I see. Treat "__vector" as a normal keyword token, and if
> "vector" is encountered, I still do the context check and
> effectively treat it as "__vector"?
> Sure, if that works! I don't know what __vector does.
> My understanding is that "__vector" (or "vector") in this context is
> always followed by a numeric type, i.e. "_vector unsigned int". My
> guess was that this would be effecticvely equivalent to
> "__attribute__((vector_size(16))) unsigned int", so the plan would
> then be to have the resulting type for these two be the same after
> the semantic action.
so 'vector' doesn't work as a type qualifier? For others type
qualifiers, you can arrange them, e.g. "const int" == "int const" etc.
> I think so, though we also need an 'altivec.h' for clang to use, in
> a similar spirit to 'xmmintrin.h' for sse.
> Yes, probably, if nothing else just to be compatible with gcc.
> (It's mentioned in the Altivec standard in section 2.6 of http://www.freescale.com/files/32bit/doc/ref_manual/ALTIVECPIM.pdf)
> . I was told it was orginally deprecated, but then left in to help
> with early implementation. Looking at the one we have for the PS3
> gcc compiler, it seems to be the PowerPC version, and mostly just
> maps Altivec names to the "__builtin_*" functions.
Right. Be aware that you can't just use the GCC version of the header
(afaik). The terms of the license I've seen are something to the
effect of "this header is GPL unless it is compiled with GCC". In any
case, you wouldn't want to reuse it directly anyway, because you'd
want to implement the 'simple' operations in terms of generic vector
operations instead of builtins.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the cfe-dev