Jakub Jelinek 7ca24ae570 simplify-rtx: Fix up SUBREG_PROMOTED_SET arguments [PR104839]
The following testcase is miscompiled on powerpc64le-linux at -O1 and higher
(except for -Og).  The bug was introduced in r12-3252-gcad36f38576a6a7
which for SIGN_EXTEND from SUBREG_PROMOTED_SIGNED_P SUBREG used
SUBREG_PROMOTED_SET (temp, 1) (but that makes temp
SUBREG_PROMOTED_UNSIGNED_P because SRP_UNSIGNED is 1) and similarly the
ZERO_EXTEND from SUBREG_PROMOTED_UNSIGNED_P SUBREG used
SUBREG_PROMOTED_SET (temp, 0) (but that makes temp
SUBREG_PROMOTED_SIGNED_P because SRP_SIGNED is 0).
The following patch fixes that (swaps the 0s and 1s), but for better
readability uses the SRP_* constants.
rtl.h has:
/* Valid for subregs which are SUBREG_PROMOTED_VAR_P().  In that case
   this gives the necessary extensions:
   0  - signed (SPR_SIGNED)
   1  - normal unsigned (SPR_UNSIGNED)
   2  - value is both sign and unsign extended for mode
        (SPR_SIGNED_AND_UNSIGNED).
   -1 - pointer unsigned, which most often can be handled like unsigned
        extension, except for generating instructions where we need to
        emit special code (ptr_extend insns) on some architectures
        (SPR_POINTER). */
The expr.c change in the same commit looks ok to me (passes unsignedp
to SUBREG_PROMOTED_SET, so 0 for signed, 1 for unsigned).

2022-03-09  Jakub Jelinek  <jakub@redhat.com>

	PR rtl-optimization/104839
	* simplify-rtx.cc (simplify_unary_operation_1) <case SIGN_EXTEND>:
	Use SRP_SIGNED instead of incorrect 1 in SUBREG_PROMOTED_SET.
	(simplify_unary_operation_1) <case ZERO_EXTEND>: Use SRP_UNSIGNED
	instead of incorrect 0 in SUBREG_PROMOTED_SET.

	* gcc.c-torture/execute/pr104839.c: New test.
2022-03-09 09:12:38 +01:00
2022-01-03 10:42:10 +01:00
2021-12-22 00:16:30 +00:00
2022-02-28 00:16:17 +00:00
2022-02-14 00:16:23 +00:00
2022-01-03 10:42:10 +01:00
2022-01-03 10:42:10 +01:00
2022-02-04 00:16:24 +00:00
2022-02-18 00:16:39 +00:00
2022-01-03 10:42:10 +01:00
2022-03-05 00:16:31 +00:00
2022-01-03 10:42:10 +01:00
2022-03-05 00:16:31 +00:00
2022-01-27 00:16:29 +00:00
2022-03-04 10:46:55 -08:00
2022-03-05 00:16:31 +00:00
2022-02-23 00:16:24 +00:00
2022-02-04 00:16:24 +00:00
2022-01-03 10:42:10 +01:00
2022-03-03 00:16:24 +00:00
2022-01-12 00:16:39 +00:00
2022-02-16 00:16:26 +00:00
2022-01-03 10:42:10 +01:00
2022-03-09 00:16:29 +00:00
2022-01-03 10:42:10 +01:00
2022-03-02 00:16:32 +00:00
2021-12-17 00:16:20 +00:00
2022-02-23 00:16:24 +00:00
2021-12-21 09:10:57 +01: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 2.1 GiB
Languages
C++ 31.9%
C 31.3%
Ada 12%
D 6.5%
Go 6.4%
Other 11.5%