* [PATCH] aarch64: Add pattern for bswap + rotate [PR 110039]
@ 2023-05-31 9:28 Christophe Lyon
2023-05-31 9:49 ` Richard Sandiford
0 siblings, 1 reply; 6+ messages in thread
From: Christophe Lyon @ 2023-05-31 9:28 UTC (permalink / raw)
To: gcc-patches, Kyrylo.Tkachov, richard.sandiford; +Cc: Christophe Lyon
After commit g:d8545fb2c71683f407bfd96706103297d4d6e27b, we missed a
pattern to match the new GIMPLE form.
With this patch, gcc.target/aarch64/rev16_2.c passes again.
2023-05-31 Christophe Lyon <christophe.lyon@linaro.org>
PR target/110039
gcc/
* config/aarch64/aarch64.md (aarch64_rev16<mode>2_alt3): New
pattern.
---
gcc/config/aarch64/aarch64.md | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index 8b8951d7b14..663353791fd 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -6267,6 +6267,16 @@
[(set_attr "type" "rev")]
)
+;; Similar pattern to mache (rotate (bswap) 16)
+(define_insn "aarch64_rev16<mode>2_alt3"
+ [(set (match_operand:GPI 0 "register_operand" "=r")
+ (rotate:GPI (bswap:GPI (match_operand:GPI 1 "register_operand" "r"))
+ (const_int 16)))]
+ ""
+ "rev16\\t%<w>0, %<w>1"
+ [(set_attr "type" "rev")]
+)
+
;; zero_extend version of above
(define_insn "*bswapsi2_uxtw"
[(set (match_operand:DI 0 "register_operand" "=r")
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] aarch64: Add pattern for bswap + rotate [PR 110039]
2023-05-31 9:28 [PATCH] aarch64: Add pattern for bswap + rotate [PR 110039] Christophe Lyon
@ 2023-05-31 9:49 ` Richard Sandiford
2023-05-31 10:08 ` Christophe Lyon
0 siblings, 1 reply; 6+ messages in thread
From: Richard Sandiford @ 2023-05-31 9:49 UTC (permalink / raw)
To: Christophe Lyon; +Cc: gcc-patches, Kyrylo.Tkachov
Christophe Lyon <christophe.lyon@linaro.org> writes:
> After commit g:d8545fb2c71683f407bfd96706103297d4d6e27b, we missed a
> pattern to match the new GIMPLE form.
>
> With this patch, gcc.target/aarch64/rev16_2.c passes again.
>
> 2023-05-31 Christophe Lyon <christophe.lyon@linaro.org>
>
> PR target/110039
> gcc/
> * config/aarch64/aarch64.md (aarch64_rev16<mode>2_alt3): New
> pattern.
> ---
> gcc/config/aarch64/aarch64.md | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
> index 8b8951d7b14..663353791fd 100644
> --- a/gcc/config/aarch64/aarch64.md
> +++ b/gcc/config/aarch64/aarch64.md
> @@ -6267,6 +6267,16 @@
> [(set_attr "type" "rev")]
> )
>
> +;; Similar pattern to mache (rotate (bswap) 16)
> +(define_insn "aarch64_rev16<mode>2_alt3"
> + [(set (match_operand:GPI 0 "register_operand" "=r")
> + (rotate:GPI (bswap:GPI (match_operand:GPI 1 "register_operand" "r"))
> + (const_int 16)))]
> + ""
> + "rev16\\t%<w>0, %<w>1"
> + [(set_attr "type" "rev")]
> +)
> +
Doesn't this have to be :SI only? The rtl expression and the
instruction are different for :DI.
Thanks,
Richard
> ;; zero_extend version of above
> (define_insn "*bswapsi2_uxtw"
> [(set (match_operand:DI 0 "register_operand" "=r")
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] aarch64: Add pattern for bswap + rotate [PR 110039]
2023-05-31 9:49 ` Richard Sandiford
@ 2023-05-31 10:08 ` Christophe Lyon
2023-05-31 10:22 ` Richard Sandiford
0 siblings, 1 reply; 6+ messages in thread
From: Christophe Lyon @ 2023-05-31 10:08 UTC (permalink / raw)
To: Christophe Lyon, gcc-patches, Kyrylo.Tkachov, richard.sandiford
[-- Attachment #1: Type: text/plain, Size: 1766 bytes --]
On Wed, 31 May 2023 at 11:49, Richard Sandiford <richard.sandiford@arm.com>
wrote:
> Christophe Lyon <christophe.lyon@linaro.org> writes:
> > After commit g:d8545fb2c71683f407bfd96706103297d4d6e27b, we missed a
> > pattern to match the new GIMPLE form.
> >
> > With this patch, gcc.target/aarch64/rev16_2.c passes again.
> >
> > 2023-05-31 Christophe Lyon <christophe.lyon@linaro.org>
> >
> > PR target/110039
> > gcc/
> > * config/aarch64/aarch64.md (aarch64_rev16<mode>2_alt3): New
> > pattern.
> > ---
> > gcc/config/aarch64/aarch64.md | 10 ++++++++++
> > 1 file changed, 10 insertions(+)
> >
> > diff --git a/gcc/config/aarch64/aarch64.md
> b/gcc/config/aarch64/aarch64.md
> > index 8b8951d7b14..663353791fd 100644
> > --- a/gcc/config/aarch64/aarch64.md
> > +++ b/gcc/config/aarch64/aarch64.md
> > @@ -6267,6 +6267,16 @@
> > [(set_attr "type" "rev")]
> > )
> >
> > +;; Similar pattern to mache (rotate (bswap) 16)
> > +(define_insn "aarch64_rev16<mode>2_alt3"
> > + [(set (match_operand:GPI 0 "register_operand" "=r")
> > + (rotate:GPI (bswap:GPI (match_operand:GPI 1 "register_operand"
> "r"))
> > + (const_int 16)))]
> > + ""
> > + "rev16\\t%<w>0, %<w>1"
> > + [(set_attr "type" "rev")]
> > +)
> > +
>
> Doesn't this have to be :SI only? The rtl expression and the
> instruction are different for :DI.
>
> Do you mean the other two examples in the testcase?
( __rev16_64_alt, __rev16_64)
They currently use aarch64_rev16di2_alt1 and aarch64_rev16di2_alt2
respectively.
So yeah for this case it seems :SI would be right.
Thanks,
Christophe
Thanks,
> Richard
>
> > ;; zero_extend version of above
> > (define_insn "*bswapsi2_uxtw"
> > [(set (match_operand:DI 0 "register_operand" "=r")
>
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] aarch64: Add pattern for bswap + rotate [PR 110039]
2023-05-31 10:08 ` Christophe Lyon
@ 2023-05-31 10:22 ` Richard Sandiford
2023-05-31 13:13 ` [PATCH v2] " Christophe Lyon
0 siblings, 1 reply; 6+ messages in thread
From: Richard Sandiford @ 2023-05-31 10:22 UTC (permalink / raw)
To: Christophe Lyon; +Cc: gcc-patches, Kyrylo.Tkachov
Christophe Lyon <christophe.lyon@linaro.org> writes:
> On Wed, 31 May 2023 at 11:49, Richard Sandiford <richard.sandiford@arm.com>
> wrote:
>
>> Christophe Lyon <christophe.lyon@linaro.org> writes:
>> > After commit g:d8545fb2c71683f407bfd96706103297d4d6e27b, we missed a
>> > pattern to match the new GIMPLE form.
>> >
>> > With this patch, gcc.target/aarch64/rev16_2.c passes again.
>> >
>> > 2023-05-31 Christophe Lyon <christophe.lyon@linaro.org>
>> >
>> > PR target/110039
>> > gcc/
>> > * config/aarch64/aarch64.md (aarch64_rev16<mode>2_alt3): New
>> > pattern.
>> > ---
>> > gcc/config/aarch64/aarch64.md | 10 ++++++++++
>> > 1 file changed, 10 insertions(+)
>> >
>> > diff --git a/gcc/config/aarch64/aarch64.md
>> b/gcc/config/aarch64/aarch64.md
>> > index 8b8951d7b14..663353791fd 100644
>> > --- a/gcc/config/aarch64/aarch64.md
>> > +++ b/gcc/config/aarch64/aarch64.md
>> > @@ -6267,6 +6267,16 @@
>> > [(set_attr "type" "rev")]
>> > )
>> >
>> > +;; Similar pattern to mache (rotate (bswap) 16)
>> > +(define_insn "aarch64_rev16<mode>2_alt3"
>> > + [(set (match_operand:GPI 0 "register_operand" "=r")
>> > + (rotate:GPI (bswap:GPI (match_operand:GPI 1 "register_operand"
>> "r"))
>> > + (const_int 16)))]
>> > + ""
>> > + "rev16\\t%<w>0, %<w>1"
>> > + [(set_attr "type" "rev")]
>> > +)
>> > +
>>
>> Doesn't this have to be :SI only? The rtl expression and the
>> instruction are different for :DI.
>>
> Do you mean the other two examples in the testcase?
> ( __rev16_64_alt, __rev16_64)
> They currently use aarch64_rev16di2_alt1 and aarch64_rev16di2_alt2
> respectively.
I meant more that the new pattern would generate wrong code if someone
wrote a 64-bit bswap followed by a 64-bit rotate left.
Richard
^ permalink raw reply [flat|nested] 6+ messages in thread
* [PATCH v2] aarch64: Add pattern for bswap + rotate [PR 110039]
2023-05-31 10:22 ` Richard Sandiford
@ 2023-05-31 13:13 ` Christophe Lyon
2023-05-31 13:15 ` Richard Sandiford
0 siblings, 1 reply; 6+ messages in thread
From: Christophe Lyon @ 2023-05-31 13:13 UTC (permalink / raw)
To: gcc-patches, Kyrylo.Tkachov, richard.sandiford; +Cc: Christophe Lyon
After commit g:d8545fb2c71683f407bfd96706103297d4d6e27b, we missed a
pattern to match the new GIMPLE form.
With this patch, gcc.target/aarch64/rev16_2.c passes again.
2023-05-31 Christophe Lyon <christophe.lyon@linaro.org>
PR target/110039
gcc/
* config/aarch64/aarch64.md (aarch64_rev16si2_alt3): New
pattern.
---
gcc/config/aarch64/aarch64.md | 10 ++++++++++
1 file changed, 10 insertions(+)
diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
index 8b8951d7b14..9af7024da43 100644
--- a/gcc/config/aarch64/aarch64.md
+++ b/gcc/config/aarch64/aarch64.md
@@ -6267,6 +6267,16 @@
[(set_attr "type" "rev")]
)
+;; Similar pattern to match (rotate (bswap) 16)
+(define_insn "aarch64_rev16si2_alt3"
+ [(set (match_operand:SI 0 "register_operand" "=r")
+ (rotate:SI (bswap:SI (match_operand:SI 1 "register_operand" "r"))
+ (const_int 16)))]
+ ""
+ "rev16\\t%w0, %w1"
+ [(set_attr "type" "rev")]
+)
+
;; zero_extend version of above
(define_insn "*bswapsi2_uxtw"
[(set (match_operand:DI 0 "register_operand" "=r")
--
2.34.1
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH v2] aarch64: Add pattern for bswap + rotate [PR 110039]
2023-05-31 13:13 ` [PATCH v2] " Christophe Lyon
@ 2023-05-31 13:15 ` Richard Sandiford
0 siblings, 0 replies; 6+ messages in thread
From: Richard Sandiford @ 2023-05-31 13:15 UTC (permalink / raw)
To: Christophe Lyon; +Cc: gcc-patches, Kyrylo.Tkachov
Christophe Lyon <christophe.lyon@linaro.org> writes:
> After commit g:d8545fb2c71683f407bfd96706103297d4d6e27b, we missed a
> pattern to match the new GIMPLE form.
>
> With this patch, gcc.target/aarch64/rev16_2.c passes again.
>
> 2023-05-31 Christophe Lyon <christophe.lyon@linaro.org>
>
> PR target/110039
> gcc/
> * config/aarch64/aarch64.md (aarch64_rev16si2_alt3): New
> pattern.
OK, thanks.
Richard
> ---
> gcc/config/aarch64/aarch64.md | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/gcc/config/aarch64/aarch64.md b/gcc/config/aarch64/aarch64.md
> index 8b8951d7b14..9af7024da43 100644
> --- a/gcc/config/aarch64/aarch64.md
> +++ b/gcc/config/aarch64/aarch64.md
> @@ -6267,6 +6267,16 @@
> [(set_attr "type" "rev")]
> )
>
> +;; Similar pattern to match (rotate (bswap) 16)
> +(define_insn "aarch64_rev16si2_alt3"
> + [(set (match_operand:SI 0 "register_operand" "=r")
> + (rotate:SI (bswap:SI (match_operand:SI 1 "register_operand" "r"))
> + (const_int 16)))]
> + ""
> + "rev16\\t%w0, %w1"
> + [(set_attr "type" "rev")]
> +)
> +
> ;; zero_extend version of above
> (define_insn "*bswapsi2_uxtw"
> [(set (match_operand:DI 0 "register_operand" "=r")
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2023-05-31 13:15 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-31 9:28 [PATCH] aarch64: Add pattern for bswap + rotate [PR 110039] Christophe Lyon
2023-05-31 9:49 ` Richard Sandiford
2023-05-31 10:08 ` Christophe Lyon
2023-05-31 10:22 ` Richard Sandiford
2023-05-31 13:13 ` [PATCH v2] " Christophe Lyon
2023-05-31 13:15 ` Richard Sandiford
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).