From: Jiufu Guo <guojiufu@linux.ibm.com>
To: "Kewen.Lin" <linkw@linux.ibm.com>
Cc: segher@kernel.crashing.org, dje.gcc@gmail.com, linkw@gcc.gnu.org,
bergner@linux.ibm.com, gcc-patches@gcc.gnu.org
Subject: Re: [PATCH V2 2/3] Using pli to split 34bits constant
Date: Mon, 27 Nov 2023 10:49:04 +0800 [thread overview]
Message-ID: <h48zfyzrjvj.fsf@genoa.aus.stglabs.ibm.com> (raw)
In-Reply-To: <9771ca52-70db-b675-9de2-3d452234f068@linux.ibm.com> (Kewen Lin's message of "Wed, 22 Nov 2023 17:18:46 +0800")
Hi,
"Kewen.Lin" <linkw@linux.ibm.com> writes:
> Hi,
>
> on 2023/11/15 11:02, Jiufu Guo wrote:
>> Hi,
>>
>> For constants with 16bit values, 'li or lis' can be used to generate
>> the value. For 34bit constant, 'pli' is ok to generate the value.
>> For example: 0x6666666666666666ULL, "pli 3,1717986918; rldimi 3,3,32,0"
>> can be used.
>
> Since now if emit_move_insn with a 34bit constant, it's already adopting
> pli. So it's not obvious to the readers why we want this change, I think
> you should probably state the reason here explicitly, like in function
> rs6000_emit_set_long_const it's possible to recursively call itself without
> invoking emit_move_insn, then it can result in sub-optimal constant build ...
> And for the testing I prefer to have a dedicated test case for it, like
> extracting function msk66 from pr93012.c and checking its generated assembly
> has pli but not lis and ori on Power10 and up.
I would update the message to make it clear.
Thanks so much for your suggestions!
BR,
Jeff (Jiufu Guo)
>
> The others look good to me. Thanks!
>
> BR,
> Kewen
>
>>
>> Compare with previous:
>> https://gcc.gnu.org/pipermail/gcc-patches/2023-October/634196.html
>> This verion updates a testcase to cover this functionality.
>>
>> Bootstrap®test pass on ppc64{,le}.
>> Is this ok for trunk?
>>
>> BR,
>> Jeff (Jiufu Guo)
>>
>> gcc/ChangeLog:
>>
>> * config/rs6000/rs6000.cc (rs6000_emit_set_long_const): Add code to use
>> pli for 34bit constant.
>>
>> gcc/testsuite/ChangeLog:
>>
>> * gcc.target/powerpc/pr93012.c: Update to check pli.
>>
>> ---
>> gcc/config/rs6000/rs6000.cc | 9 +++++++++
>> gcc/testsuite/gcc.target/powerpc/pr93012.c | 1 +
>> 2 files changed, 10 insertions(+)
>>
>> diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
>> index ba40dd6eee4..b277c52687b 100644
>> --- a/gcc/config/rs6000/rs6000.cc
>> +++ b/gcc/config/rs6000/rs6000.cc
>> @@ -10504,6 +10504,15 @@ rs6000_emit_set_long_const (rtx dest, HOST_WIDE_INT c, int *num_insns)
>> return; \
>> }
>>
>> + if (TARGET_PREFIXED && SIGNED_INTEGER_34BIT_P (c))
>> + {
>> + /* li/lis/pli */
>> + ADJUST_INSN_NUM_AND_RET (1);
>> +
>> + emit_move_insn (dest, GEN_INT (c));
>> + return;
>> + }
>> +
>> if ((ud4 == 0xffff && ud3 == 0xffff && ud2 == 0xffff && (ud1 & 0x8000))
>> || (ud4 == 0 && ud3 == 0 && ud2 == 0 && !(ud1 & 0x8000)))
>> {
>> diff --git a/gcc/testsuite/gcc.target/powerpc/pr93012.c b/gcc/testsuite/gcc.target/powerpc/pr93012.c
>> index 4f764d0576f..a07ff764bbf 100644
>> --- a/gcc/testsuite/gcc.target/powerpc/pr93012.c
>> +++ b/gcc/testsuite/gcc.target/powerpc/pr93012.c
>> @@ -10,4 +10,5 @@ unsigned long long mskh1() { return 0xffff9234ffff9234ULL; }
>> unsigned long long mskl1() { return 0x2bcdffff2bcdffffULL; }
>> unsigned long long mskse() { return 0xffff1234ffff1234ULL; }
>>
>> +/* { dg-final { scan-assembler-times {\mpli\M} 4 { target has_arch_pwr10 }} } */
>> /* { dg-final { scan-assembler-times {\mrldimi\M} 7 } } */
next prev parent reply other threads:[~2023-11-27 2:49 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-11-15 3:02 [PATCH V2 1/3]rs6000: update num_insns_constant for 2 insns Jiufu Guo
2023-11-15 3:02 ` [PATCH V2 2/3] Using pli to split 34bits constant Jiufu Guo
2023-11-22 9:18 ` Kewen.Lin
2023-11-27 2:49 ` Jiufu Guo [this message]
2023-11-15 3:02 ` [PATCH V2 3/3] split complicate constant to memory Jiufu Guo
2023-11-22 9:12 ` [PATCH V2 1/3]rs6000: update num_insns_constant for 2 insns Kewen.Lin
2023-11-27 2:59 ` Jiufu Guo
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=h48zfyzrjvj.fsf@genoa.aus.stglabs.ibm.com \
--to=guojiufu@linux.ibm.com \
--cc=bergner@linux.ibm.com \
--cc=dje.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=linkw@gcc.gnu.org \
--cc=linkw@linux.ibm.com \
--cc=segher@kernel.crashing.org \
/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).