diff options
author | Stefan Schulze Frielinghaus <stefansf@linux.ibm.com> | 2021-10-11 09:59:13 +0200 |
---|---|---|
committer | Stefan Schulze Frielinghaus <stefansf@linux.ibm.com> | 2021-10-11 09:59:13 +0200 |
commit | 6f966f06146be7689af471d152e18ff50c609d99 (patch) | |
tree | 72af686fdc3b931398a2f5837d57d2a364616302 /libgomp/testsuite/libgomp.c-c++-common/alloc-10.c | |
parent | 9abf8c9534144fe9b4948a3104655983821ca7a1 (diff) | |
download | gcc-6f966f06146be7689af471d152e18ff50c609d99.zip gcc-6f966f06146be7689af471d152e18ff50c609d99.tar.gz gcc-6f966f06146be7689af471d152e18ff50c609d99.tar.bz2 |
ldist: Recognize strlen and rawmemchr like loops
This patch adds support for recognizing loops which mimic the behaviour
of functions strlen and rawmemchr, and replaces those with internal
function calls in case a target provides them. In contrast to the
standard strlen and rawmemchr functions, this patch also supports
different instances where the memory pointed to is interpreted as 8, 16,
and 32-bit sized, respectively.
gcc/ChangeLog:
* builtins.c (get_memory_rtx): Change to external linkage.
* builtins.h (get_memory_rtx): Add function prototype.
* doc/md.texi (rawmemchr<mode>): Document.
* internal-fn.c (expand_RAWMEMCHR): Define.
* internal-fn.def (RAWMEMCHR): Add.
* optabs.def (rawmemchr_optab): Add.
* tree-loop-distribution.c (find_single_drs): Change return code
behaviour by also returning true if no single store was found
but a single load.
(loop_distribution::classify_partition): Respect the new return
code behaviour of function find_single_drs.
(loop_distribution::execute): Call new function
transform_reduction_loop in order to replace rawmemchr or strlen
like loops by calls into builtins.
(generate_reduction_builtin_1): New function.
(generate_rawmemchr_builtin): New function.
(generate_strlen_builtin_1): New function.
(generate_strlen_builtin): New function.
(generate_strlen_builtin_using_rawmemchr): New function.
(reduction_var_overflows_first): New function.
(determine_reduction_stmt_1): New function.
(determine_reduction_stmt): New function.
(loop_distribution::transform_reduction_loop): New function.
gcc/testsuite/ChangeLog:
* gcc.dg/tree-ssa/ldist-rawmemchr-1.c: New test.
* gcc.dg/tree-ssa/ldist-rawmemchr-2.c: New test.
* gcc.dg/tree-ssa/ldist-strlen-1.c: New test.
* gcc.dg/tree-ssa/ldist-strlen-2.c: New test.
* gcc.dg/tree-ssa/ldist-strlen-3.c: New test.
Diffstat (limited to 'libgomp/testsuite/libgomp.c-c++-common/alloc-10.c')
0 files changed, 0 insertions, 0 deletions