From: Michael Meissner <meissner@linux.vnet.ibm.com>
To: DJ Delorie <dj@redhat.com>
Cc: Andrew Pinski <pinskia@gmail.com>, gcc@gcc.gnu.org
Subject: Re: opaque vector types?
Date: Fri, 08 May 2009 21:05:00 -0000 [thread overview]
Message-ID: <20090508184422.GA18919@hungry-tiger.westford.ibm.com> (raw)
In-Reply-To: <xnmy9qvj51.fsf@greed.delorie.com>
On Wed, May 06, 2009 at 02:29:46AM -0400, DJ Delorie wrote:
>
> Andrew Pinski <pinskia@gmail.com> writes:
> > You could do what the rs6000 back-end does for the altivec builtins
> > and resolve them while the parser is run (the SPU back-end does the
> > same thing too). Yes there are opaque vector types, you just use
> > build_opaque_vector_type instead of build_vector_type.
>
> Thanks, I'll look at those. Any way to prototype such functions in C ?
As Andrew says the rs6000/spu have the notion of overloaded builtins. I've
been working in this area somewhat for the power7 port, and you might want to
look at my power7-branch.
In rs6000.h it uses REGISTER_TARGET_PRAGMAS to set the
resolve_overloaded_builtin target hook:
/* Target pragma. */
#define REGISTER_TARGET_PRAGMAS() do { \
c_register_pragma (0, "longcall", rs6000_pragma_longcall); \
targetm.resolve_overloaded_builtin = altivec_resolve_overloaded_builtin; \
} while (0)
In rs6000-c.c you have the function that tries to resolve the builtin given the
argument types:
tree
altivec_resolve_overloaded_builtin (tree fndecl, void *passed_arglist)
{
...
}
It returns a tree of the builtin function with the appropriate types. In the
code, there is a giant table (altivec_overloaded_builtins) that maps the
generic builtin functions to the specific ones based on the argument types.
For example, altivec has a builtin function that does absolute value for any
vector type, and internally it converts this to the appropriate builtin for
each type:
const struct altivec_builtin_types altivec_overloaded_builtins[] = {
/* Unary AltiVec/VSX builtins. */
{ ALTIVEC_BUILTIN_VEC_ABS, ALTIVEC_BUILTIN_ABS_V16QI,
RS6000_BTI_V16QI, RS6000_BTI_V16QI, 0, 0 },
{ ALTIVEC_BUILTIN_VEC_ABS, ALTIVEC_BUILTIN_ABS_V8HI,
RS6000_BTI_V8HI, RS6000_BTI_V8HI, 0, 0 },
{ ALTIVEC_BUILTIN_VEC_ABS, ALTIVEC_BUILTIN_ABS_V4SI,
RS6000_BTI_V4SI, RS6000_BTI_V4SI, 0, 0 },
{ ALTIVEC_BUILTIN_VEC_ABS, ALTIVEC_BUILTIN_ABS_V4SF,
RS6000_BTI_V4SF, RS6000_BTI_V4SF, 0, 0 },
...
};
--
Michael Meissner, IBM
4 Technology Place Drive, MS 2203A, Westford, MA, 01886, USA
meissner@linux.vnet.ibm.com
next prev parent reply other threads:[~2009-05-08 18:44 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-05-06 6:04 DJ Delorie
2009-05-06 6:11 ` Andrew Pinski
2009-05-06 6:29 ` DJ Delorie
2009-05-06 9:08 ` Paolo Bonzini
2009-05-08 21:05 ` Michael Meissner [this message]
2009-06-10 13:00 ` Paul Brook
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20090508184422.GA18919@hungry-tiger.westford.ibm.com \
--to=meissner@linux.vnet.ibm.com \
--cc=dj@redhat.com \
--cc=gcc@gcc.gnu.org \
--cc=pinskia@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).