This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: patch: Re: rfc: auto-casted vector types
- From: Aldy Hernandez <aldyh at redhat dot com>
- To: Kumar Gala <kumar dot gala at motorola dot com>
- Cc: Geoff Keating <geoffk at geoffk dot org>, Nick Clifton <nickc at redhat dot com>, <gcc-patches at gcc dot gnu dot org>, Jim Wilson <wilson at redhat dot com>, <mark at codesourcery dot com>, Zack Weinberg <zack at codesourcery dot com>
- Date: Wed, 19 Feb 2003 11:12:15 -0800
- Subject: Re: patch: Re: rfc: auto-casted vector types
Sounds reasonable, but what I thought your last set of changes removes
the need to do any casts between the various V... modes. Is this not
true? If so, why are the casts required at all?
For opaque types, yes. The problem is that the builtins return V2SI,
not an opaque type. So, if we remove the line Geoff suggested you
would not be able to do this:
#define __ev_addw(a,b) __builtin_spe_evaddw((__v2si) (a), (__v2si) (b))
vector float foo;
foo = __ev_addw(x,y);
...because __builtin_spe_evaddw returns a V2SI, no a type with an
underlying name of __ev64_opaque__. That __ev64_opaque__ is a V2SI is
purely coincidential, what we're interested in is if the type name is
actually called "__ev64_opaque__". If you look at the current
definition for rs6000_spe_vector_types_compatible(), you will see:
static bool
rs6000_spe_vector_types_compatible (t1, t2)
tree t1;
tree t2;
{
if (!TARGET_SPE
|| TREE_CODE (t1) != VECTOR_TYPE || TREE_CODE (t2) != VECTOR_TYPE)
return 0;
if (TYPE_NAME (t1) || TYPE_NAME (t2))
return is_ev64_opaque_type (t1) || is_ev64_opaque_type (t2);
/* FIXME: We assume V2SI is the opaque type, so we accidentally
allow inter conversion to and from V2SI modes. We could use
V1D1, and rewrite <spe.h> accordingly. */
return t1 == V2SI_type_node || t2 == V2SI_type_node;
}
is_ev64_opaque_type returns true if the underlying type is a typedef
actually named "__ev64_opaque__". Geoff has suggested we remove the
last check for V2SI_type_node. So I'm suggesting we do as Geoff said,
and then cast the return arguments from the builtins to __ev64_opaque__.
I hope this makes it clearer.
Aldy