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: Richard Guenther <rguenther@suse.de>,
	Jason Merrill <jason@redhat.com>,
		gcc-patches List <gcc-patches@gcc.gnu.org>
Subject: Re: RFA (fold): PATCH for c++/49290 (folding *(T*)(ar+10))
Date: Mon, 13 Jun 2011 12:46:00 -0000	[thread overview]
Message-ID: <BANLkTi=nKv=j0Zd_HAi4hKMUjgr4y3fDDA@mail.gmail.com> (raw)
In-Reply-To: <E6EE40BD-885F-41D9-9FB7-A053BFE4B7B4@comcast.net>

On Mon, Jun 13, 2011 at 5:17 AM, Mike Stump <mikestump@comcast.net> wrote:
> On Jun 12, 2011, at 3:55 AM, Richard Guenther wrote:
>> In almost all cases(*) the need for a lvalue VIEW_CONVERT_EXPR can be avoided
>> by moving the VIEW_CONVERT_EXPR to the rvalue assigned too it.  Remember that
>> VIEW_CONVERT_EXPR always conver the full object and are not allowed to
>> change sizes.
>>
>> So, do you have an example?
>
> Sure, take a divmod type of instruction.[1]  It has two outputs, a div and a mod.  The instruction operates on registers, and produces two completely independent values.  But really, it is a general features of the built-in mechanism that Kenny and I are working on that some people would like to reuse for other ports.  The general feature is that one can declare any argument to a built-in to be input only, output only or input/output.  This nicely matches what I think quite of lot of machines do for assembly language semantics.  The support isn't to match my machine, but rather to support building a port, in which 1 or more instructions have such parameters.  Requiring memory is a non-starter, and in fact, we already have a scheme for memory_operand type things for the instructions that take memory.  The scheme used for them is borrowed from C++, where we just declare that the built-in takes a reference type.  This reuses most of the code paths from C++ and it seems to work nicely.  I'd be tempting to use it for register references, but, in my current scheme for registers, I support data flow in, out and in/out at the tree level and at the rtl level.  We believe this is nice from an optimizing perspective, and probably required to get the warnings about using uninitialized variables correct.

That's not exactly an example - I can't think of how you want or need
to use VIEW_CONVERT_EXPRs to implement said divmod instruction or why
you would need
anything special for the _argument_ of said instruction.  An
instruction or call with multiple outputs would simply be something
like

{ div_1, mod_2 } = __builtin_divmod (arg_3);

with two SSA defs. A nice representation for the tree for { div_1,
mod_2 } remains to be found (if it should be a single tree at all, or
possibly
multiple ones).

We already play tricks for sincos for example via

tem_1 = __builtin_cexpi (arg_2);
sin_3 = REALPART_EXPR <tem_1>;
cos_4 = IMAGPART_EXPR <tem_1>;

which avoids the two defs by using a single def which is then decomposed.

So, can you elaborate a bit more on what you want to do with special
argument kinds?  Elaborate with an actual example, not words.

Thanks,
Richard.

  reply	other threads:[~2011-06-13 10:57 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-06-07  5:39 Jason Merrill
2011-06-07 10:20 ` Richard Guenther
2011-06-07 10:27   ` Jakub Jelinek
2011-06-07 12:03     ` Richard Guenther
2011-06-07 12:22       ` Richard Guenther
2011-06-07 13:46         ` Michael Matz
2011-06-07 13:49           ` Richard Guenther
2011-06-07 13:55   ` Jason Merrill
2011-06-07 14:05     ` Richard Guenther
2011-06-07 14:24       ` Jason Merrill
2011-06-09 19:47         ` Jason Merrill
2011-06-10  8:53           ` Richard Guenther
2011-06-10 14:03             ` Jason Merrill
2011-06-10 14:20               ` Richard Guenther
2011-06-10 14:32                 ` Jason Merrill
2011-06-10 14:34                   ` Richard Guenther
2011-06-10 14:45                     ` Jason Merrill
2011-06-11 18:24                     ` Mike Stump
2011-06-12 11:03                       ` Richard Guenther
2011-06-13  7:29                         ` Mike Stump
2011-06-13 12:46                           ` Richard Guenther [this message]
2011-06-14 20:31                             ` Mike Stump
2011-06-15  9:54                               ` Richard Guenther
2011-06-15 18:57                                 ` Mike Stump
2011-06-16  7:39                                   ` Richard Guenther
2011-06-17 14:17                                     ` Michael Matz
2011-06-20 10:24                                       ` Richard Guenther
2011-06-12  7:58                     ` Is VIEW_CONVERT_EXPR an lvalue? (was Re: RFA (fold): PATCH for c++/49290 (folding *(T*)(ar+10))) Jason Merrill
2011-06-12 13:18                       ` Richard Guenther
2011-06-12 13:22                         ` Richard Guenther
2011-06-13  6:12                           ` Mike Stump
2011-06-12 22:42                         ` Jason Merrill
2011-06-13 12:44                           ` Richard Guenther
2011-06-13 17:59                             ` RFA (fold): PATCH for c++/49290 (folding *(T*)(ar+10)) Jason Merrill
2011-06-14  9:10                               ` Richard Guenther

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='BANLkTi=nKv=j0Zd_HAi4hKMUjgr4y3fDDA@mail.gmail.com' \
    --to=richard.guenther@gmail.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=jason@redhat.com \
    --cc=mikestump@comcast.net \
    --cc=rguenther@suse.de \
    /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).