From: Jiufu Guo <guojiufu@linux.ibm.com>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: Richard Biener <rguenther@suse.de>,
gcc-patches@gcc.gnu.org, dje.gcc@gmail.com, jlaw@tachyum.com,
wschmidt@linux.ibm.com
Subject: Re: [PATCH] Check if loading const from mem is faster
Date: Thu, 24 Feb 2022 13:56:49 +0800 [thread overview]
Message-ID: <h48bkywst7i.fsf@genoa.aus.stglabs.ibm.com> (raw)
In-Reply-To: <20220223211406.GH614@gate.crashing.org> (Segher Boessenkool's message of "Wed, 23 Feb 2022 15:14:06 -0600")
Segher Boessenkool <segher@kernel.crashing.org> writes:
> On Wed, Feb 23, 2022 at 02:02:59PM +0100, Richard Biener wrote:
>> I'm assuming we're always dealing with
>>
>> (set (reg:MODE ..) <src_folded>)
>>
>> here and CSE is not substituting into random places of an
>> instruction(?). I don't know what 'rtx_cost' should evaluate
>> to for a constant, if it should implicitely evaluate the cost
>> of putting the result into a register for example.
>
> rtx_cost is no good here (and in most places). rtx_cost should be 0
> for anything that is used as input in a machine instruction -- but you
> need much more context to determine that. insn_cost is much simpler and
> much easier to use.
>
>> Using RTX_COST with SET and 1 at least looks no worse than using
>> your proposed new target hook and comparing it with the original
>> unfolded src (again with SET and 1).
>
> It is required to generate valid instructions no matter what, before
> the pass has finished that is. On all more modern architectures it is
> futile to think you can usefully consider the cost of an RTL expression
> and derive a real-world cost of the generated code from that.
Thanks Segher for pointing out these! Here is another reason that I
did not use rtx_cost: in a few passes, there are codes to check the
constants and store them in constant pool. I'm thinking to integerate
those codes in a consistent way.
BR,
Jiufu
>
> But there is so much more wrong with cse.c :-(
>
>
> Segher
next prev parent reply other threads:[~2022-02-24 5:56 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-22 6:53 Jiufu Guo
2022-02-22 7:26 ` Richard Biener
2022-02-23 11:32 ` guojiufu
2022-02-23 13:02 ` Richard Biener
2022-02-23 21:14 ` Segher Boessenkool
2022-02-24 5:56 ` Jiufu Guo [this message]
2022-02-24 6:33 ` Jiufu Guo
2022-02-24 8:50 ` Richard Biener
2022-02-25 4:35 ` Jiufu Guo
2022-02-25 8:45 ` Richard Biener
2022-02-25 13:32 ` Jiufu Guo
2022-02-25 13:57 ` Richard Biener
2022-02-28 9:15 ` Jiufu Guo
2022-02-28 17:03 ` Segher Boessenkool
2022-03-01 2:59 ` Jiufu Guo
2022-03-01 7:47 ` Richard Biener
2022-03-01 13:47 ` Jiufu Guo
2022-03-02 19:15 ` Jeff Law
2022-03-03 10:08 ` Jiufu Guo
2022-02-23 21:27 ` Segher Boessenkool
2022-02-24 7:48 ` Jiufu Guo
2022-02-28 16:45 ` Segher Boessenkool
2022-03-01 14:28 ` Jiufu Guo
2022-03-02 20:24 ` Segher Boessenkool
2022-03-03 10:09 ` Jiufu Guo
2022-03-08 11:25 ` Jiufu Guo
2022-03-08 11:50 ` Richard Biener
2022-03-09 4:37 ` Jiufu Guo
2022-03-09 7:41 ` Richard Biener
2022-03-10 2:09 ` Jiufu Guo
2022-03-10 7:09 ` Richard Biener
2022-03-11 6:33 ` Jiufu Guo
2022-02-22 17:30 ` Segher Boessenkool
2022-02-23 3:31 ` guojiufu
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=h48bkywst7i.fsf@genoa.aus.stglabs.ibm.com \
--to=guojiufu@linux.ibm.com \
--cc=dje.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=jlaw@tachyum.com \
--cc=rguenther@suse.de \
--cc=segher@kernel.crashing.org \
--cc=wschmidt@linux.ibm.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).