]> git.ipfire.org Git - thirdparty/gcc.git/commit
arm: [MVE intrinsics] Fix support for predicate constants [PR target/114801]
authorChristophe Lyon <christophe.lyon@linaro.org>
Sun, 24 Nov 2024 18:08:48 +0000 (18:08 +0000)
committerChristophe Lyon <christophe.lyon@linaro.org>
Thu, 9 Jan 2025 13:49:11 +0000 (13:49 +0000)
commit61de759f943ce0a5981affeee19debc82ec43744
treee291fa7ae88a238bcb1cd1afcb09e33cfcbc8796
parent409e766bea64027da3442c30c29799d37f802733
arm: [MVE intrinsics] Fix support for predicate constants [PR target/114801]

This backport is a cherry pick of commit
2089009210a1774c37e527ead8bbcaaa1a7a9d2d, with a small change needed
because force_lowpart_subreg does not exist in gcc-14: the patch
replaces it with the equivalent:

-    x = force_lowpart_subreg (mode, x, GET_MODE (x));
+    {
+      auto byte = subreg_lowpart_offset (mode, GET_MODE (x));
+      x = force_subreg (mode, x, GET_MODE (x), byte);
+    }

In this PR, we have to handle a case where MVE predicates are supplied
as a const_int, where individual predicates have illegal boolean
values (such as 0xc for a 4-bit boolean predicate).  To avoid the ICE,
fix the constant (any non-zero value is converted to all 1s) and emit
a warning.

On MVE, V8BI and V4BI multi-bit masks are interpreted byte-by-byte at
instruction level, but end-users should describe lanes rather than
bytes (so all bytes of a true-predicated lane should be '1'), see the
section on MVE intrinsics in the Arm ACLE specification.

Since force_lowpart_subreg cannot handle const_int (because they have VOID mode),
use gen_lowpart on them, force_lowpart_subreg otherwise.

2024-11-20  Christophe Lyon  <christophe.lyon@linaro.org>
    Jakub Jelinek  <jakub@redhat.com>

PR target/114801
gcc/
* config/arm/arm-mve-builtins.cc
(function_expander::add_input_operand): Handle CONST_INT
predicates.

gcc/testsuite/
* gcc.target/arm/mve/pr108443.c: Update predicate constant.
* gcc.target/arm/mve/pr108443-run.c: Likewise.
* gcc.target/arm/mve/pr114801.c: New test.

(cherry picked from commit 2089009210a1774c37e527ead8bbcaaa1a7a9d2d)
gcc/config/arm/arm-mve-builtins.cc
gcc/testsuite/gcc.target/arm/mve/pr108443-run.c
gcc/testsuite/gcc.target/arm/mve/pr108443.c
gcc/testsuite/gcc.target/arm/mve/pr114801.c [new file with mode: 0644]