aboutsummaryrefslogtreecommitdiff
path: root/gcc/builtins.h
diff options
context:
space:
mode:
authorStefan Schulze Frielinghaus <stefansf@linux.ibm.com>2021-10-11 09:59:13 +0200
committerStefan Schulze Frielinghaus <stefansf@linux.ibm.com>2021-10-11 09:59:13 +0200
commit6f966f06146be7689af471d152e18ff50c609d99 (patch)
tree72af686fdc3b931398a2f5837d57d2a364616302 /gcc/builtins.h
parent9abf8c9534144fe9b4948a3104655983821ca7a1 (diff)
downloadgcc-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 'gcc/builtins.h')
-rw-r--r--gcc/builtins.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/gcc/builtins.h b/gcc/builtins.h
index d330b78..5e4d86e 100644
--- a/gcc/builtins.h
+++ b/gcc/builtins.h
@@ -146,6 +146,7 @@ extern char target_percent_s[3];
extern char target_percent_c[3];
extern char target_percent_s_newline[4];
extern bool target_char_cst_p (tree t, char *p);
+extern rtx get_memory_rtx (tree exp, tree len);
extern internal_fn associated_internal_fn (tree);
extern internal_fn replacement_internal_fn (gcall *);