Go to file
Roger Sayle fd1f5373b8 PR tree-optimization/92342: Optimize b & -(a==c) in match.pd
This patch is an update/tweak of Andrew Pinski's two patches for
PR tree-optimization/92342, that were originally posted by in November:
https://gcc.gnu.org/pipermail/gcc-patches/2021-November/585111.html
https://gcc.gnu.org/pipermail/gcc-patches/2021-November/585112.html

Technically, the first of those was approved by Richard Biener, though
never committed, and my first thought was to simply push it for Andrew,
but the review of the second piece expressed concerns over comparisons
in non-integral modes, where the result may not be zero-one valued.
Indeed both transformations misbehave in the presence of vector mode
comparisons (these transformations are already implemented for
vec_cond elsewhere in match.pd), so my minor contribution is to limit
these new transformations to scalars, by testing that both the operands
and results are INTEGRAL_TYPE_P.

2023-01-12  Andrew Pinski  <apinski@marvell.com>
	    Roger Sayle  <roger@nextmovesoftware.com>

gcc/ChangeLog:
	PR tree-optimization/92342
	* match.pd ((m1 CMP m2) * d -> (m1 CMP m2) ? d : 0):
	Use tcc_comparison and :c for the multiply.
	(b & -(a CMP c) -> (a CMP c)?b:0): New pattern.

gcc/testsuite/ChangeLog:
	PR tree-optimization/92342
	* gcc.dg/tree-ssa/andnegcmp-1.c: New test.
	* gcc.dg/tree-ssa/andnegcmp-2.c: New test.
	* gcc.dg/tree-ssa/multcmp-1.c: New test.
	* gcc.dg/tree-ssa/multcmp-2.c: New test.
2023-01-12 21:48:50 +00:00
c++tools Daily bump. 2023-01-10 00:18:07 +00:00
config Daily bump. 2022-11-15 08:32:29 +00:00
contrib Daily bump. 2023-01-12 00:18:07 +00:00
fixincludes Daily bump. 2022-11-24 00:17:47 +00:00
gcc PR tree-optimization/92342: Optimize b & -(a==c) in match.pd 2023-01-12 21:48:50 +00:00
gnattools Daily bump. 2022-09-01 00:17:39 +00:00
gotools Daily bump. 2022-08-31 00:16:45 +00:00
include Daily bump. 2022-12-22 00:17:29 +00:00
INSTALL
intl Daily bump. 2022-11-24 00:17:47 +00:00
libada Update Copyright year in ChangeLog files 2023-01-02 09:23:36 +01:00
libatomic Daily bump. 2023-01-08 00:16:59 +00:00
libbacktrace Daily bump. 2023-01-07 00:17:28 +00:00
libcc1 Daily bump. 2022-11-02 00:17:38 +00:00
libcody Update Copyright year in ChangeLog files 2023-01-02 09:23:36 +01:00
libcpp Daily bump. 2023-01-10 00:18:07 +00:00
libdecnumber Update Copyright year in ChangeLog files 2023-01-02 09:23:36 +01:00
libffi Daily bump. 2023-01-08 00:16:59 +00:00
libgcc Daily bump. 2023-01-08 00:16:59 +00:00
libgfortran Daily bump. 2023-01-08 00:16:59 +00:00
libgm2 Daily bump. 2023-01-07 00:17:28 +00:00
libgo Always define WIN32_LEAN_AND_MEAN before <windows.h> 2023-01-07 06:51:06 +00:00
libgomp Daily bump. 2023-01-08 00:16:59 +00:00
libiberty Daily bump. 2023-01-08 00:16:59 +00:00
libitm Daily bump. 2023-01-03 00:17:09 +00:00
libobjc Update Copyright year in ChangeLog files 2023-01-02 09:23:36 +01:00
libphobos Update Copyright year in ChangeLog files 2023-01-02 09:23:36 +01:00
libquadmath Daily bump. 2023-01-03 00:17:09 +00:00
libsanitizer Daily bump. 2022-12-20 00:17:00 +00:00
libssp Daily bump. 2023-01-08 00:16:59 +00:00
libstdc++-v3 libstdc++: Extend max_align_t special case to 64-bit HP-UX [PR77691] 2023-01-12 20:57:34 +00:00
libvtv Daily bump. 2023-01-08 00:16:59 +00:00
lto-plugin Daily bump. 2022-11-24 00:17:47 +00:00
maintainer-scripts Daily bump. 2022-12-01 00:17:51 +00:00
zlib Daily bump. 2022-11-24 00:17:47 +00:00
.dir-locals.el
.gitattributes
.gitignore
ABOUT-NLS
ar-lib
ChangeLog Daily bump. 2023-01-11 00:17:56 +00:00
ChangeLog.jit
ChangeLog.tree-ssa
compile
config-ml.in
config.guess
config.rpath
config.sub
configure configure: remove dependencies on gmp and mpfr when gdb is disabled 2023-01-06 09:36:52 +01:00
configure.ac configure: remove dependencies on gmp and mpfr when gdb is disabled 2023-01-06 09:36:52 +01:00
COPYING
COPYING3
COPYING3.LIB
COPYING.LIB
COPYING.RUNTIME
depcomp
install-sh
libtool-ldflags
libtool.m4 Generic configury support for shared libs on VxWorks 2022-10-11 07:31:07 +00:00
lt~obsolete.m4
ltgcc.m4
ltmain.sh
ltoptions.m4
ltsugar.m4
ltversion.m4
MAINTAINERS MAINTAINERS: Add myself as Rust front-end maintainer 2023-01-10 22:06:09 +00:00
Makefile.def configure: Do not build the ununsed libffi shared library. 2022-12-31 17:51:47 +00:00
Makefile.in configure: Do not build the ununsed libffi shared library. 2022-12-31 17:51:47 +00:00
Makefile.tpl Merge modula-2 front end onto gcc. 2022-12-14 17:43:08 +00: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.