From mboxrd@z Thu Jan 1 00:00:00 1970 From: Richard Henderson To: Aldy Hernandez Cc: "Joseph S. Myers" , gcc@gcc.gnu.org Subject: Re: front end changes for altivec Date: Tue, 27 Nov 2001 17:02:00 -0000 Message-ID: <20011127170133.A30341@redhat.com> References: <1006874643.5176.8.camel@litecycle.cc.andrews.edu> <20011127132756.A30114@redhat.com> <1006898082.5178.41.camel@litecycle.cc.andrews.edu> <20011127140031.E30114@redhat.com> <1006908775.5178.45.camel@litecycle.cc.andrews.edu> X-SW-Source: 2001-11/msg01434.html Message-ID: <20011127170200.5AV9pqFMOsxgpjt-DbOO2TBm7fkDxoNjHoFKDXvAqP4@z> On Tue, Nov 27, 2001 at 06:52:55PM -0600, Aldy Hernandez wrote: > > How about __vector_size__(16) then? > > can anyone think of any way to get: > > vector int foo; /* v4si */ > vector short bar; /* v2hi */ > vector char hot; /* v16qi */ > etc > > working for altivec in a target independent manner? Modulo the varying size of "short", #define __vector __attribute__((__vector_size__(16))) works. And char/short/int doesn't actually vary *that* widely. The targets for which these are not 1, 2 and 4 octets wide are fairly rare, so I'm willing to gloss over that. Especially since you can also work around this like so: #if SHRT_MAX == 32767 typedef unsigned short u16; #elif INT_MAX == 32767 typedef unsigned int u16; #else #error you're strange #endif __vector u16 foo; I think for stuff written for gcc itself we should encourage the use of mode(V4SI), or some other explicit element size + vector width syntax yet to be determined. r~