Add optabs for accelerating RAW and WAR alias checks

Jeff Law law@redhat.com
Sun Nov 17 17:56:00 GMT 2019


On 11/16/19 8:39 AM, Richard Sandiford wrote:
> This patch adds optabs that check whether a read followed by a write
> or a write followed by a read can be divided into interleaved byte
> accesses without changing the dependencies between the bytes.
> This is one of the uses of the SVE2 WHILERW and WHILEWR instructions.
> (The instructions can also be used to limit the VF at runtime,
> but that's future work.)
> 
> This applies on top of:
> 
>   https://gcc.gnu.org/ml/gcc-patches/2019-11/msg00787.html
> 
> Tested on aarch64-linux-gnu and x86_64-linux-gnu.  OK to install?
> 
> Richard
> 
> 
> 2019-11-16  Richard Sandiford  <richard.sandiford@arm.com>
> 
> gcc/
> 	* doc/sourcebuild.texi (vect_check_ptrs): Document.
> 	* optabs.def (check_raw_ptrs_optab, check_war_ptrs_optab): New optabs.
> 	* doc/md.texi: Document them.
> 	* internal-fn.def (IFN_CHECK_RAW_PTRS, IFN_CHECK_WAR_PTRS): New
> 	internal functions.
> 	* internal-fn.h (internal_check_ptrs_fn_supported_p): Declare.
> 	* internal-fn.c (check_ptrs_direct): New macro.
> 	(expand_check_ptrs_optab_fn): Likewise.
> 	(direct_check_ptrs_optab_supported_p): Likewise.
> 	(internal_check_ptrs_fn_supported_p): New fuction.
> 	* tree-data-ref.c: Include internal-fn.h.
> 	(create_ifn_alias_checks): New function.
> 	(create_intersect_range_checks): Use it.
> 	* config/aarch64/iterators.md (SVE2_WHILE_PTR): New int iterator.
> 	(optab, cmp_op): Handle it.
> 	(raw_war, unspec): New int attributes.
> 	* config/aarch64/aarch64.md (UNSPEC_WHILERW, UNSPEC_WHILE_WR): New
> 	constants.
> 	* config/aarch64/predicates.md (aarch64_bytes_per_sve_vector_operand):
> 	New predicate.
> 	* config/aarch64/aarch64-sve2.md (check_<raw_war>_ptrs<mode>): New
> 	expander.
> 	(@aarch64_sve2_while<cmp_op><GPI:mode><PRED_ALL:mode>_ptest): New
> 	pattern.
> 
> gcc/testsuite/
> 	* lib/target-supports.exp (check_effective_target_vect_check_ptrs):
> 	New procedure.
> 	* gcc.dg/vect/vect-alias-check-14.c: Expect IFN_CHECK_WAR to be
> 	used, if available.
> 	* gcc.dg/vect/vect-alias-check-15.c: Likewise.
> 	* gcc.dg/vect/vect-alias-check-16.c: Likewise IFN_CHECK_RAW.
> 	* gcc.target/aarch64/sve2/whilerw_1.c: New test.
> 	* gcc.target/aarch64/sve2/whilewr_1.c: Likewise.
> 	* gcc.target/aarch64/sve2/whilewr_2.c: Likewise.
>
OK
jeff



More information about the Gcc-patches mailing list