]> git.ipfire.org Git - thirdparty/gcc.git/commit - gcc/internal-fn.c
Add support for masked load/store_lanes
authorRichard Sandiford <richard.sandiford@linaro.org>
Sat, 13 Jan 2018 17:57:57 +0000 (17:57 +0000)
committerRichard Sandiford <rsandifo@gcc.gnu.org>
Sat, 13 Jan 2018 17:57:57 +0000 (17:57 +0000)
commit7e11fc7f5cecffe650b672ac1af212d4bd9f1335
treebdbe6dcf4a77cd6837eba958b6c08cef87276a2f
parentabc8eb9a45654662092ce1b6d452c13ee80be954
Add support for masked load/store_lanes

This patch adds support for vectorising groups of IFN_MASK_LOADs
and IFN_MASK_STOREs using conditional load/store-lanes instructions.
This requires new internal functions to represent the result
(IFN_MASK_{LOAD,STORE}_LANES), as well as associated optabs.

The normal IFN_{LOAD,STORE}_LANES functions are const operations
that logically just perform the permute: the load or store is
encoded as a MEM operand to the call statement.  In contrast,
the IFN_MASK_{LOAD,STORE}_LANES functions use the same kind of
interface as IFN_MASK_{LOAD,STORE}, since the memory is only
conditionally accessed.

The AArch64 patterns were added as part of the main LD[234]/ST[234] patch.

2018-01-13  Richard Sandiford  <richard.sandiford@linaro.org>
    Alan Hayward  <alan.hayward@arm.com>
    David Sherwood  <david.sherwood@arm.com>

gcc/
* doc/md.texi (vec_mask_load_lanes@var{m}@var{n}): Document.
(vec_mask_store_lanes@var{m}@var{n}): Likewise.
* optabs.def (vec_mask_load_lanes_optab): New optab.
(vec_mask_store_lanes_optab): Likewise.
* internal-fn.def (MASK_LOAD_LANES): New internal function.
(MASK_STORE_LANES): Likewise.
* internal-fn.c (mask_load_lanes_direct): New macro.
(mask_store_lanes_direct): Likewise.
(expand_mask_load_optab_fn): Handle masked operations.
(expand_mask_load_lanes_optab_fn): New macro.
(expand_mask_store_optab_fn): Handle masked operations.
(expand_mask_store_lanes_optab_fn): New macro.
(direct_mask_load_lanes_optab_supported_p): Likewise.
(direct_mask_store_lanes_optab_supported_p): Likewise.
* tree-vectorizer.h (vect_store_lanes_supported): Take a masked_p
parameter.
(vect_load_lanes_supported): Likewise.
* tree-vect-data-refs.c (strip_conversion): New function.
(can_group_stmts_p): Likewise.
(vect_analyze_data_ref_accesses): Use it instead of checking
for a pair of assignments.
(vect_store_lanes_supported): Take a masked_p parameter.
(vect_load_lanes_supported): Likewise.
* tree-vect-loop.c (vect_analyze_loop_2): Update calls to
vect_store_lanes_supported and vect_load_lanes_supported.
* tree-vect-slp.c (vect_analyze_slp_instance): Likewise.
* tree-vect-stmts.c (get_group_load_store_type): Take a masked_p
parameter.  Don't allow gaps for masked accesses.
Use vect_get_store_rhs.  Update calls to vect_store_lanes_supported
and vect_load_lanes_supported.
(get_load_store_type): Take a masked_p parameter and update
call to get_group_load_store_type.
(vectorizable_store): Update call to get_load_store_type.
Handle IFN_MASK_STORE_LANES.
(vectorizable_load): Update call to get_load_store_type.
Handle IFN_MASK_LOAD_LANES.

gcc/testsuite/
* gcc.dg/vect/vect-ooo-group-1.c: New test.
* gcc.target/aarch64/sve/mask_struct_load_1.c: Likewise.
* gcc.target/aarch64/sve/mask_struct_load_1_run.c: Likewise.
* gcc.target/aarch64/sve/mask_struct_load_2.c: Likewise.
* gcc.target/aarch64/sve/mask_struct_load_2_run.c: Likewise.
* gcc.target/aarch64/sve/mask_struct_load_3.c: Likewise.
* gcc.target/aarch64/sve/mask_struct_load_3_run.c: Likewise.
* gcc.target/aarch64/sve/mask_struct_load_4.c: Likewise.
* gcc.target/aarch64/sve/mask_struct_load_5.c: Likewise.
* gcc.target/aarch64/sve/mask_struct_load_6.c: Likewise.
* gcc.target/aarch64/sve/mask_struct_load_7.c: Likewise.
* gcc.target/aarch64/sve/mask_struct_load_8.c: Likewise.
* gcc.target/aarch64/sve/mask_struct_store_1.c: Likewise.
* gcc.target/aarch64/sve/mask_struct_store_1_run.c: Likewise.
* gcc.target/aarch64/sve/mask_struct_store_2.c: Likewise.
* gcc.target/aarch64/sve/mask_struct_store_2_run.c: Likewise.
* gcc.target/aarch64/sve/mask_struct_store_3.c: Likewise.
* gcc.target/aarch64/sve/mask_struct_store_3_run.c: Likewise.
* gcc.target/aarch64/sve/mask_struct_store_4.c: Likewise.

Co-Authored-By: Alan Hayward <alan.hayward@arm.com>
Co-Authored-By: David Sherwood <david.sherwood@arm.com>
From-SVN: r256620
30 files changed:
gcc/ChangeLog
gcc/doc/md.texi
gcc/internal-fn.c
gcc/internal-fn.def
gcc/optabs.def
gcc/testsuite/ChangeLog
gcc/testsuite/gcc.dg/vect/vect-ooo-group-1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_1_run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_2_run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_3_run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_4.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_5.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_6.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_7.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_load_8.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_store_1.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_store_1_run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_store_2.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_store_2_run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_store_3.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_store_3_run.c [new file with mode: 0644]
gcc/testsuite/gcc.target/aarch64/sve/mask_struct_store_4.c [new file with mode: 0644]
gcc/tree-vect-data-refs.c
gcc/tree-vect-loop.c
gcc/tree-vect-slp.c
gcc/tree-vect-stmts.c
gcc/tree-vectorizer.h