[cfe-dev] "vector" type, PS3 targets
Douglas Gregor
dgregor at apple.com
Thu Nov 19 09:09:18 PST 2009
On Nov 18, 2009, at 3:41 PM, John Thompson wrote:
> Hi,
>
> I thought I'd to some preliminary work to see what issues I'd run
> into trying to compile some sources intented for the PS3 PPU
> target. The PS3 devkit includes a gcc-based compiler, so I'm
> thinking that would make it a bit easier.
>
> Although there is a -faltivec option, it appears that there is no
> support yet for the "vector" type (or is it really "__vector", or
> perhaps a built-in alias?).
There's a little bit of information about a "__vector" in the "PowerPC
Type Attributes" section of the GCC manual, here:
http://gcc.gnu.org/onlinedocs/gcc-4.4.2/gcc/Type-Attributes.html#Type-Attributes
> I don't know much about this, so I was wondering if someone out
> there could say something about it with respect to plans for it in
> clang.
Clang currently supports two kinds of vector types, the GNU vector
attribute (e.g., "int __attribute__((vector_size(number-of-bytes)))")
and Clang's own OpenCL-inspired extended vector attribute (e.g., "int
__attribute__((ext_vector_type(number-of-elements)))"). The Altivec
vector/__vector probably matches one of those.
> I suppose that in addition to the vector type, this would also
> involve all the "__builtin_vec-*" functions, but not having the
> vector type used in the altivec.h include file was the first thing I
> ran into.
> I've enclosed some initial work for the targets, in
> ps3targets.patch. This depends on changes to the Triple class in
> ps3triple.patch, which I've submitted seperately to the llvmdev
> list. The gcc-based compiler in the PS3 devkit uses the the "ppu-
> uknown-lv2" and "spu-unknown-lv2" triples, so these changes do the
> same. I don't know why there isn't a "ps3" in there somewhere, but
> it probably should be the same in both compilers.
+ // FIXME: Does this belong in PPCTargetInfo?
+ if (Opts.AltiVec) {
+ Define(Defs, "__VEC__", "1");
+ Define(Defs, "__ALTIVEC__", "1");
+ }
GCC defines both of these when compiling for PPC, so they should go
into PPCTargetInfo. I'm seeing the following definitions:
#define __VEC__ 10206
#define __ALTIVEC__ 1
Otherwise, the triple and target changes look good!
- Doug
More information about the cfe-dev
mailing list