]> gcc.gnu.org Git - gcc.git/commit
AArch64: Undo vec_widen_<sur>shiftl optabs [PR106346]
authorTamar Christina <tamar.christina@arm.com>
Fri, 4 Aug 2023 12:49:23 +0000 (13:49 +0100)
committerTamar Christina <tamar.christina@arm.com>
Fri, 4 Aug 2023 12:49:23 +0000 (13:49 +0100)
commit451391a6477f5b012faeca42cdba1bfb8e6eecc0
treec30162710652747587d1e89ed3f88b7f634eaf62
parent6b80071a4d05c9535d3bb26cddaed0895a414f59
AArch64: Undo vec_widen_<sur>shiftl optabs [PR106346]

In GCC 11 we implemented the vectorizer optab for widening left shifts,
however this optab is only supported for uniform shift constants.

At the moment GCC still has two loop vectorization strategy (classical loop and
SLP based loop vec) and the optab is implemented as a scalar pattern.

This means that when we apply it to a non-uniform constant inside a loop we only
find out during SLP build that the constants aren't uniform.  At this point it's
too late and we lose SLP entirely.

Over the years I've tried various options but none of it works well:

1. Dissolving patterns during SLP built (problematic, also dissolves them for
non-slp).
2. Optionally ignoring patterns for SLP build (problematic, ends up interfearing
with relevancy detection).
3. Relaxing contraint on SLP build to allow non-constant values and dissolving
them after SLP build using an SLP pattern.  (problematic, ends up breaking
shift reassociation).

As a result we've concluded that for now this pattern should just be removed
and formed during RTL.

The plan is to move this to an SLP only pattern once we remove classical loop
vectorization support from GCC, at which time we can also properly support SVE's
Top and Bottom variants.

This removes the optab and reworks the RTL to recognize both the vector variant
and the intrinsics variant.  Also just simplifies all these patterns.

gcc/ChangeLog:

PR target/106346
* config/aarch64/aarch64-simd.md (vec_widen_<sur>shiftl_lo_<mode>,
vec_widen_<sur>shiftl_hi_<mode>): Remove.
(aarch64_<sur>shll<mode>_internal): Renamed to...
(aarch64_<su>shll<mode>): .. This.
(aarch64_<sur>shll2<mode>_internal): Renamed to...
(aarch64_<su>shll2<mode>): .. This.
(aarch64_<sur>shll_n<mode>, aarch64_<sur>shll2_n<mode>): Re-use new
optabs.
* config/aarch64/constraints.md (D2, DL): New.
* config/aarch64/predicates.md (aarch64_simd_shll_imm_vec): New.

gcc/testsuite/ChangeLog:

PR target/106346
* gcc.target/aarch64/pr98772.c: Adjust assembly.
* gcc.target/aarch64/vect-widen-shift.c: New test.
gcc/config/aarch64/aarch64-simd.md
gcc/config/aarch64/constraints.md
gcc/config/aarch64/predicates.md
gcc/testsuite/gcc.target/aarch64/pr98772.c
gcc/testsuite/gcc.target/aarch64/vect-widen-shift.c [new file with mode: 0644]
This page took 0.06632 seconds and 6 git commands to generate.