Go to file
Jakub Jelinek 5ca2400270 match.pd: Improve (A / (1 << B)) -> (A >> B) optimization [PR96930]
The following patch improves the A / (1 << B) -> A >> B simplification,
as seen in the testcase, if there is unnecessary widening for the division,
we just optimize it into a shift on the widened type, but if the lshift
is widened too, there is no reason to do that, we can just shift it in the
original type and convert after.  The tree_nonzero_bits & wi::mask check
already ensures it is fine even for signed values.

I've split the vr-values optimization into a separate patch as it causes
a small regression on two testcases, but this patch fixes what has been
reported in the PR alone.

2021-01-05  Jakub Jelinek  <jakub@redhat.com>

	PR tree-optimization/96930
	* match.pd ((A / (1 << B)) -> (A >> B)): If A is extended
	from narrower value which has the same type as 1 << B, perform
	the right shift on the narrower value followed by extension.

	* g++.dg/tree-ssa/pr96930.C: New test.
2021-01-05 16:33:29 +01:00
c++tools build: libcody: Link with -lsocket -lnsl if necessary [PR98316] 2021-01-05 11:32:31 +01:00
config build: libcody: Link with -lsocket -lnsl if necessary [PR98316] 2021-01-05 11:32:31 +01:00
contrib Daily bump. 2021-01-05 00:16:42 +00:00
fixincludes Daily bump. 2020-12-15 00:16:35 +00:00
gcc match.pd: Improve (A / (1 << B)) -> (A >> B) optimization [PR96930] 2021-01-05 16:33:29 +01:00
gnattools
gotools Daily bump. 2020-12-31 00:16:29 +00:00
include Update copyright years. 2021-01-04 10:26:59 +01:00
INSTALL
intl
libada Update copyright years. 2021-01-04 10:26:59 +01:00
libatomic Update copyright years. 2021-01-04 10:26:59 +01:00
libbacktrace Update copyright years. 2021-01-04 10:26:59 +01:00
libcc1 Update copyright years. 2021-01-04 10:26:59 +01:00
libcody Daily bump. 2021-01-05 00:16:42 +00:00
libcpp Update copyright years. 2021-01-04 10:26:59 +01:00
libdecnumber Update copyright years. 2021-01-04 10:26:59 +01:00
libffi Daily bump. 2020-12-06 00:16:44 +00:00
libgcc Update copyright years. 2021-01-04 10:26:59 +01:00
libgfortran Update copyright years. 2021-01-04 10:26:59 +01:00
libgo internal/cpu: add aarch64 support functions 2021-01-01 15:13:50 -08:00
libgomp Update copyright years. 2021-01-04 10:26:59 +01:00
libhsail-rt Update copyright years. 2021-01-04 10:26:59 +01:00
libiberty Daily bump. 2021-01-05 00:16:42 +00:00
libitm Update copyright years. 2021-01-04 10:26:59 +01:00
libobjc Update copyright years. 2021-01-04 10:26:59 +01:00
liboffloadmic Daily bump. 2020-11-30 00:16:27 +00:00
libphobos Update copyright years. 2021-01-04 10:26:59 +01:00
libquadmath Daily bump. 2021-01-02 00:16:24 +00:00
libsanitizer Daily bump. 2020-12-06 00:16:44 +00:00
libssp Update copyright years. 2021-01-04 10:26:59 +01:00
libstdc++-v3 Update copyright years. 2021-01-04 10:26:59 +01:00
libvtv Update copyright years. 2021-01-04 10:26:59 +01:00
lto-plugin Update copyright years. 2021-01-04 10:26:59 +01:00
maintainer-scripts Daily bump. 2020-12-17 00:16:37 +00:00
zlib Daily bump. 2020-12-06 00:16:44 +00:00
.dir-locals.el .dir-locals.el: Set 'fill-column' to 80 for c-mode 2020-12-14 12:19:56 +01:00
.gitattributes
.gitignore Sync .gitignore with binutils-gdb 2020-12-02 11:04:01 -07:00
ABOUT-NLS
ar-lib
ChangeLog Daily bump. 2021-01-05 00:16:42 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in
config.guess
config.rpath
config.sub
configure Add C++tools 2020-12-15 07:42:59 -08:00
configure.ac Add C++tools 2020-12-15 07:42:59 -08:00
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.RUNTIME
depcomp
install-sh
libtool-ldflags
libtool.m4 Darwin : Update libtool and dependencies for Darwin20 [PR97865] 2020-12-05 08:43:20 +00:00
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS MAINTAINERS: Update my email address. 2021-01-04 17:37:54 +01:00
Makefile.def Add C++tools 2020-12-15 07:42:59 -08:00
Makefile.in Add C++tools 2020-12-15 07:42:59 -08:00
Makefile.tpl Add C++tools 2020-12-15 07:42:59 -08:00
missing
mkdep
mkinstalldirs
move-if-change
multilib.am
README
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.