Go to file
Richard Sandiford 67dbe5829e Move fold_trunc_transparent_mathfn to match.pd
This moves the fold rules for trunc, floor, ceil, round, nearbyint and
rint in one go, since they're tested as a group.  Most of the code is
supporting the f(x)->x fold when x is known to be integer-valued.
Like with the non-negative test, this is probably more elegantly handled
by tracking range information for reals, but until that happens, I think
we should handle it analogously to tree_expr_nonnegative_p.

I've incorporated the fix for PR68031 in the new version of
integer_valued_real_p.  However, it seemed confusing to test for an
SSA name at the head of the function rather than the case statement,
and not fall through to tree_simple_nonnegative_warnv_p (which
conceptually shouldn't care whether an update is in progress).
But tree_simple_nonnegative_warnv_p is a no-op for SSA names,
so I simply changed it to:

          return (!name_registered_for_update_p (t)
	      && depth < PARAM_VALUE (PARAM_MAX_SSA_NAME_QUERY_DEPTH)
	      && gimple_stmt_nonnegative_warnv_p (SSA_NAME_DEF_STMT (t),
						  strict_overflow_p, depth));

and used that in the new code too.

Doing these folds later meant that IPA would start to use information
about the aborting sinf and floor in 20030125-1.c before the folds
kicked in.  I changed them from noinline to weak to stop that.

Tested on x86_64-linux-gnu, aarch64-linux-gnu and arm-linux-gnueabi.

gcc/
	* builtins.c (integer_valued_real_p): Move to fold-const.c.
	(fold_trunc_transparent_mathfn, fold_builtin_trunc, fold_builtin_floor)
	(fold_builtin_ceil, fold_builtin_round): Delete.
	(fold_builtin_1): Handle constant trunc, floor, ceil and round
	arguments here.
	* convert.c (convert_to_real): Remove narrowing of rounding
	functions.
	* fold-const.h (integer_valued_real_unary_p)
	(integer_valued_real_binary_p, integer_valued_real_call_p)
	(integer_valued_real_single_p, integer_valued_real_p): Declare.
	* fold-const.c (tree_single_nonnegative_warnv_p): Move
	name_registered_for_update_p check to SSA_NAME case statement.
	Don't call tree_simple_nonnegative_warnv_p for SSA names.
	(integer_valued_real_unary_p, integer_valued_real_binary_p)
	(integer_valued_real_call_p, integer_valued_real_single_p)
	(integer_valued_real_invalid_p): New functions.
	(integer_valued_real_p): Move from fold-const.c and rework
	to call the functions above.  Handle SSA names.
	* gimple-fold.h (gimple_stmt_integer_valued_real_p): Declare.
	* gimple-fold.c (gimple_assign_integer_valued_real_p)
	(gimple_call_integer_valued_real_p, gimple_phi_integer_valued_real_p)
	(gimple_stmt_integer_valued_real_p): New functions.
	* match.pd: Fold f(f(x))->f(x) for fp->fp rounding functions f.
	Fold f(x)->x for the same f if x is known to be integer-valued.
	Fold f(extend(x))->extend(f'(x)) if doing so doesn't affect
	the result.  Canonicalize floor(x) as trunc(x) if x is
	nonnegative.

gcc/testsuite/
	* gcc.c-torture/execute/20030125-1.c (floor, floorf, sin, sinf):
	Make weak rather than noinline.
	* gcc.dg/builtins-57.c: Compile with -O.
	* gcc.dg/torture/builtin-integral-1.c: Skip for -O0.

From-SVN: r229221
2015-10-23 10:01:47 +00:00
INSTALL README: Do not mention CVS. 2014-10-12 15:05:28 +00:00
boehm-gc Testsuite: add dg-{begin|end}-multiline-output commands 2015-10-09 13:55:23 +00:00
config libsanitizer merge from upstream r250806, compiler part. 2015-10-21 10:40:54 +03:00
contrib Make sure that contrib/download_prerequisites is run from correct place 2015-09-11 06:09:36 +00:00
fixincludes inclhack.def (aix_stdio_inline): New fix. 2015-08-14 07:17:29 -04:00
gcc Move fold_trunc_transparent_mathfn to match.pd 2015-10-23 10:01:47 +00:00
gnattools configure.ac (*-*-dragonfly*): New configuration. 2015-06-08 07:27:56 +00:00
gotools gotools: Bump to automake 1.11.6 2015-05-13 10:59:14 +00:00
include Fix PR63758 by using the _NSGetEnviron() API on Darwin 2015-10-18 10:33:37 +00:00
intl Makefile.def (libiconv): Define bootstrap=true. 2015-08-07 01:13:52 -04:00
libada re PR target/65351 (libiberty's pic version contains non-pic code on m32 darwin; causes bootstrap fail building libcc1.) 2015-04-10 06:43:52 +00:00
libatomic Testsuite: add dg-{begin|end}-multiline-output commands 2015-10-09 13:55:23 +00:00
libbacktrace posix.c (backtrace_open): Cast second argument of open() to int. 2015-09-17 13:08:04 -04:00
libcc1 hash-traits.h (free_ptr_hash): New class. 2015-06-25 17:06:24 +00:00
libcilkrts libcilkrts: Bump to automake 1.11.6 2015-05-13 11:01:24 +00:00
libcpp [PATCH 2/9] ENABLE_CHECKING refactoring: libcpp 2015-10-21 16:22:03 -06:00
libdecnumber IA MCU psABI support: changes to libraries 2015-06-30 09:42:07 -07:00
libffi [RS6000] Correct powerpc sysv stack argument accounting 2015-10-01 06:59:00 +09:30
libgcc divmodqi.S: Return 0x00 by default for div by 0. 2015-10-16 17:47:07 -04:00
libgfortran re PR libfortran/67527 (io.h sanitizer complains on 1 << 31) 2015-09-12 12:05:44 +00:00
libgo Testsuite: add dg-{begin|end}-multiline-output commands 2015-10-09 13:55:23 +00:00
libgomp reduction-5.c: Set sane vector_length. 2015-10-20 21:09:09 +00:00
libiberty Fix PR63758 by using the _NSGetEnviron() API on Darwin 2015-10-18 10:33:37 +00:00
libitm Testsuite: add dg-{begin|end}-multiline-output commands 2015-10-09 13:55:23 +00:00
libjava configure.ac (tools/gjdoc): Depend on CREATE_WRAPPERS. 2015-08-11 19:59:25 +02:00
libmpx re PR other/66887 (trunk/libmpx/mpxrt/mpxrt.c:158: possible performance problem) 2015-10-15 09:26:39 +00:00
libobjc stop including tm.h in sendmsg.c 2015-09-12 22:19:11 +00:00
liboffloadmic builtin-types.def (BT_FN_BOOL_UINT_LONGPTR_LONGPTR_LONGPTR, [...]): New. 2015-10-13 21:06:23 +02:00
libquadmath Makefile.am (libquadmath_la_SOURCES): Add math/logbq.c. 2015-08-09 08:46:52 +00:00
libsanitizer Update HOWTO_MERGE file for libsanitizer. 2015-10-23 11:50:30 +03:00
libssp libssp: Bump to automake 1.11.6 2015-05-13 11:12:39 +00:00
libstdc++-v3 * include/std/type_traits (__cpp_lib_bool_constant): Define. 2015-10-21 22:20:25 +01:00
libvtv Enable VTV for aarch64 and arm 2015-10-20 10:39:30 +00:00
lto-plugin configure.ac: Add AC_USE_SYSTEM_EXTENSIONS. 2015-07-02 10:30:07 +02:00
maintainer-scripts update_version_svn: Add gcc-4_8-branch to IGNORE_BRANCHES. 2015-06-23 07:48:06 +00:00
zlib zlib: Bump to automake 1.11.6 2015-05-13 11:31:32 +00:00
.dir-locals.el * .dir-locals.el: Add. 2013-10-16 18:25:31 +00:00
.gitignore Local Vim config with GNU formatting. 2014-12-09 13:45:47 +00:00
ABOUT-NLS
COPYING
COPYING.LIB
COPYING.RUNTIME
COPYING3
COPYING3.LIB
ChangeLog MAINTAINERS: Update email address. 2015-10-23 11:51:32 +02:00
ChangeLog.jit Merger of dmalcolm/jit branch from git 2014-11-11 21:55:52 +00:00
ChangeLog.tree-ssa
MAINTAINERS MAINTAINERS: Update email address. 2015-10-23 11:51:32 +02:00
Makefile.def re PR libfortran/54572 (Use libbacktrace library) 2015-08-23 21:50:30 +00:00
Makefile.in re PR libfortran/54572 (Use libbacktrace library) 2015-08-23 21:50:30 +00:00
Makefile.tpl revert: configure.ac: Add -std=c++98 to stage1_cxxflags. 2015-05-21 13:05:33 -04:00
README * README: Document use of ranges of years in copyright notices. 2012-07-16 15:01:34 +01:00
compile Update from upstream Automake files. 2014-11-16 14:07:13 +00:00
config-ml.in re PR other/66259 (Combined gcc and binutils build from git-master fails, with gas/as-new not existing) 2015-07-24 12:20:44 -06:00
config.guess * config.sub, config.guess: Import from upstream. 2015-07-28 10:57:40 +10:00
config.rpath
config.sub * config.sub, config.guess: Import from upstream. 2015-07-28 10:57:40 +10:00
configure Add --enable-compressed-debug-sections={all,gas,gold,ld} 2015-10-20 09:29:28 -07:00
configure.ac Add --enable-compressed-debug-sections={all,gas,gold,ld} 2015-10-20 09:29:28 -07:00
depcomp Update from upstream Automake files. 2014-11-16 14:07:13 +00:00
install-sh Update from upstream Automake files. 2014-11-16 14:07:13 +00:00
libtool-ldflags re PR sanitizer/56781 (boostrap-asan failure: fixincl fails to link (missing -lasan)) 2014-04-17 14:23:28 +02:00
libtool.m4 Always use PIC option with -shared in libtool 2014-11-21 08:49:17 -08:00
ltgcc.m4
ltmain.sh Ensure libgcc_s unwinder is always used on 64-bit Solaris 10+/x86 (PR target/59788) 2014-02-04 09:31:38 +00:00
ltoptions.m4
ltsugar.m4
ltversion.m4
lt~obsolete.m4
missing Update from upstream Automake files. 2014-11-16 14:07:13 +00:00
mkdep
mkinstalldirs Update from upstream Automake files. 2014-11-16 14:07:13 +00:00
move-if-change Update move-if-change from gnulib 2014-11-16 16:12:44 +00:00
symlink-tree
ylwrap Update from upstream Automake files. 2014-11-16 14:07:13 +00:00

README

This directory contains the GNU Compiler Collection (GCC).

The GNU Compiler Collection is free software.  See the files whose
names start with COPYING for copying permission.  The manuals, and
some of the runtime libraries, are under different terms; see the
individual source files for details.

The directory INSTALL contains copies of the installation information
as HTML and plain text.  The source of this information is
gcc/doc/install.texi.  The installation information includes details
of what is included in the GCC sources and what files GCC installs.

See the file gcc/doc/gcc.texi (together with other files that it
includes) for usage and porting information.  An online readable
version of the manual is in the files gcc/doc/gcc.info*.

See http://gcc.gnu.org/bugs/ for how to report bugs usefully.

Copyright years on GCC source files may be listed using range
notation, e.g., 1987-2012, indicating that every year in the range,
inclusive, is a copyrightable year that could otherwise be listed
individually.