From: Jiufu Guo <guojiufu@linux.ibm.com>
To: Jiufu Guo via Gcc-patches <gcc-patches@gcc.gnu.org>
Cc: "Kewen.Lin" <linkw@linux.ibm.com>,
segher@kernel.crashing.org, dje.gcc@gmail.com, linkw@gcc.gnu.org
Subject: Re: [PATCH]rs6000: Load high and low part of 64bit constant independently
Date: Fri, 25 Nov 2022 21:31:47 +0800 [thread overview]
Message-ID: <7er0xrp3cs.fsf@pike.rch.stglabs.ibm.com> (raw)
In-Reply-To: <7ev8n3p3u6.fsf@pike.rch.stglabs.ibm.com> (Jiufu Guo via Gcc-patches's message of "Fri, 25 Nov 2022 21:21:21 +0800")
Jiufu Guo via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> Hi Kewen,
>
> Thanks for your review on this patch!
>
> "Kewen.Lin" <linkw@linux.ibm.com> writes:
>
>> Hi Jeff,
>>
>> Sorry for the late review.
>>
>> on 2022/9/15 16:30, Jiufu Guo wrote:
>>> Hi,
>>>
>>> For a complicate 64bit constant, blow is one instruction-sequence to
>>> build:
>>> lis 9,0x800a
>>> ori 9,9,0xabcd
>>> sldi 9,9,32
>>> oris 9,9,0xc167
>>> ori 9,9,0xfa16
>>>
>>> while we can also use below sequence to build:
>>> lis 9,0xc167
>>> lis 10,0x800a
>>> ori 9,9,0xfa16
>>> ori 10,10,0xabcd
>>> rldimi 9,10,32,0
>>> This sequence is using 2 registers to build high and low part firstly,
>>> and then merge them.
>>> In parallel aspect, this sequence would be faster. (Ofcause, using 1 more
>>> register with potential register pressure).
>>>
>>> Bootstrap and regtest pass on ppc64le.
>>> Is this ok for trunk?
>>>
>>>
>>> BR,
>>> Jeff(Jiufu)
>>>
>>>
>>> gcc/ChangeLog:
>>>
>>> * config/rs6000/rs6000.cc (rs6000_emit_set_long_const): Update 64bit
>>> constant build.
>>>
>>> gcc/testsuite/ChangeLog:
>>>
>>> * gcc.target/powerpc/parall_5insn_const.c: New test.
>>>
>>> ---
cut...
> @@ -0,1 +1,27 @@
> +/* { dg-do run } */
> +/* { dg-options "-O2 -mdejagnu-cpu=power8 -save-temps" } */
maybe, I could use power7. Any comments?
> +/* { dg-require-effective-target has_arch_ppc64 } */
> +
> +/* { dg-final { scan-assembler-times {\mlis\M} 4 } } */
> +/* { dg-final { scan-assembler-times {\mori\M} 4 } } */
> +/* { dg-final { scan-assembler-times {\mrldimi\M} 2 } } */
> +
> +void __attribute__ ((noinline)) foo (unsigned long long *a)
> +{
> + /* 2 lis + 2 ori + 1 rldimi for each constant. */
> + *a++ = 0x800aabcdc167fa16ULL;
> + *a++ = 0x7543a876867f616ULL;
> +}
> +
> +long long A[] = {0x800aabcdc167fa16ULL, 0x7543a876867f616ULL};
> +int
> +main ()
> +{
> + long long res[2];
> +
> + foo (res);
> + if (__builtin_memcmp (res, A, sizeof (res)) != 0)
> + __builtin_abort ();
> +
> + return 0;
> +}
next prev parent reply other threads:[~2022-11-25 13:31 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-09-15 8:30 Jiufu Guo
2022-11-25 9:15 ` Kewen.Lin
2022-11-25 13:21 ` Jiufu Guo
2022-11-25 13:31 ` Jiufu Guo [this message]
2022-11-25 15:46 ` Segher Boessenkool
2022-11-27 13:09 ` Jiufu Guo
2022-11-28 1:50 ` Kewen.Lin
2022-11-28 2:35 ` 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=7er0xrp3cs.fsf@pike.rch.stglabs.ibm.com \
--to=guojiufu@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).