mbox

[v4,00/12] ARM/MVE use vectors of boolean for predicates

Message ID 20220222150020.22852-1-christophe.lyon@linaro.org
Headers

Message

Christophe Lyon Feb. 22, 2022, 3 p.m. UTC
  From: Christophe Lyon <christophe.lyon.oss@gmail.com>

This is v4 of this patch series, fixing issues I discovered before
committing v2 (which had been approved).  I am posting it for the
record of what I am going commit after I implemented all the requested
changes to v3.

Thanks a lot to Richard Sandiford for his help.

Most of the work of this patch series was carried out while I was
working at STMicroelectronics as a Linaro assignee.

The changes v3 -> v4 are:

Patch 5: Use build_truth_vector_type_for_mode to construct the boolean
types. Also fix the definition of B2Imode etc in init_emit_once.

Patches 6 and 7: Squash code change and testcases as requested during
the review.

Original text (patch numbers no longer match because of the squashes):

This patch series addresses PR 100757 and 101325 by representing
vectors of predicates (MVE VPR.P0 register) as vectors of booleans
rather than using HImode.

As this implies a lot of mostly mechanical changes, I have tried to
split the patches in a way that should help reviewers, but the split
is a bit artificial.

Patches 1-3 add new tests.

Patches 4-6 are small independent improvements.

Patch 7 implements the predicate qualifier, but does not change any
builtin yet.

Patch 8 is the first of the two main patches, and uses the new
qualifier to describe the vcmp and vpsel builtins that are useful for
auto-vectorization of comparisons.

Patch 9 is the second main patch, which fixes the vcond_mask expander.

Patches 10-13 convert almost all the remaining builtins with HI
operands to use the predicate qualifier.  After these, there are still
a few builtins with HI operands left, about which I am not sure: vctp,
vpnot, load-gather and store-scatter with v2di operands.  In fact,
patches 11/12 update some STR/LDR qualifiers in a way that breaks
these v2di builtins although existing tests still pass.

Christophe Lyon (12):
  arm: Add new tests for comparison vectorization with Neon and MVE
  arm: Add GENERAL_AND_VPR_REGS regclass
  arm: Add support for VPR_REG in arm_class_likely_spilled_p
  arm: Fix mve_vmvnq_n_<supf><mode> argument mode
  arm: Implement MVE predicates as vectors of booleans
  arm: Implement auto-vectorized MVE comparisons with vectors of boolean
    predicates
  arm: Fix vcond_mask expander for MVE (PR target/100757)
  arm: Convert remaining MVE vcmp builtins to predicate qualifiers
  arm: Convert more MVE builtins to predicate qualifiers
  arm: Convert more load/store MVE builtins to predicate qualifiers
  arm: Convert more MVE/CDE builtins to predicate qualifiers
  arm: Add VPR_REG to ALL_REGS

 gcc/config/aarch64/aarch64-modes.def          |   8 +-
 gcc/config/arm/arm-builtins.cc                | 239 ++++--
 gcc/config/arm/arm-builtins.h                 |   4 +-
 gcc/config/arm/arm-modes.def                  |   8 +
 gcc/config/arm/arm-protos.h                   |   4 +-
 gcc/config/arm/arm-simd-builtin-types.def     |   4 +
 gcc/config/arm/arm.cc                         | 166 ++--
 gcc/config/arm/arm.h                          |   9 +-
 gcc/config/arm/arm_mve_builtins.def           | 746 ++++++++--------
 gcc/config/arm/constraints.md                 |   6 +
 gcc/config/arm/iterators.md                   |   6 +
 gcc/config/arm/mve.md                         | 795 ++++++++++--------
 gcc/config/arm/neon.md                        |  39 +
 gcc/config/arm/vec-common.md                  |  52 --
 gcc/config/arm/vfp.md                         |  34 +-
 gcc/doc/sourcebuild.texi                      |   4 +
 gcc/emit-rtl.cc                               |  28 +-
 gcc/genmodes.cc                               |  71 +-
 gcc/machmode.def                              |  11 +-
 gcc/rtx-vector-builder.cc                     |   4 +-
 gcc/simplify-rtx.cc                           |  34 +-
 gcc/testsuite/gcc.dg/rtl/arm/mve-vxbi.c       |  89 ++
 gcc/testsuite/gcc.dg/signbit-2.c              |   1 +
 .../gcc.target/arm/simd/mve-vcmp-f32-2.c      |  32 +
 .../gcc.target/arm/simd/neon-compare-1.c      |  78 ++
 .../gcc.target/arm/simd/neon-compare-2.c      |  13 +
 .../gcc.target/arm/simd/neon-compare-3.c      |  14 +
 .../arm/simd/neon-compare-scalar-1.c          |  57 ++
 .../gcc.target/arm/simd/neon-vcmp-f16.c       |  12 +
 .../gcc.target/arm/simd/neon-vcmp-f32-2.c     |  15 +
 .../gcc.target/arm/simd/neon-vcmp-f32-3.c     |  12 +
 .../gcc.target/arm/simd/neon-vcmp-f32.c       |  12 +
 gcc/testsuite/gcc.target/arm/simd/neon-vcmp.c |  22 +
 .../gcc.target/arm/simd/pr100757-2.c          |  20 +
 .../gcc.target/arm/simd/pr100757-3.c          |  20 +
 .../gcc.target/arm/simd/pr100757-4.c          |  19 +
 gcc/testsuite/gcc.target/arm/simd/pr100757.c  |  19 +
 .../gcc.target/arm/simd/pr101325-2.c          |  19 +
 gcc/testsuite/gcc.target/arm/simd/pr101325.c  |  14 +
 gcc/testsuite/lib/target-supports.exp         |  15 +-
 gcc/varasm.cc                                 |   7 +-
 41 files changed, 1738 insertions(+), 1024 deletions(-)
 create mode 100644 gcc/testsuite/gcc.dg/rtl/arm/mve-vxbi.c
 create mode 100644 gcc/testsuite/gcc.target/arm/simd/mve-vcmp-f32-2.c
 create mode 100644 gcc/testsuite/gcc.target/arm/simd/neon-compare-1.c
 create mode 100644 gcc/testsuite/gcc.target/arm/simd/neon-compare-2.c
 create mode 100644 gcc/testsuite/gcc.target/arm/simd/neon-compare-3.c
 create mode 100644 gcc/testsuite/gcc.target/arm/simd/neon-compare-scalar-1.c
 create mode 100644 gcc/testsuite/gcc.target/arm/simd/neon-vcmp-f16.c
 create mode 100644 gcc/testsuite/gcc.target/arm/simd/neon-vcmp-f32-2.c
 create mode 100644 gcc/testsuite/gcc.target/arm/simd/neon-vcmp-f32-3.c
 create mode 100644 gcc/testsuite/gcc.target/arm/simd/neon-vcmp-f32.c
 create mode 100644 gcc/testsuite/gcc.target/arm/simd/neon-vcmp.c
 create mode 100644 gcc/testsuite/gcc.target/arm/simd/pr100757-2.c
 create mode 100644 gcc/testsuite/gcc.target/arm/simd/pr100757-3.c
 create mode 100644 gcc/testsuite/gcc.target/arm/simd/pr100757-4.c
 create mode 100644 gcc/testsuite/gcc.target/arm/simd/pr100757.c
 create mode 100644 gcc/testsuite/gcc.target/arm/simd/pr101325-2.c
 create mode 100644 gcc/testsuite/gcc.target/arm/simd/pr101325.c