public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: luoxhu <luoxhu@linux.ibm.com>
To: Segher Boessenkool <segher@kernel.crashing.org>
Cc: gcc-patches@gcc.gnu.org, wschmidt@linux.ibm.com,
	guojiufu@linux.ibm.com, linkw@gcc.gnu.org
Subject: Re: [PATCH] rs6000: Don't split constant oprator when add, move to temp register for future optimization
Date: Fri, 3 Apr 2020 14:13:06 +0800	[thread overview]
Message-ID: <596ce54a-996c-3180-dbf1-df5e94ded4cb@linux.ibm.com> (raw)
In-Reply-To: <20200402221653.GG26902@gate.crashing.org>



On 2020/4/3 06:16, Segher Boessenkool wrote:
> Hi!
> 
> On Mon, Mar 30, 2020 at 11:59:57AM +0800, luoxhu wrote:
>>> Do we want something later in the RTL pipeline to make "addi"s etc. again?
> 
> (This would be a good thing to consider -- maybe a define_insn_and_split
> will work.  But see below).
> 
>> [PATCH] rs6000: Don't split constant operator add before reload, move to temp register for future optimization
>>
>> Don't split code from add<mode>3 for SDI to allow a later pass to split.
>> This allows later logic to hoist out constant load in add instructions.
>> In loop, lis+ori could be hoisted out to improve performance compared with
>> previous addis+addi (About 15% on typical case), weak point is
>> one more register is used and one more instruction is generated.  i.e.:
>>
>> addis 3,3,0x8765
>> addi 3,3,0x4321
>>
>> =>
>>
>> lis 9,0x8765
>> ori 9,9,0x4321
>> add 3,3,9
> 
> (This patch will of course have to wait for stage 1).
> 
> Such a define_insn_and_split could be for an add of a (signed) 32-bit
> immediate.  combine will try to combine the three insns (lis;ori;add),
> and match the new pattern.

Currently 286r.split2 will split "12:%9:DI=0x87654321" to lis+ori by
rs6000_emit_set_const of define_split, do you mean add new define_insn_and_split
to do the split?  Another patch to do this after this one goes upstream in stage 1?

> 
> This also links in with Alan's work on big immediates, and with paddi
> insns, etc.

Seems PR94393?  Yes, rs6000_emit_set_const calls rs6000_emit_set_long_const for DImode.
I tried unsigned long like 0xabcd87654321, 0xffffabcd87654321 and 0xc000000000000000ULL, 
All of them are outside of loop even without my patch.  No difference with or without
Alan's patch.

0xabcd87654321: li 9,0  ori 9,9,0xabcd  sldi 9,9,32   oris 9,9,0x8765    ori 9,9,0x4321
0xffffabcd87654321: lis 9,0xabcd   ori 9,9,0x8765     sldi 9,9,16     ori 9,9,0x4321
0xc000000000000000ULL:   li 9,-1   rldicr 9,9,0,1


Thanks,
Xionghu

> 
> 
> Segher
> 


  reply	other threads:[~2020-04-03  6:13 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-26 10:06 luoxhu
2020-03-26 15:18 ` will schmidt
2020-03-27 14:33 ` Segher Boessenkool
2020-03-30  3:59   ` luoxhu
2020-04-02 22:16     ` Segher Boessenkool
2020-04-03  6:13       ` luoxhu [this message]
2020-04-03 12:13         ` Alan Modra
2020-04-03 21:11           ` Segher Boessenkool
2020-04-03 23:51             ` Alan Modra
2020-04-07 21:47               ` Segher Boessenkool
2020-04-03 21:08         ` Segher Boessenkool

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=596ce54a-996c-3180-dbf1-df5e94ded4cb@linux.ibm.com \
    --to=luoxhu@linux.ibm.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=guojiufu@linux.ibm.com \
    --cc=linkw@gcc.gnu.org \
    --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).