From: Richard Guenther <rguenther@suse.de>
To: Mike Stump <mikestump@comcast.net>
Cc: Richard Guenther <richard.guenther@gmail.com>,
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: Wed, 15 Jun 2011 09:54:00 -0000 [thread overview]
Message-ID: <alpine.LNX.2.00.1106151102490.810@zhemvz.fhfr.qr> (raw)
In-Reply-To: <D573FD87-391C-4D1D-868C-F694AAAD1FF9@comcast.net>
On Tue, 14 Jun 2011, Mike Stump wrote:
> On Jun 13, 2011, at 3:57 AM, Richard Guenther wrote:
> > 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.
>
> Oh, I completely misunderstood your question. In my case, as I previously stated, was with a vector type that was identical, save the name of the type:
>
> mod = a%b
>
> where mod didn't have the type of the expression (a%b), so someone created the VIEW_CONVERT_EXPR on the mod. The person creating it _thought_ it would be a rvalue context, but ultimately, it was an lvalue context. We discover the lvalue/rvalue state of the expression at target_fold_builtin time. The actual code looks more like:
>
> __builtin_divmod (div, mod, a, b);
>
> In fold_builtin, we do all the processing to handle the semantics.
>
> > 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).
>
> At target_fold_builtin time we regenerate it as:
>
> s = builtin_divmod_final (a, b);
> div_1 = s.div
> mod_2 = s.mod
>
> and generate a type { div, mod } on the fly. We expect the optimizer to handle extra moves reasonably, and we want to keep the one instruction as one unit.
>
> > 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.
>
> We support tagging any parameter to a builtin as define_outputs, define_inputs or define_in_outs in a part of the .md file that describes the builtins for the machine, the actual divmod builtin for example is:
>
> (define_builtin "divmod<T_ALL_DI:sign_u>" "divmod<T_ALL_DI:sign_u>_<type>"
> [
> (define_outputs [(var_operand:T_ALL_DI 0) ;;dividend
> (var_operand:T_ALL_DI 1)]) ;;mod
> (define_inputs [(var_operand:T_ALL_DI 2)
> (var_operand:T_ALL_DI 3)])
> (define_rtl_pattern "<T_ALL_DI:sign_u>divmod<m_mode>4" [0 1 2 3])
> (attributes [pure])
> ]
> )
>
> that's the actual code. The testcase looks like:
>
> t_v4udi_0 = divmodu_t_v4udi (t_v4udi_1, t_v4udi_2, t_v4udi_3);
I see. So it's the C side of the representation that needs the
special operands.
> The VIEW_CONVERT_EXPR looks like:
>
> <view_convert_expr 0x7ffff5a872d0
> type <vector_type 0x7ffff7f4b930 __attribute__((vector_size(32))) unsigned long
> type <integer_type 0x7ffff7e8c690 long unsigned int public unsigned DI
> size <integer_cst 0x7ffff7e76730 constant 64>
> unit size <integer_cst 0x7ffff7e76758 constant 8>
> align 64 symtab 0 alias set -1 canonical type 0x7ffff7e8c690 precision 64 min <integer_cst 0x7ffff7e76780 0> max\
> <integer_cst 0x7ffff7e76708 18446744073709551615>
> pointer_to_this <pointer_type 0x7ffff7f50738> reference_to_this <reference_type 0x7ffff7f513f0>>
> unsigned V4DI
> size <integer_cst 0x7ffff7f43de8 constant 256>
> unit size <integer_cst 0x7ffff7e76348 constant 32>
> align 256 symtab 0 alias set -1 canonical type 0x7ffff7f4b930 nunits 4 reference_to_this <reference_type 0x7ffff7f51\
> 540>>
>
> arg 0 <var_decl 0x7ffff59d9640 t_v4udi_1
> type <vector_type 0x7ffff5ac3888 type <integer_type 0x7ffff7e8c690 long unsigned int>
> unsigned V4DI size <integer_cst 0x7ffff7f43de8 256> unit size <integer_cst 0x7ffff7e76348 32>
> align 256 symtab 0 alias set -1 canonical type 0x7ffff5ac3888 nunits 4>
> used public static unsigned V4DI defer-output file t22.c line 262 col 48 size <integer_cst 0x7ffff7f43de8 256> unit \
> size <integer_cst 0x7ffff7e76348 32>
> align 256>>
This VIEW_CONVERT_EXPR looks useless - in fact useless_type_conversion_p
will tell you that, so you can omit it.
Richard.
next prev parent reply other threads:[~2011-06-15 9:04 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
2011-06-14 20:31 ` Mike Stump
2011-06-15 9:54 ` Richard Guenther [this message]
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=alpine.LNX.2.00.1106151102490.810@zhemvz.fhfr.qr \
--to=rguenther@suse.de \
--cc=gcc-patches@gcc.gnu.org \
--cc=jason@redhat.com \
--cc=mikestump@comcast.net \
--cc=richard.guenther@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).