Go to file
Jakub Jelinek eeb31391b7 combine: Fix find_split_point handling of constant store into ZERO_EXTRACT [PR93908]
git is miscompiled on s390x-linux with -O2 -march=zEC12 -mtune=z13.
I've managed to reduce it into the following testcase.  The problem is that
during combine we see the s->k = -1; bitfield store and change the SET_SRC
from a pseudo into a constant:
(set (zero_extract:DI (mem/j:HI (plus:DI (reg/v/f:DI 60 [ s ])
                (const_int 10 [0xa])) [0 +0 S2 A16])
        (const_int 2 [0x2])
        (const_int 7 [0x7]))
    (const_int -1 [0xffffffffffffffff]))
This on s390x with the above option isn't recognized as valid instruction,
so find_split_point decides to handle it as IOR or IOR/AND.
src is -1, mask is 3 and pos is 7.
src != mask (this is also incorrect, we want to set all (both) bits in the
bitfield), so we go for IOR/AND, but instead of trying
mem = (mem & ~0x180) | ((-1 << 7) & 0x180)
we actually try
mem = (mem & ~0x180) | (-1 << 7)
and that is further simplified into:
mem = mem | (-1 << 7)
aka
mem = mem | 0xff80
which doesn't set just the 2-bit bitfield, but also many other bitfields
that shouldn't be touched.
We really should do:
mem = mem | 0x180
instead.
The problem is that we assume that no bits but those low len (2 here) will
be set in the SET_SRC, but there is nothing that can prevent that, we just
should ignore the other bits.

The following patch fixes it by masking src with mask, this way already
the src == mask test will DTRT, and as the code for or_mask uses
gen_int_mode, if the most significant bit is set after shifting it left by
pos, it will be properly sign-extended.

2020-02-25  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/93908
	* combine.c (find_split_point): For store into ZERO_EXTRACT, and src
	with mask.

	* gcc.c-torture/execute/pr93908.c: New test.
2020-02-25 14:01:55 +01:00
INSTALL
config Update ChangeLog and version files for release 2019-08-12 09:38:49 +02:00
contrib test_summary: Do not escape "=". 2019-08-16 14:03:09 +02:00
fixincludes backport: re PR libgomp/93066 (libgomp/target.c:525:46: error: expected expression before ')' token) 2020-01-01 17:01:46 +00:00
gcc combine: Fix find_split_point handling of constant store into ZERO_EXTRACT [PR93908] 2020-02-25 14:01:55 +01:00
gnattools Update ChangeLog and version files for release 2019-08-12 09:38:49 +02:00
gotools Update ChangeLog and version files for release 2019-08-12 09:38:49 +02:00
include Update ChangeLog and version files for release 2019-08-12 09:38:49 +02:00
intl Update ChangeLog and version files for release 2019-08-12 09:38:49 +02:00
libada Update ChangeLog and version files for release 2019-08-12 09:38:49 +02:00
libatomic Update ChangeLog and version files for release 2019-08-12 09:38:49 +02:00
libbacktrace Update ChangeLog and version files for release 2019-08-12 09:38:49 +02:00
libcc1 Update ChangeLog and version files for release 2019-08-12 09:38:49 +02:00
libcpp backport: re PR preprocessor/92296 (internal compiler error: Segmentation fault #pragma push_macro("__LINE__")) 2019-11-08 19:59:14 +01:00
libdecnumber Fix libdecnumber handling of non-canonical BID significands (PR middle-end/91226). 2020-01-13 18:45:04 +00:00
libffi Update ChangeLog and version files for release 2019-08-12 09:38:49 +02:00
libgcc i386: Properly pop restore token in signal frame 2020-02-10 08:10:49 -08:00
libgfortran Use au->lock exclusively for locking in async I/O. 2020-02-22 12:31:18 +01:00
libgo re PR go/91621 (libgo/mksysinfo.sh: please avoid test ==) 2019-09-10 20:32:42 +00:00
libgomp openmp: Fix handling of non-addressable shared scalars in parallel nested inside of target [PR93515] 2020-02-13 21:45:15 +01:00
libhsail-rt Update ChangeLog and version files for release 2019-08-12 09:38:49 +02:00
libiberty Update ChangeLog and version files for release 2019-08-12 09:38:49 +02:00
libitm Update ChangeLog and version files for release 2019-08-12 09:38:49 +02:00
libobjc Update ChangeLog and version files for release 2019-08-12 09:38:49 +02:00
liboffloadmic Update ChangeLog and version files for release 2019-08-12 09:38:49 +02:00
libphobos [LIBPHOBOS] Fix multi-lib RUNTESTFLAGS handling 2019-10-30 12:51:15 +01:00
libquadmath backport: quadmath.h (M_Eq, [...]): Use two more decimal places. 2019-10-21 13:34:04 +02:00
libsanitizer backport: re PR sanitizer/92154 (new glibc breaks arm bootstrap due to libsanitizer) 2019-12-20 17:58:35 +01:00
libssp Update ChangeLog and version files for release 2019-08-12 09:38:49 +02:00
libstdc++-v3 libstdc++: Simplify makefile rule for largefile-config.h (PR91947) 2020-01-24 11:18:43 +00:00
libvtv Update ChangeLog and version files for release 2019-08-12 09:38:49 +02:00
lto-plugin Update ChangeLog and version files for release 2019-08-12 09:38:49 +02:00
maintainer-scripts Update gcc_release to mainline version. 2020-01-13 15:58:45 +00:00
zlib Update ChangeLog and version files for release 2019-08-12 09:38:49 +02:00
.dir-locals.el
.gitattributes add basic .gitattributes files to notice whitespace issues 2016-04-23 02:37:43 +00:00
.gitignore .gitignore: Ignore in-tree prerequisites. 2016-09-09 17:20:55 -04:00
ABOUT-NLS
COPYING
COPYING.LIB
COPYING.RUNTIME
COPYING3
COPYING3.LIB
ChangeLog Update ChangeLog and version files for release 2019-08-12 09:38:49 +02:00
ChangeLog.jit
ChangeLog.tree-ssa
MAINTAINERS Add myself to MAINTAINERS 2019-04-22 16:05:36 +00:00
Makefile.def Add D front-end, libphobos library, and D2 testsuite. 2018-10-28 19:51:47 +00:00
Makefile.in Come up with bootstrap-lto-lean config. 2019-04-09 08:49:14 +00:00
Makefile.tpl Come up with bootstrap-lto-lean config. 2019-04-09 08:49:14 +00:00
README
ar-lib Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856). 2018-10-31 17:03:16 +00:00
compile
config-ml.in Add D front-end, libphobos library, and D2 testsuite. 2018-10-28 19:51:47 +00:00
config.guess Update config.guess, config.sub (PR target/88535) 2019-01-03 11:28:27 +00:00
config.rpath
config.sub Update config.guess, config.sub (PR target/88535) 2019-01-03 11:28:27 +00:00
configure PR d/87799 Fix D build on windows hosts 2019-04-14 09:52:22 +00:00
configure.ac PR d/87799 Fix D build on windows hosts 2019-04-14 09:52:22 +00:00
depcomp
install-sh
libtool-ldflags
libtool.m4 Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856). 2018-10-31 17:03:16 +00:00
ltgcc.m4
ltmain.sh libtool.m4: Sort output of 'find' to enable deterministic builds. 2018-07-05 13:13:45 -06:00
ltoptions.m4
ltsugar.m4
ltversion.m4
lt~obsolete.m4
missing
mkdep
mkinstalldirs
move-if-change
multilib.am Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856). 2018-10-31 17:03:16 +00:00
symlink-tree
test-driver Update GCC to autoconf 2.69, automake 1.15.1 (PR bootstrap/82856). 2018-10-31 17:03:16 +00:00
ylwrap

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.