GCC modified for the FreeChainXenon project
![]() ctz(ext(X)) is the same as ctz(X) in the UB on zero case (or could be also in the 2 argument case on large BITINT_TYPE by preserving the argument, not implemented in this patch), popcount(zext(X)) is the same as popcount(X), parity(zext(X)) is the same as parity(X), parity(sext(X)) is the same as parity(X) provided the bit difference between the extended and unextended types is even, ffs(ext(X)) is the same as ffs(X). The following patch optimizes those in match.pd if those are beneficial (always in the large BITINT_TYPE case, or if the narrower type has optab and the wider doesn't, or the wider is larger than word and narrower is one of the standard argument sizes (tested just int and long long, as long is on most targets same bitsize as one of those two). Joseph in the PR mentioned that ctz(narrow(X)) is the same as ctz(X) if UB on 0, but that can be handled incrementally (and would need different decisions when it is profitable). And clz(zext(X)) is clz(X) + bit_difference, but not sure we want to change that in match.pd at all, perhaps during insn selection? 2023-11-17 Jakub Jelinek <jakub@redhat.com> PR tree-optimization/112566 PR tree-optimization/83171 * match.pd (ctz(ext(X)) -> ctz(X), popcount(zext(X)) -> popcount(X), parity(ext(X)) -> parity(X), ffs(ext(X)) -> ffs(X)): New simplifications. ( __builtin_ffs (X) == 0 -> X == 0): Use FFS rather than BUILT_IN_FFS BUILT_IN_FFSL BUILT_IN_FFSLL BUILT_IN_FFSIMAX. * gcc.dg/pr112566-1.c: New test. * gcc.dg/pr112566-2.c: New test. * gcc.target/i386/pr78057.c (foo): Pass another long long argument and use it in __builtin_ia32_*zcnt_u64 instead of the int one. |
||
---|---|---|
.github | ||
c++tools | ||
config | ||
contrib | ||
fixincludes | ||
gcc | ||
gnattools | ||
gotools | ||
include | ||
INSTALL | ||
libada | ||
libatomic | ||
libbacktrace | ||
libcc1 | ||
libcody | ||
libcpp | ||
libdecnumber | ||
libffi | ||
libgcc | ||
libgfortran | ||
libgm2 | ||
libgo | ||
libgomp | ||
libiberty | ||
libitm | ||
libobjc | ||
libphobos | ||
libquadmath | ||
libsanitizer | ||
libssp | ||
libstdc++-v3 | ||
libvtv | ||
lto-plugin | ||
maintainer-scripts | ||
zlib | ||
.dir-locals.el | ||
.gitattributes | ||
.gitignore | ||
ABOUT-NLS | ||
ar-lib | ||
ChangeLog | ||
ChangeLog.jit | ||
ChangeLog.tree-ssa | ||
compile | ||
config-ml.in | ||
config.guess | ||
config.rpath | ||
config.sub | ||
configure | ||
configure.ac | ||
COPYING | ||
COPYING.LIB | ||
COPYING.RUNTIME | ||
COPYING3 | ||
COPYING3.LIB | ||
depcomp | ||
install-sh | ||
libtool-ldflags | ||
libtool.m4 | ||
ltgcc.m4 | ||
ltmain.sh | ||
ltoptions.m4 | ||
ltsugar.m4 | ||
ltversion.m4 | ||
lt~obsolete.m4 | ||
MAINTAINERS | ||
Makefile.def | ||
Makefile.in | ||
Makefile.tpl | ||
missing | ||
mkdep | ||
mkinstalldirs | ||
move-if-change | ||
multilib.am | ||
README | ||
SECURITY.txt | ||
symlink-tree | ||
test-driver | ||
ylwrap |
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.