]> git.ipfire.org Git - thirdparty/gcc.git/commit
vect: Adjust vectorizable_store costing on VMAT_ELEMENTWISE and VMAT_STRIDED_SLP
authorKewen Lin <linkw@linux.ibm.com>
Thu, 12 Oct 2023 05:04:57 +0000 (00:04 -0500)
committerKewen Lin <linkw@linux.ibm.com>
Thu, 12 Oct 2023 05:04:57 +0000 (00:04 -0500)
commit8b151eb96b909094050b0be2a204b578b154ee93
treea28912632a7640bf427582041fc9f09ee1cc1aa4
parent7184d2257a0d927e6e3736ba0a169d557e673ad5
vect: Adjust vectorizable_store costing on VMAT_ELEMENTWISE and VMAT_STRIDED_SLP

This patch adjusts the cost handling on VMAT_ELEMENTWISE
and VMAT_STRIDED_SLP in function vectorizable_store.  We
don't call function vect_model_store_cost for them any more.

Like what we improved for PR82255 on load side, this change
helps us to get rid of unnecessary vec_to_scalar costing
for some case with VMAT_STRIDED_SLP.  One typical test case
gcc.dg/vect/costmodel/ppc/costmodel-vect-store-1.c has been
associated.  And it helps some cases with some inconsistent
costing too.

Besides, this also special-cases the interleaving stores
for these two affected memory access types, since for the
interleaving stores the whole chain is vectorized when the
last store in the chain is reached, the other stores in the
group would be skipped.  To keep consistent with this and
follows the transforming handlings like iterating the whole
group, it only costs for the first store in the group.
Ideally we can only cost for the last one but it's not
trivial and using the first one is actually equivalent.

gcc/ChangeLog:

* tree-vect-stmts.cc (vect_model_store_cost): Assert it won't get
VMAT_ELEMENTWISE and VMAT_STRIDED_SLP any more, and remove their
related handlings.
(vectorizable_store): Adjust the cost handling on VMAT_ELEMENTWISE
and VMAT_STRIDED_SLP without calling vect_model_store_cost.

gcc/testsuite/ChangeLog:

* gcc.dg/vect/costmodel/ppc/costmodel-vect-store-1.c: New test.
gcc/testsuite/gcc.dg/vect/costmodel/ppc/costmodel-vect-store-1.c [new file with mode: 0644]
gcc/tree-vect-stmts.cc