Skip to content

Commit db5fcf3

Browse files
avieira-armstephanosio
authored andcommitted
arm: Fix MVE's vcmp vector-scalar patterns [PR107987]
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. 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.target/arm/mve/pr107987.c: New test. (cherry picked from commit ed34c3b) Signed-off-by: Stephanos Ioannidis <root@stephanos.io>
1 parent 550a8db commit db5fcf3

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

gcc/config/arm/mve.md

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -834,8 +834,9 @@
834834
(define_insn "mve_vcmp<mve_cmp_op>q_n_<mode>"
835835
[
836836
(set (match_operand:<MVE_VPRED> 0 "vpr_register_operand" "=Up")
837-
(MVE_COMPARISONS:<MVE_VPRED> (match_operand:MVE_2 1 "s_register_operand" "w")
838-
(match_operand:<V_elem> 2 "s_register_operand" "r")))
837+
(MVE_COMPARISONS:<MVE_VPRED>
838+
(match_operand:MVE_2 1 "s_register_operand" "w")
839+
(vec_duplicate:MVE_2 (match_operand:<V_elem> 2 "s_register_operand" "r"))))
839840
]
840841
"TARGET_HAVE_MVE"
841842
"vcmp.<mve_cmp_type>%#<V_sz_elem> <mve_cmp_op>, %q1, %2"
@@ -1924,8 +1925,9 @@
19241925
(define_insn "@mve_vcmp<mve_cmp_op>q_n_f<mode>"
19251926
[
19261927
(set (match_operand:<MVE_VPRED> 0 "vpr_register_operand" "=Up")
1927-
(MVE_FP_COMPARISONS:<MVE_VPRED> (match_operand:MVE_0 1 "s_register_operand" "w")
1928-
(match_operand:<V_elem> 2 "s_register_operand" "r")))
1928+
(MVE_FP_COMPARISONS:<MVE_VPRED>
1929+
(match_operand:MVE_0 1 "s_register_operand" "w")
1930+
(vec_duplicate:MVE_0 (match_operand:<V_elem> 2 "s_register_operand" "r"))))
19291931
]
19301932
"TARGET_HAVE_MVE && TARGET_HAVE_MVE_FLOAT"
19311933
"vcmp.f%#<V_sz_elem> <mve_cmp_op>, %q1, %2"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
/* { dg-options "-O2" } */
2+
/* { dg-require-effective-target arm_v8_1m_mve_ok } */
3+
/* { dg-add-options arm_v8_1m_mve } */
4+
5+
#include <arm_mve.h>
6+
7+
uint32x4_t foo (uint32x4_t a, uint32x4_t b)
8+
{
9+
mve_pred16_t p = vcmpneq_n_u32 (vandq_u32 (a, b), 0);
10+
return vaddq_x_u32 (a, b, p);
11+
}

0 commit comments

Comments
 (0)