]> git.ipfire.org Git - thirdparty/gcc.git/commit
cleanup: make all cond_len_* and mask_len_* consistent on the order of mask and len
authorJuzhe-Zhong <juzhe.zhong@rivai.ai>
Fri, 21 Jul 2023 02:09:00 +0000 (10:09 +0800)
committerLehua Ding <lehua.ding@rivai.ai>
Fri, 21 Jul 2023 08:34:45 +0000 (16:34 +0800)
commit363bb3dca429e885ce3d134fc50f8ab05aacda0f
tree69fbfa924da847e17b53b31bbabafcd0981c53c6
parentbd68b33f80ae4726393dbd6e12025f99dc269c12
cleanup: make all cond_len_* and mask_len_* consistent on the order of mask and len

This patch is depending on:
https://gcc.gnu.org/pipermail/gcc-patches/2023-July/625121.html

Hi, Richard and Richi.

This patch is to align the order of mask and len.

Currently, According to this piece code:
if (final_len && final_mask)
  call = gimple_build_call_internal (
    IFN_LEN_MASK_GATHER_LOAD, 7, dataref_ptr,
    vec_offset, scale, zero, final_mask, final_len,
    bias);

You can see the order of mask and len, is {mask,len,bias}.
"mask" comes before "len". The reason of this order is that we want to
reuse the current codes of MASK_GATHER_LOAD/MASK_SCATTER_STORE.

Same situation for COND_LEN_*, we want to reuse the codes of COND_*.

Reusing codes from the existing MASK_* or COND_* can allow us not to
change the codes too much and make the codes elegant and easy to maintain && read.

To avoid any confusions of auto-vectorization patterns that includes both mask and len,

this patch align the order of mask and len for both Gimple IR and RTL pattern into

{mask, len, bias} to make everything cleaner and more elegant.

Bootstrap and Regression is on the way.

gcc/ChangeLog:

* config/riscv/autovec.md: Align order of mask and len.
* config/riscv/riscv-v.cc (expand_load_store): Ditto.
(expand_gather_scatter): Ditto.
* doc/md.texi: Ditto.
* internal-fn.cc (add_len_and_mask_args): Ditto.
(add_mask_and_len_args): Ditto.
(expand_partial_load_optab_fn): Ditto.
(expand_partial_store_optab_fn): Ditto.
(expand_scatter_store_optab_fn): Ditto.
(expand_gather_load_optab_fn): Ditto.
(internal_fn_len_index): Ditto.
(internal_fn_mask_index): Ditto.
(internal_len_load_store_bias): Ditto.
* tree-vect-stmts.cc (vectorizable_store): Ditto.
(vectorizable_load): Ditto.
gcc/config/riscv/autovec.md
gcc/config/riscv/riscv-v.cc
gcc/doc/md.texi
gcc/internal-fn.cc
gcc/tree-vect-stmts.cc