From: Robin Dapp <[email protected]> This is now finally the small series to help early-break RVV codegen. The gist is that, as RVV's mask-writing instructions can never guarantee zeros in inactive lanes, masking the compare like on SVE isn't possible without pessimization.
Thus, the idea is to introduce a new early-break "kind" which I called index-based (as opposed to the regular mask based). IMHO the changes are not too invasive and I hope we can keep them contained in the future as well. Patch 1/3 adds a "kind" enum that 2/3 uses and extends. 3/3 are just the riscv target bits. You'll notice that I just left the likely biggest controversy in the patch :) For RVV, we need IFN_COND_LEN_INDEX_FIRST_ACTIVE to return -1 for an empty mask, while the non-cond variant is unspecified, see 2/3. The series was bootstrapped and regtested on top of Tamar's posted patches and there are a few localized regressions still that need fixing (see 3/3). I didn't want to complicate the series, though. Robin Dapp (3): vect: Add early-break kind enum. vect: Add index-based early-break type/kind. RISC-V: Add new early-break patterns. gcc/config/riscv/autovec-opt.md | 32 ------ gcc/config/riscv/autovec.md | 73 ++---------- gcc/config/riscv/riscv-protos.h | 1 + gcc/config/riscv/riscv-v.cc | 36 ++++++ gcc/doc/md.texi | 3 +- .../vect/vect-early-break-no-epilog_3.c | 4 +- .../vect/vect-early-break-no-epilog_4.c | 4 +- .../vect/vect-early-break-no-epilog_5.c | 4 +- .../vect/vect-early-break-no-epilog_6.c | 4 +- .../riscv/rvv/autovec/early-break-1.c | 2 +- .../riscv/rvv/autovec/early-break-2.c | 2 +- .../riscv/rvv/autovec/early-break-3.c | 2 +- .../riscv/rvv/autovec/early-break-4.c | 2 +- gcc/tree-vect-loop.cc | 86 ++++++++++---- gcc/tree-vect-stmts.cc | 105 ++++++++++++++---- gcc/tree-vectorizer.h | 10 ++ 16 files changed, 225 insertions(+), 145 deletions(-) -- 2.56.0
