Stefan Schulze Frielinghaus 41ef5a3416 rtl-optimization/110867 Fix narrow comparison of memory and constant
In certain cases a constant may not fit into the mode used to perform a
comparison.  This may be the case for sign-extended constants which are
used during an unsigned comparison as e.g. in

(set (reg:CC 100 cc)
    (compare:CC (mem:SI (reg/v/f:SI 115 [ a ]) [1 *a_4(D)+0 S4 A64])
        (const_int -2147483648 [0xffffffff80000000])))

Fixed by ensuring that the constant fits into comparison mode.

Furthermore, on some targets as e.g. sparc the constant used in a
comparison is chopped off before combine which leads to failing test
cases (see PR 110869).  Fixed by not requiring that the source mode has
to be DImode, and excluding sparc from the last two test cases entirely
since there the constant cannot be further reduced.

gcc/ChangeLog:

	PR rtl-optimization/110867
	* combine.cc (simplify_compare_const): Try the optimization only
	in case the constant fits into the comparison mode.

gcc/testsuite/ChangeLog:

	PR rtl-optimization/110869
	* gcc.dg/cmp-mem-const-1.c: Relax mode for constant.
	* gcc.dg/cmp-mem-const-2.c: Relax mode for constant.
	* gcc.dg/cmp-mem-const-3.c: Relax mode for constant.
	* gcc.dg/cmp-mem-const-4.c: Relax mode for constant.
	* gcc.dg/cmp-mem-const-5.c: Exclude sparc since here the
	constant is already reduced.
	* gcc.dg/cmp-mem-const-6.c: Exclude sparc since here the
	constant is already reduced.
2023-08-02 21:43:22 +02:00
2023-07-22 00:17:44 +00:00
2023-07-30 00:17:03 +00:00
2023-08-01 00:18:39 +00:00
2023-07-20 00:17:53 +00:00
2023-07-24 00:16:51 +00:00
2023-07-22 00:17:44 +00:00
2023-07-30 00:17:03 +00:00
2023-07-31 00:16:58 +00:00
2023-08-02 00:17:45 +00:00
2023-07-31 11:37:47 +02:00
2023-07-31 11:37:47 +02:00
2023-07-31 11:37:47 +02:00

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.
Description
No description provided
Readme 4.2 GiB
Languages
C++ 30.7%
C 30.2%
Ada 14.4%
D 6.1%
Go 5.7%
Other 12.4%