* [PATCH] arm: Fix MVE's vcmp vector-scalar patterns [PR107987]
@ 2022-12-06 11:18 Andre Simoes Dias Vieira
2022-12-06 11:23 ` Kyrylo Tkachov
0 siblings, 1 reply; 4+ messages in thread
From: Andre Simoes Dias Vieira @ 2022-12-06 11:18 UTC (permalink / raw)
To: 'gcc-patches@gcc.gnu.org'; +Cc: Kyrylo Tkachov, Richard Earnshaw
[-- Attachment #1: Type: text/plain, Size: 525 bytes --]
Hi,
This patch surrounds the scalar operand of the MVE vcmp patterns with a
vec_duplicate to ensure both operands of the comparision operator have the same
(vector) mode.
Regression tested on arm-none-eabi. Is this OK for trunk? And a backport to GCC 12?
gcc/ChangeLog:
PR target/107987
* config/arm/mve.md (mve_vcmp<mve_cmp_op>q_n_<mode>,
@mve_vcmp<mve_cmp_op>q_n_f<mode>): Apply vec_duplicate to scalar
operand.
gcc/testsuite/ChangeLog:
* gcc/testsuite/gcc.target/arm/mve/pr107987.c: New test.
[-- Attachment #2: pr107987.patch --]
[-- Type: application/octet-stream, Size: 1971 bytes --]
diff --git a/gcc/config/arm/mve.md b/gcc/config/arm/mve.md
index 62186f124da183fe1b1eb57a1aea1e8fff680a22..5f6a9b08455f0dec7459d25a20aa87315d15f44f 100644
--- a/gcc/config/arm/mve.md
+++ b/gcc/config/arm/mve.md
@@ -841,8 +841,9 @@ (define_insn "@mve_vcmp<mve_cmp_op>q_<mode>"
(define_insn "mve_vcmp<mve_cmp_op>q_n_<mode>"
[
(set (match_operand:<MVE_VPRED> 0 "vpr_register_operand" "=Up")
- (MVE_COMPARISONS:<MVE_VPRED> (match_operand:MVE_2 1 "s_register_operand" "w")
- (match_operand:<V_elem> 2 "s_register_operand" "r")))
+ (MVE_COMPARISONS:<MVE_VPRED>
+ (match_operand:MVE_2 1 "s_register_operand" "w")
+ (vec_duplicate:MVE_2 (match_operand:<V_elem> 2 "s_register_operand" "r"))))
]
"TARGET_HAVE_MVE"
"vcmp.<mve_cmp_type>%#<V_sz_elem> <mve_cmp_op>, %q1, %2"
@@ -1931,8 +1932,9 @@ (define_insn "@mve_vcmp<mve_cmp_op>q_f<mode>"
(define_insn "@mve_vcmp<mve_cmp_op>q_n_f<mode>"
[
(set (match_operand:<MVE_VPRED> 0 "vpr_register_operand" "=Up")
- (MVE_FP_COMPARISONS:<MVE_VPRED> (match_operand:MVE_0 1 "s_register_operand" "w")
- (match_operand:<V_elem> 2 "s_register_operand" "r")))
+ (MVE_FP_COMPARISONS:<MVE_VPRED>
+ (match_operand:MVE_0 1 "s_register_operand" "w")
+ (vec_duplicate:MVE_0 (match_operand:<V_elem> 2 "s_register_operand" "r"))))
]
"TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT"
"vcmp.f%#<V_sz_elem> <mve_cmp_op>, %q1, %2"
diff --git a/gcc/testsuite/gcc.target/arm/mve/pr107987.c b/gcc/testsuite/gcc.target/arm/mve/pr107987.c
new file mode 100644
index 0000000000000000000000000000000000000000..e19a3f2ec51b7d83b54a28ee005ac9d8fbf38d77
--- /dev/null
+++ b/gcc/testsuite/gcc.target/arm/mve/pr107987.c
@@ -0,0 +1,11 @@
+/* { dg-options "-O2" } */
+/* { dg-require-effective-target arm_v8_1m_mve_ok } */
+/* { dg-add-options arm_v8_1m_mve } */
+
+#include <arm_mve.h>
+
+uint32x4_t foo (uint32x4_t a, uint32x4_t b)
+{
+ mve_pred16_t p = vcmpneq_n_u32 (vandq_u32 (a, b), 0);
+ return vaddq_x_u32 (a, b, p);
+}
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] arm: Fix MVE's vcmp vector-scalar patterns [PR107987]
2022-12-06 11:18 [PATCH] arm: Fix MVE's vcmp vector-scalar patterns [PR107987] Andre Simoes Dias Vieira
@ 2022-12-06 11:23 ` Kyrylo Tkachov
2023-01-27 12:06 ` Andre Vieira (lists)
0 siblings, 1 reply; 4+ messages in thread
From: Kyrylo Tkachov @ 2022-12-06 11:23 UTC (permalink / raw)
To: Andre Simoes Dias Vieira, 'gcc-patches@gcc.gnu.org'
Cc: Richard Earnshaw
> -----Original Message-----
> From: Andre Simoes Dias Vieira <Andre.SimoesDiasVieira@arm.com>
> Sent: Tuesday, December 6, 2022 11:19 AM
> To: 'gcc-patches@gcc.gnu.org' <gcc-patches@gcc.gnu.org>
> Cc: Kyrylo Tkachov <Kyrylo.Tkachov@arm.com>; Richard Earnshaw
> <Richard.Earnshaw@arm.com>
> Subject: [PATCH] arm: Fix MVE's vcmp vector-scalar patterns [PR107987]
>
> Hi,
>
> This patch surrounds the scalar operand of the MVE vcmp patterns with a
> vec_duplicate to ensure both operands of the comparision operator have the
> same
> (vector) mode.
>
> Regression tested on arm-none-eabi. Is this OK for trunk? And a backport to
> GCC 12?
Ok.
Thanks,
Kyrill
>
> gcc/ChangeLog:
>
> PR target/107987
> * config/arm/mve.md (mve_vcmp<mve_cmp_op>q_n_<mode>,
> @mve_vcmp<mve_cmp_op>q_n_f<mode>): Apply vec_duplicate to
> scalar
> operand.
>
> gcc/testsuite/ChangeLog:
>
> * gcc/testsuite/gcc.target/arm/mve/pr107987.c: New test.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] arm: Fix MVE's vcmp vector-scalar patterns [PR107987]
2022-12-06 11:23 ` Kyrylo Tkachov
@ 2023-01-27 12:06 ` Andre Vieira (lists)
2023-01-27 12:08 ` Kyrylo Tkachov
0 siblings, 1 reply; 4+ messages in thread
From: Andre Vieira (lists) @ 2023-01-27 12:06 UTC (permalink / raw)
To: Kyrylo Tkachov, 'gcc-patches@gcc.gnu.org'; +Cc: Richard Earnshaw
This applies cleanly to gcc-12 and regressions for arm-none-eabi look clean.
OK to apply to gcc-12?
On 06/12/2022 11:23, Kyrylo Tkachov wrote:
>
>
>> -----Original Message-----
>> From: Andre Simoes Dias Vieira <Andre.SimoesDiasVieira@arm.com>
>> Sent: Tuesday, December 6, 2022 11:19 AM
>> To: 'gcc-patches@gcc.gnu.org' <gcc-patches@gcc.gnu.org>
>> Cc: Kyrylo Tkachov <Kyrylo.Tkachov@arm.com>; Richard Earnshaw
>> <Richard.Earnshaw@arm.com>
>> Subject: [PATCH] arm: Fix MVE's vcmp vector-scalar patterns [PR107987]
>>
>> Hi,
>>
>> This patch surrounds the scalar operand of the MVE vcmp patterns with a
>> vec_duplicate to ensure both operands of the comparision operator have the
>> same
>> (vector) mode.
>>
>> Regression tested on arm-none-eabi. Is this OK for trunk? And a backport to
>> GCC 12?
>
> Ok.
> Thanks,
> Kyrill
>
>>
>> gcc/ChangeLog:
>>
>> PR target/107987
>> * config/arm/mve.md (mve_vcmp<mve_cmp_op>q_n_<mode>,
>> @mve_vcmp<mve_cmp_op>q_n_f<mode>): Apply vec_duplicate to
>> scalar
>> operand.
>>
>> gcc/testsuite/ChangeLog:
>>
>> * gcc/testsuite/gcc.target/arm/mve/pr107987.c: New test.
>
^ permalink raw reply [flat|nested] 4+ messages in thread
* RE: [PATCH] arm: Fix MVE's vcmp vector-scalar patterns [PR107987]
2023-01-27 12:06 ` Andre Vieira (lists)
@ 2023-01-27 12:08 ` Kyrylo Tkachov
0 siblings, 0 replies; 4+ messages in thread
From: Kyrylo Tkachov @ 2023-01-27 12:08 UTC (permalink / raw)
To: Andre Simoes Dias Vieira, 'gcc-patches@gcc.gnu.org'
Cc: Richard Earnshaw
> -----Original Message-----
> From: Andre Vieira (lists) <andre.simoesdiasvieira@arm.com>
> Sent: Friday, January 27, 2023 12:07 PM
> To: Kyrylo Tkachov <Kyrylo.Tkachov@arm.com>; 'gcc-patches@gcc.gnu.org'
> <gcc-patches@gcc.gnu.org>
> Cc: Richard Earnshaw <Richard.Earnshaw@arm.com>
> Subject: Re: [PATCH] arm: Fix MVE's vcmp vector-scalar patterns [PR107987]
>
> This applies cleanly to gcc-12 and regressions for arm-none-eabi look clean.
>
> OK to apply to gcc-12?
Yes, thanks.
Kyrill
>
>
>
> On 06/12/2022 11:23, Kyrylo Tkachov wrote:
> >
> >
> >> -----Original Message-----
> >> From: Andre Simoes Dias Vieira <Andre.SimoesDiasVieira@arm.com>
> >> Sent: Tuesday, December 6, 2022 11:19 AM
> >> To: 'gcc-patches@gcc.gnu.org' <gcc-patches@gcc.gnu.org>
> >> Cc: Kyrylo Tkachov <Kyrylo.Tkachov@arm.com>; Richard Earnshaw
> >> <Richard.Earnshaw@arm.com>
> >> Subject: [PATCH] arm: Fix MVE's vcmp vector-scalar patterns [PR107987]
> >>
> >> Hi,
> >>
> >> This patch surrounds the scalar operand of the MVE vcmp patterns with a
> >> vec_duplicate to ensure both operands of the comparision operator have
> the
> >> same
> >> (vector) mode.
> >>
> >> Regression tested on arm-none-eabi. Is this OK for trunk? And a backport
> to
> >> GCC 12?
> >
> > Ok.
> > Thanks,
> > Kyrill
> >
> >>
> >> gcc/ChangeLog:
> >>
> >> PR target/107987
> >> * config/arm/mve.md (mve_vcmp<mve_cmp_op>q_n_<mode>,
> >> @mve_vcmp<mve_cmp_op>q_n_f<mode>): Apply vec_duplicate to
> >> scalar
> >> operand.
> >>
> >> gcc/testsuite/ChangeLog:
> >>
> >> * gcc/testsuite/gcc.target/arm/mve/pr107987.c: New test.
> >
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2023-01-27 12:08 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-06 11:18 [PATCH] arm: Fix MVE's vcmp vector-scalar patterns [PR107987] Andre Simoes Dias Vieira
2022-12-06 11:23 ` Kyrylo Tkachov
2023-01-27 12:06 ` Andre Vieira (lists)
2023-01-27 12:08 ` Kyrylo Tkachov
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).