public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Guenther <richard.guenther@gmail.com>
To: Mike Stump <mikestump@comcast.net>
Cc: Michael Meissner <meissner@linux.vnet.ibm.com>,
		"gcc-patches@gcc.gnu.org Patches" <gcc-patches@gcc.gnu.org>,
	David Edelsohn <dje.gcc@gmail.com>
Subject: Re: [PATCH] Add infrastructure to merge standard builtin enums with backend builtins
Date: Sat, 27 Aug 2011 10:56:00 -0000	[thread overview]
Message-ID: <CAFiYyc2Bcr_4D4YQu1m5zgFbZ4edVS2p-Ee60UYvEqDqvau9mg@mail.gmail.com> (raw)
In-Reply-To: <C7229405-D44E-4FAD-8898-F6FFBB15F12C@comcast.net>

On Sat, Aug 27, 2011 at 12:12 AM, Mike Stump <mikestump@comcast.net> wrote:
> On Aug 26, 2011, at 7:19 AM, Michael Meissner wrote:
>>>> The alternative is something like what Kenney and Mike are doing in their
>>>> private port, where they have new syntax in the MD file for builtins.
>>>
>>> But are those user-exposed builtins?  Certainly interesting to combine
>>> builtin definition and the instruction it expands to.
>>
>> Yes, these are user exposed builtins.  Massive amounts of user exposed builtins
>> (Mike said he needs 13 bits for the builtin index).  I think it would be better
>> if Mike comments on this.
>
> I gave the quick intro yesterday.  You wind up specifying the built-ins that you have, and the generator does things like assign enum values, create a file that appears the builtins into the user name space from the __builtin_ namespace, generate compilation test cases for all the built-ins with all different types they support.  Generate executable testcases to ensure everything works flawlessly.  We have mods to the overload builtin mechanism so that one can do things like:
>
> template <class T>
> T foo(T x, T y) {
>  x = add(x, y);
>  return x;
> }
>
> Or, if you perfer the C version:
>
> int fooi(int x, int y) {
>  return add(x, y);
> }
>
> short foos(short x, short y) {
>  return add(x, y);
> }
>
> and have it work out just fine when T is instantiated with all the various types that are supported by the hardware, and it works in C.  This permits a nice api for the machine builtins, as you don't have to mangle in types into the builtin-name.  The system is complete enough to handle the needs of anything coming down the pike in the next decade.  It can handle input/output parameters that have register assignments.  It can handle reference parameters (like the input/output parameters, but these are done as values in memory.  The generator builds up _all_ the types one needs, handles all the registration and all the wiring up for codegen.  There is a mechanism to remap arguments going to the rtl generators, so the operand ordering of the builtin doesn't have to match the operand ordering of the md pattern for the semantics that back the builtin.  There is a beefy macro system built into the generator so that you can have nice simple patterns and it is beefier than the iterators one can use today.  So, for example, we have:
>
> (define_special_iterator imath3 [add sub mul])
>
> to define some built-ins that are regular with respect to the operation, but, this isn't a code nor mode iterator, it just iterators the pattern with the string substituted.  For machines with any regularity, the patterns wind up being smaller and easier to maintain.  I'd be happy to answer questions about it.

Maybe you can even post the code somewhere?

Richard.

      reply	other threads:[~2011-08-27  7:25 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-08-23 19:04 Michael Meissner
2011-08-24  8:18 ` Mike Stump
2011-08-24  8:58 ` Paolo Bonzini
2011-08-24 10:58 ` Richard Guenther
2011-08-25 22:44   ` Michael Meissner
2011-08-25 23:12     ` Mike Stump
2011-08-26 10:03     ` Richard Guenther
2011-08-26 14:41       ` Michael Meissner
2011-08-27 10:33         ` Mike Stump
2011-08-27 10:56           ` Richard Guenther [this message]

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=CAFiYyc2Bcr_4D4YQu1m5zgFbZ4edVS2p-Ee60UYvEqDqvau9mg@mail.gmail.com \
    --to=richard.guenther@gmail.com \
    --cc=dje.gcc@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=meissner@linux.vnet.ibm.com \
    --cc=mikestump@comcast.net \
    /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).