[macstl-dev] Integrating Linux changes,
or that funny return type issue
Glen Low
glen.low at pixelglow.com
Sat Jun 4 22:37:59 WST 2005
Michael:
On 04/06/2005, at 12:37 AM, Glen Low wrote:
> Michael:
>
> I've integrated most of your changes but not having a YDL box handy
> I can't really test. I'm definitely supporting only gcc >= 3.4.2 on
> Linux because of the vector bool issues.
>
> I noticed one of the first changes you made related to mainline 3.3
> ickiness with return values within templates. I'm wondering whether
> it still holds for 3.4.2 and above; please try to compile:
>
> namespace macstl
> {
> namespace impl
> {
> template <unsigned int v0, unsigned int v1,
> unsigned int v2, unsigned int v3> struct generator
> {
> __vector unsigned int operator() () const
> {
> #if defined(USE_C99_VEC_INIT_IN_TEMPL)
>
> return (__vector unsigned int) {v0,
> v1, v2, v3};
>
> #elif defined
> (USE_MOT_VEC_INIT_IN_TEMPL)
>
> // most compilers choke on this,
> not realizing v0 - v3 ARE constant expressions!!
> return (__vector unsigned int) (v0,
> v1, v2, v3);
>
> #else
>
> union union_type
> {
> unsigned int val [4];
> __vector unsigned int vec;
> };
>
> static const union_type un = {v0,
> v1, v2, v3};
> return un.vec;
>
> #endif
>
> }
> };
> }
> }
>
> On mainline 3.3, the "__vector unsigned int operator() () const"
> line caused major unpleasantness IIRC.
I didn't get a reply from you. Based on the bug description back in
our list in March 2005, and looking the gcc Bugzilla here http://
gcc.gnu.org/bugzilla/show_bug.cgi?id=8795, it seemed that returns
with vector types in C++ cause a "sorry, unimplemented: `integer_cst'
not supported by dump_type" error. It's claimed to be fixed in gcc
3.4 and since that's the minimum version I'm going to support for
Linux, I will leave the code as above. (It concerns me since there's
a few more places where vector types are returned in macstl
0.2.2.15/16).
Also based on the differences between the gcc 3.3 and 3.4 manuals at
gcc.gnu.org, it seems 3.3 requires vec_splat_u32 to have a char, but
3.4 requires vec_splat_u32 to have an int, so again I will leave the
code written as "vec_splat_u32 (-16)".
Cheers, Glen Low
---
pixelglow software | simply brilliant stuff
www.pixelglow.com
aim: pixglen
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.pixelglow.com/lists/archive/macstl-dev/attachments/20050604/1e8211c2/attachment-0001.html
More information about the macstl-dev
mailing list