[cfe-dev] Implementing Altivec vector support questions

John Thompson john.thompson.jtsoftware at gmail.com
Mon Dec 7 12:55:35 PST 2009

1. In implementing vector and __vector, which is better?:

A.  Don't make it a keyword, but if LangOptions::AltiVec is set and a
kw_identifier with the name "vector" or "__vector" is followed by a numeric
type keyword, make the type a vector type.

B. Make vector and __vector a keyword if LangOptions::AltiVec is set, and if
not followed by a numeric type keyword, treat it as an identifier.
My guess is that A is better as it involves less fixing up of cases where an
identifier with the name of "vector" can occur.

2. Regarding the typing, I'm thinking internally it would be treated just as
if __attribute__((vector_size(16)) were applied to the type, right?

3. With __attribute__((vector_size(16)), does the Clang code generation
already output everything LLVM needs to support the Altivec vectors?

For example, in looking at the code generated for some code using an
"__attribute__((vector_size(16)) float" variable or return type, the .ll
file uses "<4 x float>".  On a PowerPC platform supporting Altivec,
does LLVM automatically know to map that to a vector register?

4.  I'm guessing the Altivec functions can be implemented as Clang built-in
functions that map to calls to LLVM's altivec intrinsic functions, right?  I
haven't researched this much yet.

5.  Any suggestions or other things I ought to know at this early point?



John Thompson
John.Thompson.JTSoftware at gmail.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/cfe-dev/attachments/20091207/aa639146/attachment.html>

More information about the cfe-dev mailing list