* [PATCH V4 1/2] rs6000: use li;x?oris to build constant
@ 2022-12-12 1:38 Jiufu Guo
2022-12-12 1:38 ` [PATCH V4 2/2] " Jiufu Guo
` (2 more replies)
0 siblings, 3 replies; 12+ messages in thread
From: Jiufu Guo @ 2022-12-12 1:38 UTC (permalink / raw)
To: gcc-patches; +Cc: segher, dje.gcc, linkw, guojiufu
Hi,
For constant C:
If '(c & 0xFFFFFFFF00008000ULL) == 0xFFFFFFFF00008000ULL' or say:
32(1) || 16(x) || 1(1) || 15(x), using "li; xoris" would be ok.
If '(c & 0xFFFFFFFF80008000ULL) == 0x80000000ULL' or say:
32(0) || 1(1) || 15(x) || 1(0) || 15(x), we could use "li; oris" to
build constant 'C'.
Here N(M) means N continuous bit M, x for M means it is ok for either
1 or 0; '||' means concatenation.
This patch update rs6000_emit_set_long_const to support those constants.
Compare with previous version, this patch fixes conflicts with trunk.
and put li;x?oris as the first patch (lis;xoris as the second patch).
Previous version:
https://gcc.gnu.org/pipermail/gcc-patches/2022-December/607618.html
Bootstrap and regtest pass on ppc64{,le}.
Is this ok for trunk?
BR,
Jeff (Jiufu)
PR target/106708
gcc/ChangeLog:
* config/rs6000/rs6000.cc (rs6000_emit_set_long_const): Add using
"li; x?oris" to build constant.
gcc/testsuite/ChangeLog:
* gcc.target/powerpc/pr106708.c: New test.
---
gcc/config/rs6000/rs6000.cc | 36 +++++++++++++++---
gcc/testsuite/gcc.target/powerpc/pr106708.c | 41 +++++++++++++++++++++
2 files changed, 71 insertions(+), 6 deletions(-)
create mode 100644 gcc/testsuite/gcc.target/powerpc/pr106708.c
diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index b3a609f3aa3..8c1192a10c8 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -10251,17 +10251,41 @@ rs6000_emit_set_long_const (rtx dest, HOST_WIDE_INT c)
if (ud1 != 0)
emit_move_insn (dest, gen_rtx_IOR (DImode, temp, GEN_INT (ud1)));
}
+ else if (ud4 == 0xffff && ud3 == 0xffff && (ud1 & 0x8000))
+ {
+ /* li; xoris */
+ temp = !can_create_pseudo_p () ? dest : gen_reg_rtx (DImode);
+ emit_move_insn (temp, GEN_INT (sext_hwi (ud1, 16)));
+ emit_move_insn (dest, gen_rtx_XOR (DImode, temp,
+ GEN_INT ((ud2 ^ 0xffff) << 16)));
+ }
else if (ud3 == 0 && ud4 == 0)
{
temp = !can_create_pseudo_p () ? dest : gen_reg_rtx (DImode);
gcc_assert (ud2 & 0x8000);
- emit_move_insn (temp, GEN_INT (sext_hwi (ud2 << 16, 32)));
- if (ud1 != 0)
- emit_move_insn (temp, gen_rtx_IOR (DImode, temp, GEN_INT (ud1)));
- emit_move_insn (dest,
- gen_rtx_ZERO_EXTEND (DImode,
- gen_lowpart (SImode,temp)));
+
+ if (ud1 == 0)
+ {
+ /* lis; rldicl */
+ emit_move_insn (temp, GEN_INT (sext_hwi (ud2 << 16, 32)));
+ emit_move_insn (dest,
+ gen_rtx_AND (DImode, temp, GEN_INT (0xffffffff)));
+ }
+ else if (!(ud1 & 0x8000))
+ {
+ /* li; oris */
+ emit_move_insn (temp, GEN_INT (ud1));
+ emit_move_insn (dest,
+ gen_rtx_IOR (DImode, temp, GEN_INT (ud2 << 16)));
+ }
+ else
+ {
+ emit_move_insn (temp, GEN_INT (sext_hwi (ud2 << 16, 32)));
+ emit_move_insn (temp, gen_rtx_IOR (DImode, temp, GEN_INT (ud1)));
+ emit_move_insn (dest,
+ gen_rtx_AND (DImode, temp, GEN_INT (0xffffffff)));
+ }
}
else if (ud1 == ud3 && ud2 == ud4)
{
diff --git a/gcc/testsuite/gcc.target/powerpc/pr106708.c b/gcc/testsuite/gcc.target/powerpc/pr106708.c
new file mode 100644
index 00000000000..dc9ceda8367
--- /dev/null
+++ b/gcc/testsuite/gcc.target/powerpc/pr106708.c
@@ -0,0 +1,41 @@
+/* PR target/106708 */
+/* { dg-do run } */
+/* { dg-options "-O2 -mno-prefixed -save-temps" } */
+/* { dg-require-effective-target has_arch_ppc64 } */
+
+long long arr[]
+ = {0xffffffff7cdeab55LL, 0x98765432LL, 0xabcd0000LL};
+
+void __attribute__ ((__noipa__)) lixoris (long long *arg)
+{
+ *arg = 0xffffffff7cdeab55LL;
+}
+/* { dg-final { scan-assembler-times {\mli .*,-21675\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mxoris .*0x8321\M} 1 } } */
+
+void __attribute__ ((__noipa__)) lioris (long long *arg)
+{
+ *arg = 0x98765432LL;
+}
+/* { dg-final { scan-assembler-times {\mli .*,21554\M} 1 } } */
+/* { dg-final { scan-assembler-times {\moris .*0x9876\M} 1 } } */
+
+void __attribute__ ((__noipa__)) lisrldicl (long long *arg)
+{
+ *arg = 0xabcd0000LL;
+}
+/* { dg-final { scan-assembler-times {\mlis .*,0xabcd\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mrldicl .*,0,32\M} 1 } } */
+
+int
+main ()
+{
+ long long a[sizeof (arr) / sizeof (arr[0])];
+
+ lixoris (a);
+ lioris (a + 1);
+ lisrldicl (a + 2);
+ if (__builtin_memcmp (a, arr, sizeof (arr)) != 0)
+ __builtin_abort ();
+ return 0;
+}
--
2.17.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* [PATCH V4 2/2] rs6000: use li;x?oris to build constant
2022-12-12 1:38 [PATCH V4 1/2] rs6000: use li;x?oris to build constant Jiufu Guo
@ 2022-12-12 1:38 ` Jiufu Guo
2023-01-04 6:11 ` Jiufu Guo
2023-05-15 6:53 ` Kewen.Lin
2022-12-14 10:27 ` [PATCH V4 1/2] " Kewen.Lin
2022-12-16 21:16 ` Segher Boessenkool
2 siblings, 2 replies; 12+ messages in thread
From: Jiufu Guo @ 2022-12-12 1:38 UTC (permalink / raw)
To: gcc-patches; +Cc: segher, dje.gcc, linkw, guojiufu
Hi,
For constant C:
If '(c & 0xFFFFFFFF0000FFFFULL) == 0xFFFFFFFF00000000' or say:
32(1) || 1(0) || 15(x) || 16(0), we could use "lis; xoris" to build.
Here N(M) means N continuous bit M, x for M means it is ok for either
1 or 0; '||' means concatenation.
This patch update rs6000_emit_set_long_const to support those constants.
Compare with previous version:
https://gcc.gnu.org/pipermail/gcc-patches/2022-December/607618.htm
This patch fix conflicts with trunk.
Bootstrap and regtest pass on ppc64{,le}.
Is this ok for trunk?
BR,
Jeff (Jiufu)
PR target/106708
gcc/ChangeLog:
* config/rs6000/rs6000.cc (rs6000_emit_set_long_const): Add to build
constants through "lis; xoris".
gcc/testsuite/ChangeLog:
* gcc.target/powerpc/pr106708.c: Add test function.
---
gcc/config/rs6000/rs6000.cc | 7 +++++++
gcc/testsuite/gcc.target/powerpc/pr106708.c | 10 +++++++++-
2 files changed, 16 insertions(+), 1 deletion(-)
diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 8c1192a10c8..1138d5e8cd4 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -10251,6 +10251,13 @@ rs6000_emit_set_long_const (rtx dest, HOST_WIDE_INT c)
if (ud1 != 0)
emit_move_insn (dest, gen_rtx_IOR (DImode, temp, GEN_INT (ud1)));
}
+ else if (ud4 == 0xffff && ud3 == 0xffff && !(ud2 & 0x8000) && ud1 == 0)
+ {
+ /* lis; xoris */
+ temp = !can_create_pseudo_p () ? dest : gen_reg_rtx (DImode);
+ emit_move_insn (temp, GEN_INT (sext_hwi ((ud2 | 0x8000) << 16, 32)));
+ emit_move_insn (dest, gen_rtx_XOR (DImode, temp, GEN_INT (0x80000000)));
+ }
else if (ud4 == 0xffff && ud3 == 0xffff && (ud1 & 0x8000))
{
/* li; xoris */
diff --git a/gcc/testsuite/gcc.target/powerpc/pr106708.c b/gcc/testsuite/gcc.target/powerpc/pr106708.c
index dc9ceda8367..a015c71e630 100644
--- a/gcc/testsuite/gcc.target/powerpc/pr106708.c
+++ b/gcc/testsuite/gcc.target/powerpc/pr106708.c
@@ -4,7 +4,7 @@
/* { dg-require-effective-target has_arch_ppc64 } */
long long arr[]
- = {0xffffffff7cdeab55LL, 0x98765432LL, 0xabcd0000LL};
+= {0xffffffff7cdeab55LL, 0x98765432LL, 0xabcd0000LL, 0xffffffff65430000LL};
void __attribute__ ((__noipa__)) lixoris (long long *arg)
{
@@ -27,6 +27,13 @@ void __attribute__ ((__noipa__)) lisrldicl (long long *arg)
/* { dg-final { scan-assembler-times {\mlis .*,0xabcd\M} 1 } } */
/* { dg-final { scan-assembler-times {\mrldicl .*,0,32\M} 1 } } */
+void __attribute__ ((__noipa__)) lisxoris (long long *arg)
+{
+ *arg = 0xffffffff65430000LL;
+}
+/* { dg-final { scan-assembler-times {\mlis .*,0xe543\M} 1 } } */
+/* { dg-final { scan-assembler-times {\mxoris .*0x8000\M} 1 } } */
+
int
main ()
{
@@ -35,6 +42,7 @@ main ()
lixoris (a);
lioris (a + 1);
lisrldicl (a + 2);
+ lisxoris (a + 3);
if (__builtin_memcmp (a, arr, sizeof (arr)) != 0)
__builtin_abort ();
return 0;
--
2.17.1
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH V4 2/2] rs6000: use li;x?oris to build constant
2022-12-12 1:38 ` [PATCH V4 2/2] " Jiufu Guo
@ 2023-01-04 6:11 ` Jiufu Guo
2023-02-20 4:41 ` Ping^^ " Jiufu Guo
2023-05-15 6:53 ` Kewen.Lin
1 sibling, 1 reply; 12+ messages in thread
From: Jiufu Guo @ 2023-01-04 6:11 UTC (permalink / raw)
To: gcc-patches; +Cc: segher, dje.gcc, linkw
Hi,
I would like to have a ping on this patch:
https://gcc.gnu.org/pipermail/gcc-patches/2022-December/608292.html
BR,
Jeff (Jiufu)
Jiufu Guo <guojiufu@linux.ibm.com> writes:
> Hi,
>
> For constant C:
> If '(c & 0xFFFFFFFF0000FFFFULL) == 0xFFFFFFFF00000000' or say:
> 32(1) || 1(0) || 15(x) || 16(0), we could use "lis; xoris" to build.
>
> Here N(M) means N continuous bit M, x for M means it is ok for either
> 1 or 0; '||' means concatenation.
>
> This patch update rs6000_emit_set_long_const to support those constants.
>
> Compare with previous version:
> https://gcc.gnu.org/pipermail/gcc-patches/2022-December/607618.htm
> This patch fix conflicts with trunk.
>
> Bootstrap and regtest pass on ppc64{,le}.
>
> Is this ok for trunk?
>
> BR,
> Jeff (Jiufu)
>
>
> PR target/106708
>
> gcc/ChangeLog:
>
> * config/rs6000/rs6000.cc (rs6000_emit_set_long_const): Add to build
> constants through "lis; xoris".
>
> gcc/testsuite/ChangeLog:
>
> * gcc.target/powerpc/pr106708.c: Add test function.
>
> ---
> gcc/config/rs6000/rs6000.cc | 7 +++++++
> gcc/testsuite/gcc.target/powerpc/pr106708.c | 10 +++++++++-
> 2 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
> index 8c1192a10c8..1138d5e8cd4 100644
> --- a/gcc/config/rs6000/rs6000.cc
> +++ b/gcc/config/rs6000/rs6000.cc
> @@ -10251,6 +10251,13 @@ rs6000_emit_set_long_const (rtx dest, HOST_WIDE_INT c)
> if (ud1 != 0)
> emit_move_insn (dest, gen_rtx_IOR (DImode, temp, GEN_INT (ud1)));
> }
> + else if (ud4 == 0xffff && ud3 == 0xffff && !(ud2 & 0x8000) && ud1 == 0)
> + {
> + /* lis; xoris */
> + temp = !can_create_pseudo_p () ? dest : gen_reg_rtx (DImode);
> + emit_move_insn (temp, GEN_INT (sext_hwi ((ud2 | 0x8000) << 16, 32)));
> + emit_move_insn (dest, gen_rtx_XOR (DImode, temp, GEN_INT (0x80000000)));
> + }
> else if (ud4 == 0xffff && ud3 == 0xffff && (ud1 & 0x8000))
> {
> /* li; xoris */
> diff --git a/gcc/testsuite/gcc.target/powerpc/pr106708.c b/gcc/testsuite/gcc.target/powerpc/pr106708.c
> index dc9ceda8367..a015c71e630 100644
> --- a/gcc/testsuite/gcc.target/powerpc/pr106708.c
> +++ b/gcc/testsuite/gcc.target/powerpc/pr106708.c
> @@ -4,7 +4,7 @@
> /* { dg-require-effective-target has_arch_ppc64 } */
>
> long long arr[]
> - = {0xffffffff7cdeab55LL, 0x98765432LL, 0xabcd0000LL};
> += {0xffffffff7cdeab55LL, 0x98765432LL, 0xabcd0000LL, 0xffffffff65430000LL};
>
> void __attribute__ ((__noipa__)) lixoris (long long *arg)
> {
> @@ -27,6 +27,13 @@ void __attribute__ ((__noipa__)) lisrldicl (long long *arg)
> /* { dg-final { scan-assembler-times {\mlis .*,0xabcd\M} 1 } } */
> /* { dg-final { scan-assembler-times {\mrldicl .*,0,32\M} 1 } } */
>
> +void __attribute__ ((__noipa__)) lisxoris (long long *arg)
> +{
> + *arg = 0xffffffff65430000LL;
> +}
> +/* { dg-final { scan-assembler-times {\mlis .*,0xe543\M} 1 } } */
> +/* { dg-final { scan-assembler-times {\mxoris .*0x8000\M} 1 } } */
> +
> int
> main ()
> {
> @@ -35,6 +42,7 @@ main ()
> lixoris (a);
> lioris (a + 1);
> lisrldicl (a + 2);
> + lisxoris (a + 3);
> if (__builtin_memcmp (a, arr, sizeof (arr)) != 0)
> __builtin_abort ();
> return 0;
^ permalink raw reply [flat|nested] 12+ messages in thread
* Ping^^ [PATCH V4 2/2] rs6000: use li;x?oris to build constant
2023-01-04 6:11 ` Jiufu Guo
@ 2023-02-20 4:41 ` Jiufu Guo
2023-04-26 2:35 ` Ping^^^ " Jiufu Guo
0 siblings, 1 reply; 12+ messages in thread
From: Jiufu Guo @ 2023-02-20 4:41 UTC (permalink / raw)
To: Jiufu Guo via Gcc-patches; +Cc: segher, dje.gcc, linkw
Hi,
Gentle ping:
https://gcc.gnu.org/pipermail/gcc-patches/2022-December/608292.html
BR,
Jeff (Jiufu)
Jiufu Guo via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> Hi,
>
> I would like to have a ping on this patch:
> https://gcc.gnu.org/pipermail/gcc-patches/2022-December/608292.html
>
>
> BR,
> Jeff (Jiufu)
>
>
> Jiufu Guo <guojiufu@linux.ibm.com> writes:
>
>> Hi,
>>
>> For constant C:
>> If '(c & 0xFFFFFFFF0000FFFFULL) == 0xFFFFFFFF00000000' or say:
>> 32(1) || 1(0) || 15(x) || 16(0), we could use "lis; xoris" to build.
>>
>> Here N(M) means N continuous bit M, x for M means it is ok for either
>> 1 or 0; '||' means concatenation.
>>
>> This patch update rs6000_emit_set_long_const to support those constants.
>>
>> Compare with previous version:
>> https://gcc.gnu.org/pipermail/gcc-patches/2022-December/607618.htm
>> This patch fix conflicts with trunk.
>>
>> Bootstrap and regtest pass on ppc64{,le}.
>>
>> Is this ok for trunk?
>>
>> BR,
>> Jeff (Jiufu)
>>
>>
>> PR target/106708
>>
>> gcc/ChangeLog:
>>
>> * config/rs6000/rs6000.cc (rs6000_emit_set_long_const): Add to build
>> constants through "lis; xoris".
>>
>> gcc/testsuite/ChangeLog:
>>
>> * gcc.target/powerpc/pr106708.c: Add test function.
>>
>> ---
>> gcc/config/rs6000/rs6000.cc | 7 +++++++
>> gcc/testsuite/gcc.target/powerpc/pr106708.c | 10 +++++++++-
>> 2 files changed, 16 insertions(+), 1 deletion(-)
>>
>> diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
>> index 8c1192a10c8..1138d5e8cd4 100644
>> --- a/gcc/config/rs6000/rs6000.cc
>> +++ b/gcc/config/rs6000/rs6000.cc
>> @@ -10251,6 +10251,13 @@ rs6000_emit_set_long_const (rtx dest, HOST_WIDE_INT c)
>> if (ud1 != 0)
>> emit_move_insn (dest, gen_rtx_IOR (DImode, temp, GEN_INT (ud1)));
>> }
>> + else if (ud4 == 0xffff && ud3 == 0xffff && !(ud2 & 0x8000) && ud1 == 0)
>> + {
>> + /* lis; xoris */
>> + temp = !can_create_pseudo_p () ? dest : gen_reg_rtx (DImode);
>> + emit_move_insn (temp, GEN_INT (sext_hwi ((ud2 | 0x8000) << 16, 32)));
>> + emit_move_insn (dest, gen_rtx_XOR (DImode, temp, GEN_INT (0x80000000)));
>> + }
>> else if (ud4 == 0xffff && ud3 == 0xffff && (ud1 & 0x8000))
>> {
>> /* li; xoris */
>> diff --git a/gcc/testsuite/gcc.target/powerpc/pr106708.c b/gcc/testsuite/gcc.target/powerpc/pr106708.c
>> index dc9ceda8367..a015c71e630 100644
>> --- a/gcc/testsuite/gcc.target/powerpc/pr106708.c
>> +++ b/gcc/testsuite/gcc.target/powerpc/pr106708.c
>> @@ -4,7 +4,7 @@
>> /* { dg-require-effective-target has_arch_ppc64 } */
>>
>> long long arr[]
>> - = {0xffffffff7cdeab55LL, 0x98765432LL, 0xabcd0000LL};
>> += {0xffffffff7cdeab55LL, 0x98765432LL, 0xabcd0000LL, 0xffffffff65430000LL};
>>
>> void __attribute__ ((__noipa__)) lixoris (long long *arg)
>> {
>> @@ -27,6 +27,13 @@ void __attribute__ ((__noipa__)) lisrldicl (long long *arg)
>> /* { dg-final { scan-assembler-times {\mlis .*,0xabcd\M} 1 } } */
>> /* { dg-final { scan-assembler-times {\mrldicl .*,0,32\M} 1 } } */
>>
>> +void __attribute__ ((__noipa__)) lisxoris (long long *arg)
>> +{
>> + *arg = 0xffffffff65430000LL;
>> +}
>> +/* { dg-final { scan-assembler-times {\mlis .*,0xe543\M} 1 } } */
>> +/* { dg-final { scan-assembler-times {\mxoris .*0x8000\M} 1 } } */
>> +
>> int
>> main ()
>> {
>> @@ -35,6 +42,7 @@ main ()
>> lixoris (a);
>> lioris (a + 1);
>> lisrldicl (a + 2);
>> + lisxoris (a + 3);
>> if (__builtin_memcmp (a, arr, sizeof (arr)) != 0)
>> __builtin_abort ();
>> return 0;
^ permalink raw reply [flat|nested] 12+ messages in thread
* Ping^^^ [PATCH V4 2/2] rs6000: use li;x?oris to build constant
2023-02-20 4:41 ` Ping^^ " Jiufu Guo
@ 2023-04-26 2:35 ` Jiufu Guo
0 siblings, 0 replies; 12+ messages in thread
From: Jiufu Guo @ 2023-04-26 2:35 UTC (permalink / raw)
To: Jiufu Guo via Gcc-patches; +Cc: segher, dje.gcc, linkw
Hi,
I would like to have a gentle ping for this.
https://gcc.gnu.org/pipermail/gcc-patches/2022-December/608292.html
BR,
Jeff (Jiufu)
Jiufu Guo via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
> Hi,
>
> Gentle ping:
> https://gcc.gnu.org/pipermail/gcc-patches/2022-December/608292.html
>
> BR,
> Jeff (Jiufu)
>
>
> Jiufu Guo via Gcc-patches <gcc-patches@gcc.gnu.org> writes:
>
>> Hi,
>>
>> I would like to have a ping on this patch:
>> https://gcc.gnu.org/pipermail/gcc-patches/2022-December/608292.html
>>
>>
>> BR,
>> Jeff (Jiufu)
>>
>>
>> Jiufu Guo <guojiufu@linux.ibm.com> writes:
>>
>>> Hi,
>>>
>>> For constant C:
>>> If '(c & 0xFFFFFFFF0000FFFFULL) == 0xFFFFFFFF00000000' or say:
>>> 32(1) || 1(0) || 15(x) || 16(0), we could use "lis; xoris" to build.
>>>
>>> Here N(M) means N continuous bit M, x for M means it is ok for either
>>> 1 or 0; '||' means concatenation.
>>>
>>> This patch update rs6000_emit_set_long_const to support those constants.
>>>
>>> Compare with previous version:
>>> https://gcc.gnu.org/pipermail/gcc-patches/2022-December/607618.htm
>>> This patch fix conflicts with trunk.
>>>
>>> Bootstrap and regtest pass on ppc64{,le}.
>>>
>>> Is this ok for trunk?
>>>
>>> BR,
>>> Jeff (Jiufu)
>>>
>>>
>>> PR target/106708
>>>
>>> gcc/ChangeLog:
>>>
>>> * config/rs6000/rs6000.cc (rs6000_emit_set_long_const): Add to build
>>> constants through "lis; xoris".
>>>
>>> gcc/testsuite/ChangeLog:
>>>
>>> * gcc.target/powerpc/pr106708.c: Add test function.
>>>
>>> ---
>>> gcc/config/rs6000/rs6000.cc | 7 +++++++
>>> gcc/testsuite/gcc.target/powerpc/pr106708.c | 10 +++++++++-
>>> 2 files changed, 16 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
>>> index 8c1192a10c8..1138d5e8cd4 100644
>>> --- a/gcc/config/rs6000/rs6000.cc
>>> +++ b/gcc/config/rs6000/rs6000.cc
>>> @@ -10251,6 +10251,13 @@ rs6000_emit_set_long_const (rtx dest, HOST_WIDE_INT c)
>>> if (ud1 != 0)
>>> emit_move_insn (dest, gen_rtx_IOR (DImode, temp, GEN_INT (ud1)));
>>> }
>>> + else if (ud4 == 0xffff && ud3 == 0xffff && !(ud2 & 0x8000) && ud1 == 0)
>>> + {
>>> + /* lis; xoris */
>>> + temp = !can_create_pseudo_p () ? dest : gen_reg_rtx (DImode);
>>> + emit_move_insn (temp, GEN_INT (sext_hwi ((ud2 | 0x8000) << 16, 32)));
>>> + emit_move_insn (dest, gen_rtx_XOR (DImode, temp, GEN_INT (0x80000000)));
>>> + }
>>> else if (ud4 == 0xffff && ud3 == 0xffff && (ud1 & 0x8000))
>>> {
>>> /* li; xoris */
>>> diff --git a/gcc/testsuite/gcc.target/powerpc/pr106708.c b/gcc/testsuite/gcc.target/powerpc/pr106708.c
>>> index dc9ceda8367..a015c71e630 100644
>>> --- a/gcc/testsuite/gcc.target/powerpc/pr106708.c
>>> +++ b/gcc/testsuite/gcc.target/powerpc/pr106708.c
>>> @@ -4,7 +4,7 @@
>>> /* { dg-require-effective-target has_arch_ppc64 } */
>>>
>>> long long arr[]
>>> - = {0xffffffff7cdeab55LL, 0x98765432LL, 0xabcd0000LL};
>>> += {0xffffffff7cdeab55LL, 0x98765432LL, 0xabcd0000LL, 0xffffffff65430000LL};
>>>
>>> void __attribute__ ((__noipa__)) lixoris (long long *arg)
>>> {
>>> @@ -27,6 +27,13 @@ void __attribute__ ((__noipa__)) lisrldicl (long long *arg)
>>> /* { dg-final { scan-assembler-times {\mlis .*,0xabcd\M} 1 } } */
>>> /* { dg-final { scan-assembler-times {\mrldicl .*,0,32\M} 1 } } */
>>>
>>> +void __attribute__ ((__noipa__)) lisxoris (long long *arg)
>>> +{
>>> + *arg = 0xffffffff65430000LL;
>>> +}
>>> +/* { dg-final { scan-assembler-times {\mlis .*,0xe543\M} 1 } } */
>>> +/* { dg-final { scan-assembler-times {\mxoris .*0x8000\M} 1 } } */
>>> +
>>> int
>>> main ()
>>> {
>>> @@ -35,6 +42,7 @@ main ()
>>> lixoris (a);
>>> lioris (a + 1);
>>> lisrldicl (a + 2);
>>> + lisxoris (a + 3);
>>> if (__builtin_memcmp (a, arr, sizeof (arr)) != 0)
>>> __builtin_abort ();
>>> return 0;
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH V4 2/2] rs6000: use li;x?oris to build constant
2022-12-12 1:38 ` [PATCH V4 2/2] " Jiufu Guo
2023-01-04 6:11 ` Jiufu Guo
@ 2023-05-15 6:53 ` Kewen.Lin
2023-05-17 2:17 ` guojiufu
1 sibling, 1 reply; 12+ messages in thread
From: Kewen.Lin @ 2023-05-15 6:53 UTC (permalink / raw)
To: Jiufu Guo; +Cc: segher, dje.gcc, linkw, gcc-patches
Hi Jeff,
on 2022/12/12 09:38, Jiufu Guo wrote:
> Hi,
>
> For constant C:
> If '(c & 0xFFFFFFFF0000FFFFULL) == 0xFFFFFFFF00000000' or say:
> 32(1) || 1(0) || 15(x) || 16(0), we could use "lis; xoris" to build.
>
> Here N(M) means N continuous bit M, x for M means it is ok for either
> 1 or 0; '||' means concatenation.
>
> This patch update rs6000_emit_set_long_const to support those constants.
>
> Compare with previous version:
> https://gcc.gnu.org/pipermail/gcc-patches/2022-December/607618.htm
> This patch fix conflicts with trunk.
>
> Bootstrap and regtest pass on ppc64{,le}.
>
> Is this ok for trunk?
OK for trunk, thanks for improving this.
btw, the test case needs to be updated a bit as the function names in the
context changed upstream, please ensure it's tested well before committing,
thanks!
>
> BR,
> Jeff (Jiufu)
>
>
> PR target/106708
>
> gcc/ChangeLog:
>
> * config/rs6000/rs6000.cc (rs6000_emit_set_long_const): Add to build
> constants through "lis; xoris".
Maybe s/Add to build/Support building/
BR,
Kewen
>
> gcc/testsuite/ChangeLog:
>
> * gcc.target/powerpc/pr106708.c: Add test function.
>
> ---
> gcc/config/rs6000/rs6000.cc | 7 +++++++
> gcc/testsuite/gcc.target/powerpc/pr106708.c | 10 +++++++++-
> 2 files changed, 16 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
> index 8c1192a10c8..1138d5e8cd4 100644
> --- a/gcc/config/rs6000/rs6000.cc
> +++ b/gcc/config/rs6000/rs6000.cc
> @@ -10251,6 +10251,13 @@ rs6000_emit_set_long_const (rtx dest, HOST_WIDE_INT c)
> if (ud1 != 0)
> emit_move_insn (dest, gen_rtx_IOR (DImode, temp, GEN_INT (ud1)));
> }
> + else if (ud4 == 0xffff && ud3 == 0xffff && !(ud2 & 0x8000) && ud1 == 0)
> + {
> + /* lis; xoris */
> + temp = !can_create_pseudo_p () ? dest : gen_reg_rtx (DImode);
> + emit_move_insn (temp, GEN_INT (sext_hwi ((ud2 | 0x8000) << 16, 32)));
> + emit_move_insn (dest, gen_rtx_XOR (DImode, temp, GEN_INT (0x80000000)));
> + }
> else if (ud4 == 0xffff && ud3 == 0xffff && (ud1 & 0x8000))
> {
> /* li; xoris */
> diff --git a/gcc/testsuite/gcc.target/powerpc/pr106708.c b/gcc/testsuite/gcc.target/powerpc/pr106708.c
> index dc9ceda8367..a015c71e630 100644
> --- a/gcc/testsuite/gcc.target/powerpc/pr106708.c
> +++ b/gcc/testsuite/gcc.target/powerpc/pr106708.c
> @@ -4,7 +4,7 @@
> /* { dg-require-effective-target has_arch_ppc64 } */
>
> long long arr[]
> - = {0xffffffff7cdeab55LL, 0x98765432LL, 0xabcd0000LL};
> += {0xffffffff7cdeab55LL, 0x98765432LL, 0xabcd0000LL, 0xffffffff65430000LL};
>
> void __attribute__ ((__noipa__)) lixoris (long long *arg)
> {
> @@ -27,6 +27,13 @@ void __attribute__ ((__noipa__)) lisrldicl (long long *arg)
> /* { dg-final { scan-assembler-times {\mlis .*,0xabcd\M} 1 } } */
> /* { dg-final { scan-assembler-times {\mrldicl .*,0,32\M} 1 } } */
>
> +void __attribute__ ((__noipa__)) lisxoris (long long *arg)
> +{
> + *arg = 0xffffffff65430000LL;
> +}
> +/* { dg-final { scan-assembler-times {\mlis .*,0xe543\M} 1 } } */
> +/* { dg-final { scan-assembler-times {\mxoris .*0x8000\M} 1 } } */
> +
> int
> main ()
> {
> @@ -35,6 +42,7 @@ main ()
> lixoris (a);
> lioris (a + 1);
> lisrldicl (a + 2);
> + lisxoris (a + 3);
> if (__builtin_memcmp (a, arr, sizeof (arr)) != 0)
> __builtin_abort ();
> return 0;
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH V4 2/2] rs6000: use li;x?oris to build constant
2023-05-15 6:53 ` Kewen.Lin
@ 2023-05-17 2:17 ` guojiufu
0 siblings, 0 replies; 12+ messages in thread
From: guojiufu @ 2023-05-17 2:17 UTC (permalink / raw)
To: Kewen.Lin; +Cc: segher, dje.gcc, linkw, gcc-patches
Hi,
On 2023-05-15 14:53, Kewen.Lin wrote:
> Hi Jeff,
>
> on 2022/12/12 09:38, Jiufu Guo wrote:
>> Hi,
>>
>> For constant C:
>> If '(c & 0xFFFFFFFF0000FFFFULL) == 0xFFFFFFFF00000000' or say:
>> 32(1) || 1(0) || 15(x) || 16(0), we could use "lis; xoris" to build.
>>
>> Here N(M) means N continuous bit M, x for M means it is ok for either
>> 1 or 0; '||' means concatenation.
>>
>> This patch update rs6000_emit_set_long_const to support those
>> constants.
>>
>> Compare with previous version:
>> https://gcc.gnu.org/pipermail/gcc-patches/2022-December/607618.htm
>> This patch fix conflicts with trunk.
>>
>> Bootstrap and regtest pass on ppc64{,le}.
>>
>> Is this ok for trunk?
>
> OK for trunk, thanks for improving this.
>
> btw, the test case needs to be updated a bit as the function names in
> the
> context changed upstream, please ensure it's tested well before
> committing,
> thanks!
Yeap! Retested and verified.
Thanks so much for your always insight review and helpful comments!
Committed via r14-923-g5eb7d560626e42.
BR,
Jeff (Jiufu)
>
>>
>> BR,
>> Jeff (Jiufu)
>>
>>
>> PR target/106708
>>
>> gcc/ChangeLog:
>>
>> * config/rs6000/rs6000.cc (rs6000_emit_set_long_const): Add to build
>> constants through "lis; xoris".
>
> Maybe s/Add to build/Support building/
Yes :)
>
> BR,
> Kewen
>
>>
>> gcc/testsuite/ChangeLog:
>>
>> * gcc.target/powerpc/pr106708.c: Add test function.
>>
>> ---
>> gcc/config/rs6000/rs6000.cc | 7 +++++++
>> gcc/testsuite/gcc.target/powerpc/pr106708.c | 10 +++++++++-
>> 2 files changed, 16 insertions(+), 1 deletion(-)
>>
>> diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
>> index 8c1192a10c8..1138d5e8cd4 100644
>> --- a/gcc/config/rs6000/rs6000.cc
>> +++ b/gcc/config/rs6000/rs6000.cc
>> @@ -10251,6 +10251,13 @@ rs6000_emit_set_long_const (rtx dest,
>> HOST_WIDE_INT c)
>> if (ud1 != 0)
>> emit_move_insn (dest, gen_rtx_IOR (DImode, temp, GEN_INT (ud1)));
>> }
>> + else if (ud4 == 0xffff && ud3 == 0xffff && !(ud2 & 0x8000) && ud1
>> == 0)
>> + {
>> + /* lis; xoris */
>> + temp = !can_create_pseudo_p () ? dest : gen_reg_rtx (DImode);
>> + emit_move_insn (temp, GEN_INT (sext_hwi ((ud2 | 0x8000) << 16,
>> 32)));
>> + emit_move_insn (dest, gen_rtx_XOR (DImode, temp, GEN_INT
>> (0x80000000)));
>> + }
>> else if (ud4 == 0xffff && ud3 == 0xffff && (ud1 & 0x8000))
>> {
>> /* li; xoris */
>> diff --git a/gcc/testsuite/gcc.target/powerpc/pr106708.c
>> b/gcc/testsuite/gcc.target/powerpc/pr106708.c
>> index dc9ceda8367..a015c71e630 100644
>> --- a/gcc/testsuite/gcc.target/powerpc/pr106708.c
>> +++ b/gcc/testsuite/gcc.target/powerpc/pr106708.c
>> @@ -4,7 +4,7 @@
>> /* { dg-require-effective-target has_arch_ppc64 } */
>>
>> long long arr[]
>> - = {0xffffffff7cdeab55LL, 0x98765432LL, 0xabcd0000LL};
>> += {0xffffffff7cdeab55LL, 0x98765432LL, 0xabcd0000LL,
>> 0xffffffff65430000LL};
>>
>> void __attribute__ ((__noipa__)) lixoris (long long *arg)
>> {
>> @@ -27,6 +27,13 @@ void __attribute__ ((__noipa__)) lisrldicl (long
>> long *arg)
>> /* { dg-final { scan-assembler-times {\mlis .*,0xabcd\M} 1 } } */
>> /* { dg-final { scan-assembler-times {\mrldicl .*,0,32\M} 1 } } */
>>
>> +void __attribute__ ((__noipa__)) lisxoris (long long *arg)
>> +{
>> + *arg = 0xffffffff65430000LL;
>> +}
>> +/* { dg-final { scan-assembler-times {\mlis .*,0xe543\M} 1 } } */
>> +/* { dg-final { scan-assembler-times {\mxoris .*0x8000\M} 1 } } */
>> +
>> int
>> main ()
>> {
>> @@ -35,6 +42,7 @@ main ()
>> lixoris (a);
>> lioris (a + 1);
>> lisrldicl (a + 2);
>> + lisxoris (a + 3);
>> if (__builtin_memcmp (a, arr, sizeof (arr)) != 0)
>> __builtin_abort ();
>> return 0;
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH V4 1/2] rs6000: use li;x?oris to build constant
2022-12-12 1:38 [PATCH V4 1/2] rs6000: use li;x?oris to build constant Jiufu Guo
2022-12-12 1:38 ` [PATCH V4 2/2] " Jiufu Guo
@ 2022-12-14 10:27 ` Kewen.Lin
2022-12-15 3:29 ` Jiufu Guo
2022-12-16 21:12 ` Segher Boessenkool
2022-12-16 21:16 ` Segher Boessenkool
2 siblings, 2 replies; 12+ messages in thread
From: Kewen.Lin @ 2022-12-14 10:27 UTC (permalink / raw)
To: Jiufu Guo; +Cc: segher, dje.gcc, linkw, gcc-patches
Hi Jeff,
on 2022/12/12 09:38, Jiufu Guo via Gcc-patches wrote:
> Hi,
>
> For constant C:
> If '(c & 0xFFFFFFFF00008000ULL) == 0xFFFFFFFF00008000ULL' or say:
> 32(1) || 16(x) || 1(1) || 15(x), using "li; xoris" would be ok.
>
> If '(c & 0xFFFFFFFF80008000ULL) == 0x80000000ULL' or say:
> 32(0) || 1(1) || 15(x) || 1(0) || 15(x), we could use "li; oris" to
> build constant 'C'.
>
> Here N(M) means N continuous bit M, x for M means it is ok for either
> 1 or 0; '||' means concatenation.
>
> This patch update rs6000_emit_set_long_const to support those constants.
>
> Compare with previous version, this patch fixes conflicts with trunk.
> and put li;x?oris as the first patch (lis;xoris as the second patch).
> Previous version:
> https://gcc.gnu.org/pipermail/gcc-patches/2022-December/607618.html
>
> Bootstrap and regtest pass on ppc64{,le}.
>
> Is this ok for trunk?
>
> BR,
> Jeff (Jiufu)
>
>
> PR target/106708
>
> gcc/ChangeLog:
>
> * config/rs6000/rs6000.cc (rs6000_emit_set_long_const): Add using
> "li; x?oris" to build constant.
>
> gcc/testsuite/ChangeLog:
>
> * gcc.target/powerpc/pr106708.c: New test.
>
> ---
> gcc/config/rs6000/rs6000.cc | 36 +++++++++++++++---
> gcc/testsuite/gcc.target/powerpc/pr106708.c | 41 +++++++++++++++++++++
> 2 files changed, 71 insertions(+), 6 deletions(-)
> create mode 100644 gcc/testsuite/gcc.target/powerpc/pr106708.c
>
> diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
> index b3a609f3aa3..8c1192a10c8 100644
> --- a/gcc/config/rs6000/rs6000.cc
> +++ b/gcc/config/rs6000/rs6000.cc
> @@ -10251,17 +10251,41 @@ rs6000_emit_set_long_const (rtx dest, HOST_WIDE_INT c)
> if (ud1 != 0)
> emit_move_insn (dest, gen_rtx_IOR (DImode, temp, GEN_INT (ud1)));
> }
> + else if (ud4 == 0xffff && ud3 == 0xffff && (ud1 & 0x8000))
> + {
> + /* li; xoris */
> + temp = !can_create_pseudo_p () ? dest : gen_reg_rtx (DImode);
> + emit_move_insn (temp, GEN_INT (sext_hwi (ud1, 16)));
> + emit_move_insn (dest, gen_rtx_XOR (DImode, temp,
> + GEN_INT ((ud2 ^ 0xffff) << 16)));
> + }
> else if (ud3 == 0 && ud4 == 0)
> {
> temp = !can_create_pseudo_p () ? dest : gen_reg_rtx (DImode);
>
> gcc_assert (ud2 & 0x8000);
> - emit_move_insn (temp, GEN_INT (sext_hwi (ud2 << 16, 32)));
> - if (ud1 != 0)
> - emit_move_insn (temp, gen_rtx_IOR (DImode, temp, GEN_INT (ud1)));
> - emit_move_insn (dest,
> - gen_rtx_ZERO_EXTEND (DImode,
> - gen_lowpart (SImode,temp)));
> +
> + if (ud1 == 0)
> + {
> + /* lis; rldicl */
> + emit_move_insn (temp, GEN_INT (sext_hwi (ud2 << 16, 32)));
> + emit_move_insn (dest,
> + gen_rtx_AND (DImode, temp, GEN_INT (0xffffffff)));
> + }
> + else if (!(ud1 & 0x8000))
> + {
> + /* li; oris */
> + emit_move_insn (temp, GEN_INT (ud1));
> + emit_move_insn (dest,
> + gen_rtx_IOR (DImode, temp, GEN_INT (ud2 << 16)));
> + }
> + else
> + {
Nit: Add "/* lis; ori; rldicl */" like the other arms?
> + emit_move_insn (temp, GEN_INT (sext_hwi (ud2 << 16, 32)));
> + emit_move_insn (temp, gen_rtx_IOR (DImode, temp, GEN_INT (ud1)));
> + emit_move_insn (dest,
> + gen_rtx_AND (DImode, temp, GEN_INT (0xffffffff)));
> + }
> }
> else if (ud1 == ud3 && ud2 == ud4)
> {
> diff --git a/gcc/testsuite/gcc.target/powerpc/pr106708.c b/gcc/testsuite/gcc.target/powerpc/pr106708.c
> new file mode 100644
> index 00000000000..dc9ceda8367
> --- /dev/null
> +++ b/gcc/testsuite/gcc.target/powerpc/pr106708.c
> @@ -0,0 +1,41 @@
> +/* PR target/106708 */
> +/* { dg-do run } */
> +/* { dg-options "-O2 -mno-prefixed -save-temps" } */
> +/* { dg-require-effective-target has_arch_ppc64 } */
> +
> +long long arr[]
> + = {0xffffffff7cdeab55LL, 0x98765432LL, 0xabcd0000LL};
> +
> +void __attribute__ ((__noipa__)) lixoris (long long *arg)
Nit: Adding separator "_" to make the name like "li_xoris" or even
"test_li_xoris" seems better to read. Also applied for the other
function names "lioris" and "lisrldicl".
The others look good to me. Thanks!
BR,
Kewen
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH V4 1/2] rs6000: use li;x?oris to build constant
2022-12-14 10:27 ` [PATCH V4 1/2] " Kewen.Lin
@ 2022-12-15 3:29 ` Jiufu Guo
2022-12-16 21:12 ` Segher Boessenkool
1 sibling, 0 replies; 12+ messages in thread
From: Jiufu Guo @ 2022-12-15 3:29 UTC (permalink / raw)
To: Kewen.Lin; +Cc: segher, dje.gcc, linkw, gcc-patches
Hi,
"Kewen.Lin" <linkw@linux.ibm.com> writes:
> Hi Jeff,
>
> on 2022/12/12 09:38, Jiufu Guo via Gcc-patches wrote:
>> Hi,
>>
>> For constant C:
>> If '(c & 0xFFFFFFFF00008000ULL) == 0xFFFFFFFF00008000ULL' or say:
>> 32(1) || 16(x) || 1(1) || 15(x), using "li; xoris" would be ok.
>>
>> If '(c & 0xFFFFFFFF80008000ULL) == 0x80000000ULL' or say:
>> 32(0) || 1(1) || 15(x) || 1(0) || 15(x), we could use "li; oris" to
>> build constant 'C'.
>>
>> Here N(M) means N continuous bit M, x for M means it is ok for either
>> 1 or 0; '||' means concatenation.
>>
>> This patch update rs6000_emit_set_long_const to support those constants.
>>
>> Compare with previous version, this patch fixes conflicts with trunk.
>> and put li;x?oris as the first patch (lis;xoris as the second patch).
>> Previous version:
>> https://gcc.gnu.org/pipermail/gcc-patches/2022-December/607618.html
>>
>> Bootstrap and regtest pass on ppc64{,le}.
>>
>> Is this ok for trunk?
>>
>> BR,
>> Jeff (Jiufu)
>>
>>
>> PR target/106708
>>
>> gcc/ChangeLog:
>>
>> * config/rs6000/rs6000.cc (rs6000_emit_set_long_const): Add using
>> "li; x?oris" to build constant.
>>
>> gcc/testsuite/ChangeLog:
>>
>> * gcc.target/powerpc/pr106708.c: New test.
>>
>> ---
>> gcc/config/rs6000/rs6000.cc | 36 +++++++++++++++---
>> gcc/testsuite/gcc.target/powerpc/pr106708.c | 41 +++++++++++++++++++++
>> 2 files changed, 71 insertions(+), 6 deletions(-)
>> create mode 100644 gcc/testsuite/gcc.target/powerpc/pr106708.c
>>
>> diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
>> index b3a609f3aa3..8c1192a10c8 100644
>> --- a/gcc/config/rs6000/rs6000.cc
>> +++ b/gcc/config/rs6000/rs6000.cc
>> @@ -10251,17 +10251,41 @@ rs6000_emit_set_long_const (rtx dest, HOST_WIDE_INT c)
>> if (ud1 != 0)
>> emit_move_insn (dest, gen_rtx_IOR (DImode, temp, GEN_INT (ud1)));
>> }
>> + else if (ud4 == 0xffff && ud3 == 0xffff && (ud1 & 0x8000))
>> + {
>> + /* li; xoris */
>> + temp = !can_create_pseudo_p () ? dest : gen_reg_rtx (DImode);
>> + emit_move_insn (temp, GEN_INT (sext_hwi (ud1, 16)));
>> + emit_move_insn (dest, gen_rtx_XOR (DImode, temp,
>> + GEN_INT ((ud2 ^ 0xffff) << 16)));
>> + }
>> else if (ud3 == 0 && ud4 == 0)
>> {
>> temp = !can_create_pseudo_p () ? dest : gen_reg_rtx (DImode);
>>
>> gcc_assert (ud2 & 0x8000);
>> - emit_move_insn (temp, GEN_INT (sext_hwi (ud2 << 16, 32)));
>> - if (ud1 != 0)
>> - emit_move_insn (temp, gen_rtx_IOR (DImode, temp, GEN_INT (ud1)));
>> - emit_move_insn (dest,
>> - gen_rtx_ZERO_EXTEND (DImode,
>> - gen_lowpart (SImode,temp)));
>> +
>> + if (ud1 == 0)
>> + {
>> + /* lis; rldicl */
>> + emit_move_insn (temp, GEN_INT (sext_hwi (ud2 << 16, 32)));
>> + emit_move_insn (dest,
>> + gen_rtx_AND (DImode, temp, GEN_INT (0xffffffff)));
>> + }
>> + else if (!(ud1 & 0x8000))
>> + {
>> + /* li; oris */
>> + emit_move_insn (temp, GEN_INT (ud1));
>> + emit_move_insn (dest,
>> + gen_rtx_IOR (DImode, temp, GEN_INT (ud2 << 16)));
>> + }
>> + else
>> + {
>
> Nit: Add "/* lis; ori; rldicl */" like the other arms?
>
>> + emit_move_insn (temp, GEN_INT (sext_hwi (ud2 << 16, 32)));
>> + emit_move_insn (temp, gen_rtx_IOR (DImode, temp, GEN_INT (ud1)));
>> + emit_move_insn (dest,
>> + gen_rtx_AND (DImode, temp, GEN_INT (0xffffffff)));
>> + }
>> }
>> else if (ud1 == ud3 && ud2 == ud4)
>> {
>> diff --git a/gcc/testsuite/gcc.target/powerpc/pr106708.c b/gcc/testsuite/gcc.target/powerpc/pr106708.c
>> new file mode 100644
>> index 00000000000..dc9ceda8367
>> --- /dev/null
>> +++ b/gcc/testsuite/gcc.target/powerpc/pr106708.c
>> @@ -0,0 +1,41 @@
>> +/* PR target/106708 */
>> +/* { dg-do run } */
>> +/* { dg-options "-O2 -mno-prefixed -save-temps" } */
>> +/* { dg-require-effective-target has_arch_ppc64 } */
>> +
>> +long long arr[]
>> + = {0xffffffff7cdeab55LL, 0x98765432LL, 0xabcd0000LL};
>> +
>> +void __attribute__ ((__noipa__)) lixoris (long long *arg)
>
> Nit: Adding separator "_" to make the name like "li_xoris" or even
> "test_li_xoris" seems better to read. Also applied for the other
> function names "lioris" and "lisrldicl".
>
> The others look good to me. Thanks!
>
Thanks a lot for your review and comments!
I will update into patch.
BR,
Jeff (Jiufu)
> BR,
> Kewen
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH V4 1/2] rs6000: use li;x?oris to build constant
2022-12-14 10:27 ` [PATCH V4 1/2] " Kewen.Lin
2022-12-15 3:29 ` Jiufu Guo
@ 2022-12-16 21:12 ` Segher Boessenkool
1 sibling, 0 replies; 12+ messages in thread
From: Segher Boessenkool @ 2022-12-16 21:12 UTC (permalink / raw)
To: Kewen.Lin; +Cc: Jiufu Guo, dje.gcc, linkw, gcc-patches
On Wed, Dec 14, 2022 at 06:27:57PM +0800, Kewen.Lin wrote:
> > +void __attribute__ ((__noipa__)) lixoris (long long *arg)
>
> Nit: Adding separator "_" to make the name like "li_xoris" or even
> "test_li_xoris" seems better to read. Also applied for the other
> function names "lioris" and "lisrldicl".
Ha yes, that last one is a bit impregnable like this. It is testsuite
so everything goes of course, but :-)
Segher
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH V4 1/2] rs6000: use li;x?oris to build constant
2022-12-12 1:38 [PATCH V4 1/2] rs6000: use li;x?oris to build constant Jiufu Guo
2022-12-12 1:38 ` [PATCH V4 2/2] " Jiufu Guo
2022-12-14 10:27 ` [PATCH V4 1/2] " Kewen.Lin
@ 2022-12-16 21:16 ` Segher Boessenkool
2022-12-19 9:16 ` Jiufu Guo
2 siblings, 1 reply; 12+ messages in thread
From: Segher Boessenkool @ 2022-12-16 21:16 UTC (permalink / raw)
To: Jiufu Guo; +Cc: gcc-patches, dje.gcc, linkw
Hi!
On Mon, Dec 12, 2022 at 09:38:28AM +0800, Jiufu Guo wrote:
> PR target/106708
>
> gcc/ChangeLog:
>
> * config/rs6000/rs6000.cc (rs6000_emit_set_long_const): Add using
> "li; x?oris" to build constant.
>
> gcc/testsuite/ChangeLog:
>
> * gcc.target/powerpc/pr106708.c: New test.
Okay for trunk with the nits Ke Wen pointed out taken care off.
Thanks!
Segher
^ permalink raw reply [flat|nested] 12+ messages in thread
* Re: [PATCH V4 1/2] rs6000: use li;x?oris to build constant
2022-12-16 21:16 ` Segher Boessenkool
@ 2022-12-19 9:16 ` Jiufu Guo
0 siblings, 0 replies; 12+ messages in thread
From: Jiufu Guo @ 2022-12-19 9:16 UTC (permalink / raw)
To: Segher Boessenkool; +Cc: gcc-patches, dje.gcc, linkw
Hi,
Segher Boessenkool <segher@kernel.crashing.org> writes:
> Hi!
>
> On Mon, Dec 12, 2022 at 09:38:28AM +0800, Jiufu Guo wrote:
>> PR target/106708
>>
>> gcc/ChangeLog:
>>
>> * config/rs6000/rs6000.cc (rs6000_emit_set_long_const): Add using
>> "li; x?oris" to build constant.
>>
>> gcc/testsuite/ChangeLog:
>>
>> * gcc.target/powerpc/pr106708.c: New test.
>
> Okay for trunk with the nits Ke Wen pointed out taken care off.
Thanks! Updated and committed via r13-4771-g97a8e88cd7d225.
BR,
Jeff (Jiufu)
>
> Thanks!
>
>
> Segher
^ permalink raw reply [flat|nested] 12+ messages in thread
end of thread, other threads:[~2023-05-17 2:17 UTC | newest]
Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-12 1:38 [PATCH V4 1/2] rs6000: use li;x?oris to build constant Jiufu Guo
2022-12-12 1:38 ` [PATCH V4 2/2] " Jiufu Guo
2023-01-04 6:11 ` Jiufu Guo
2023-02-20 4:41 ` Ping^^ " Jiufu Guo
2023-04-26 2:35 ` Ping^^^ " Jiufu Guo
2023-05-15 6:53 ` Kewen.Lin
2023-05-17 2:17 ` guojiufu
2022-12-14 10:27 ` [PATCH V4 1/2] " Kewen.Lin
2022-12-15 3:29 ` Jiufu Guo
2022-12-16 21:12 ` Segher Boessenkool
2022-12-16 21:16 ` Segher Boessenkool
2022-12-19 9:16 ` Jiufu Guo
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).