public inbox for gcc-cvs@sourceware.org help / color / mirror / Atom feed
From: Andre Simoes Dias Vieira <avieira@gcc.gnu.org> To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-5646] arm: Fix sign of MVE predicate mve_pred16_t [PR 107674] Date: Thu, 2 Feb 2023 10:02:22 +0000 (GMT) [thread overview] Message-ID: <20230202100222.317F83858C74@sourceware.org> (raw) https://gcc.gnu.org/g:75b58e77706e8b5057770f040005950940a9a0f5 commit r13-5646-g75b58e77706e8b5057770f040005950940a9a0f5 Author: Andre Vieira <andre.simoesdiasvieira@arm.com> Date: Thu Feb 2 10:00:57 2023 +0000 arm: Fix sign of MVE predicate mve_pred16_t [PR 107674] The ACLE defines mve_pred16_t as an unsigned short. This patch makes sure GCC treats the predicate as an unsigned type, rather than signed. gcc/ChangeLog: PR target/107674 * config/arm/arm-builtins.cc (arm_simd_builtin_type): Rewrite to use new qualifiers parameter and use unsigned short type for MVE predicate. (arm_init_builtin): Call arm_simd_builtin_type with qualifiers parameter. (arm_init_crypto_builtins): Likewise. gcc/testsuite/ChangeLog: PR target/107674 * gcc.target/arm/mve/mve_vpt.c: New test. Diff: --- gcc/config/arm/arm-builtins.cc | 16 ++++++++-------- gcc/testsuite/gcc.target/arm/mve/mve_vpt.c | 27 +++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 8 deletions(-) diff --git a/gcc/config/arm/arm-builtins.cc b/gcc/config/arm/arm-builtins.cc index 11d7478d9df..58bf856f08d 100644 --- a/gcc/config/arm/arm-builtins.cc +++ b/gcc/config/arm/arm-builtins.cc @@ -1489,12 +1489,14 @@ arm_lookup_simd_builtin_type (machine_mode mode, } static tree -arm_simd_builtin_type (machine_mode mode, bool unsigned_p, bool poly_p) +arm_simd_builtin_type (machine_mode mode, arm_type_qualifiers qualifiers) { - if (poly_p) + if ((qualifiers & qualifier_poly) != 0) return arm_lookup_simd_builtin_type (mode, qualifier_poly); - else if (unsigned_p) + else if ((qualifiers & qualifier_unsigned) != 0) return arm_lookup_simd_builtin_type (mode, qualifier_unsigned); + else if ((qualifiers & qualifier_predicate) != 0) + return unsigned_intHI_type_node; else return arm_lookup_simd_builtin_type (mode, qualifier_none); } @@ -1755,9 +1757,7 @@ arm_init_builtin (unsigned int fcode, arm_builtin_datum *d, else { eltype - = arm_simd_builtin_type (op_mode, - (qualifiers & qualifier_unsigned) != 0, - (qualifiers & qualifier_poly) != 0); + = arm_simd_builtin_type (op_mode, qualifiers); gcc_assert (eltype != NULL); /* Add qualifiers. */ @@ -1929,10 +1929,10 @@ static void arm_init_crypto_builtins (void) { tree V16UQI_type_node - = arm_simd_builtin_type (V16QImode, true, false); + = arm_simd_builtin_type (V16QImode, qualifier_unsigned); tree V4USI_type_node - = arm_simd_builtin_type (V4SImode, true, false); + = arm_simd_builtin_type (V4SImode, qualifier_unsigned); tree v16uqi_ftype_v16uqi = build_function_type_list (V16UQI_type_node, V16UQI_type_node, diff --git a/gcc/testsuite/gcc.target/arm/mve/mve_vpt.c b/gcc/testsuite/gcc.target/arm/mve/mve_vpt.c new file mode 100644 index 00000000000..28e4697c3c5 --- /dev/null +++ b/gcc/testsuite/gcc.target/arm/mve/mve_vpt.c @@ -0,0 +1,27 @@ +/* { dg-options "-O2" } */ +/* { dg-require-effective-target arm_v8_1m_mve_ok } */ +/* { dg-add-options arm_v8_1m_mve } */ +/* { dg-final { check-function-bodies "**" "" } } */ +#include <arm_mve.h> +void test0 (uint8_t *a, uint8_t *b, uint8_t *c) +{ + uint8x16_t va = vldrbq_u8 (a); + uint8x16_t vb = vldrbq_u8 (b); + mve_pred16_t p = vcmpeqq_u8 (va, vb); + uint8x16_t vc = vaddq_x_u8 (va, vb, p); + vstrbq_p_u8 (c, vc, p); +} +/* +** test0: +** vldrb.8 q[0-9]+, \[r[0-9]+\] +** vldrb.8 q[0-9]+, \[r[0-9]+\] +** vcmp.i8 eq, q[0-9]+, q[0-9]+ +** vmrs (r[0-9]+), p0 @ movhi +** uxth \1, \1 +** vmsr p0, \1 @ movhi +** vpst +** vaddt.i8 (q[0-9]+), q[0-9]+, q[0-9]+ +** vpst +** vstrbt.8 \2, \[r[0-9]+\] +** bx lr +*/
reply other threads:[~2023-02-02 10:02 UTC|newest] Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
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=20230202100222.317F83858C74@sourceware.org \ --to=avieira@gcc.gnu.org \ --cc=gcc-cvs@gcc.gnu.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: linkBe 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).