summaryrefslogtreecommitdiffstats
path: root/gcc/testsuite/gcc.c-torture/execute/string-opt-5.c
Commit message (Collapse)AuthorAgeFilesLines
* * builtins.c (target_char_cast): New function.jakub2000-12-011-1/+23
| | | | | | | | | | | | | | (expand_builtin_strchr): Use it. (expand_builtin_strrchr): Use it. (builtin_memset_read_str): New function. (expand_builtin_memset): Use target_char_cast. Try to optimize memset with second argument non-zero using store_by_pieces. * gcc.c-torture/execute/string-opt-5.c: Add some memset tests. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37918 138bc75d-0d04-0410-961f-82ee72b054a4
* * expr.h (store_by_pieces): Add prototype.jakub2000-11-291-1/+28
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | (can_store_by_pieces): Likewise. * expr.c (struct store_by_pieces): Renamed from clear_by_pieces. (can_store_by_pieces): New. (store_by_pieces): New. (clear_by_pieces): New. (clear_by_pieces_1): New. (store_by_pieces_1): Renamed from clear_by_pieces, handle storing arbitrary compiler generated constants into memory block. (store_by_pieces_2): Renamed from clear_by_pieces_1, likewise. * builtins.c (c_readstr): New. (builtin_memcpy_read_str): New. (expand_builtin_memcpy): If src is string constant and emit_block_move would move it by pieces, compute integer constants from the string and store it into memory block instead. (builtin_strncpy_read_str): New. (expand_builtin_strncpy): If N is not constant zero and c_strlen does not return INTEGER_CST, don't optimize. If N is larger than strlen(src) + 1, try to copy the string including padding with store_by_pieces. (expand_builtin_strcmp): If both arguments have side effects, don't optimize. (expand_builtin_fputs): If STR has side effects, don't optimize. * gcc.c-torture/execute/string-opt-5.c: Add some strcmp and strncpy tests. * gcc.c-torture/execute/string-opt-6.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37851 138bc75d-0d04-0410-961f-82ee72b054a4
* * builtins.c (c_strlen): Use TREE_STRING_LENGTH - 1 for max.jakub2000-11-091-0/+58
(c_getstr): New function. (expand_builtin_strstr): Do nothing if -fcheck-memory-usage. If both arguments are constant string, optimize out. (expand_builtin_strchr, expand_builtin_strrchr): New functions. (expand_builtin_strpbrk): Use c_getstr, do nothing if -fcheck-memory-usage. (expand_builtin_fputs): Likewise. (expand_builtin_strcmp): Add MODE argument. Use even if !HAVE_cmpstrsi. Optimize the case when both arguments are constant strings. (expand_builtin): Adjust expand_builtin_strcmp caller. Call expand_builtin_strchr and expand_builtin_strrchr. * c-common.c (c_common_nodes_and_builtins): Add strchr and strrchr builtins. * builtins.def (BUILT_IN_STRRCHR): Add. * gcc.c-torture/execute/string-opt-1.c: Add test for strstr with both arguments constant strings. * gcc.c-torture/execute/string-opt-3.c: New test. * gcc.c-torture/execute/string-opt-4.c: New test. * gcc.c-torture/execute/string-opt-5.c: New test. git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@37338 138bc75d-0d04-0410-961f-82ee72b054a4
OpenPOWER on IntegriCloud