]> git.ipfire.org Git - thirdparty/gcc.git/commit
internal-fn: Add VCOND_MASK_LEN.
authorRobin Dapp <rdapp@ventanamicro.com>
Wed, 25 Oct 2023 20:19:43 +0000 (22:19 +0200)
committerRobin Dapp <rdapp@ventanamicro.com>
Mon, 6 Nov 2023 11:21:57 +0000 (12:21 +0100)
commit0c42741ad95af3a1e3ac07350da4c3a94865ed63
tree4dd137b298c08345aded697acd25d6c43006d32a
parent89abbaa5fb3823601710394683cf2e2101aba66a
internal-fn: Add VCOND_MASK_LEN.

In order to prevent simplification of a COND_OP with degenerate mask
(CONSTM1_RTX) into just an OP in the presence of length masking this
patch introduces a length-masked analog to VEC_COND_EXPR:
IFN_VCOND_MASK_LEN.

It also adds new match patterns that allow the combination of
unconditional unary, binary and ternay operations with the
VCOND_MASK_LEN into a conditional operation if the target supports it.

gcc/ChangeLog:

PR tree-optimization/111760

* config/riscv/autovec.md (vcond_mask_len_<mode><vm>): Add
expander.
* config/riscv/riscv-protos.h (enum insn_type): Add.
* config/riscv/riscv-v.cc (needs_fp_rounding): Add !pred_mov.
* doc/md.texi: Add vcond_mask_len.
* gimple-match-exports.cc (maybe_resimplify_conditional_op):
Create VCOND_MASK_LEN when length masking.
* gimple-match.h (gimple_match_op::gimple_match_op): Always
initialize len and bias.
* internal-fn.cc (vec_cond_mask_len_direct): Add.
(direct_vec_cond_mask_len_optab_supported_p): Add.
(internal_fn_len_index): Add VCOND_MASK_LEN.
(internal_fn_mask_index): Ditto.
* internal-fn.def (VCOND_MASK_LEN): New internal function.
* match.pd: Combine unconditional unary, binary and ternary
operations into the respective COND_LEN operations.
* optabs.def (OPTAB_D): Add vcond_mask_len optab.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/vect-cond-arith-2.c: No vect cost model for
riscv_v.
gcc/config/riscv/autovec.md
gcc/config/riscv/riscv-protos.h
gcc/config/riscv/riscv-v.cc
gcc/doc/md.texi
gcc/gimple-match-exports.cc
gcc/gimple-match.h
gcc/internal-fn.cc
gcc/internal-fn.def
gcc/match.pd
gcc/optabs.def
gcc/testsuite/gcc.dg/vect/vect-cond-arith-2.c