This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [RFC] prototype altivec function overloading rewrite
- From: bonzini <paolo dot bonzini at polimi dot it>
- To: Richard Henderson <rth at redhat dot com>, gcc-patches at gcc dot gnu dot org, Aldy Hernandez <aldyh at redhat dot com>
- Date: Thu, 15 Apr 2004 12:11:35 +0200
- Subject: Re: [RFC] prototype altivec function overloading rewrite
- References: <006201c421f4$70899c60$8bde1d97@philo> <20040414174332.GD4654@redhat.com>
- Reply-to: bonzini at gnu dot org
If you have opaque return types, or any type chosen too early, you won't
select the proper vector addition instruction for one or the other of
the outer-most calls.
No, you can because rs6000_fold_builtin will return the expansion of the
proper vector addition builtin, with the proper return type that is used
for the outermost calls. All the following calls are expanded properly
with my approach:
vector unsigned char w;
vector unsigned int z;
vector bool int y;
vector int x;
char a[vec_step (x)];
void f ()
{
w = vec_add (w, w); /* pick addubm */
}
void g ()
{
vec_dst (&x, 1, 0);
x = vec_add (y, x); /* pick adduwm */
z = vec_adds (z, z); /* pick adduws */
x = vec_adds (x, x); /* pick addsws */
x = vec_adds (y, x); /* pick addsws */
}
void h ()
{
x = vec_adds (vec_adds (x, x), vec_adds (x, x)); /* pick three addsws */
}
void i ()
{
z = vec_adds (vec_adds (z, z), vec_adds (z, z)); /* pick three adduws */
}
void j ()
{
w = (vector unsigned char) vec_add ((vector unsigned int) w, (vector
unsigned int) w); /* pick adduwm */
}
void k ()
{
w = (vector unsigned char) vec_add ((vector unsigned short) w, (vector
unsigned short) w); /* pick adduhm */
}
I still have to work out how to do the predicates, and to sort out
languages other than C, but the rest is already in place.
I wouldn't be opposed to a fold_builtin hook, but that would have to
get used for actual folding, i.e. when the builtin gets fed constant
values.
I agree that this would be an abuse of fold_builtin.
True enough. And probably we can use bitfields in the structures
to make it pack smaller in memory.
Less than 10 kb (8 bytes * ~1000 entries).
Paolo