public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Segher Boessenkool <segher@kernel.crashing.org>
To: gcc-patches@gcc.gnu.org
Cc: Segher Boessenkool <segher@kernel.crashing.org>
Subject: [PATCH 2/2] combine: Fix for PR81423
Date: Tue, 18 Jul 2017 19:36:00 -0000	[thread overview]
Message-ID: <88deb3d1417e3567a750980dd23c8e1dd67f94e1.1500380707.git.segher@kernel.crashing.org> (raw)
In-Reply-To: <0926f163a7f91c101e34cff5cf7926506d208517.1500380707.git.segher@kernel.crashing.org>
In-Reply-To: <0926f163a7f91c101e34cff5cf7926506d208517.1500380707.git.segher@kernel.crashing.org>

We here have an AND of a SUBREG of an LSHIFTRT.  If that SUBREG is
paradoxical, the extraction we form is the length of the size of the
inner mode, which includes some bits that should not be in the result.
Just give up in that case.

Tested on powerpc64-linux {-m32,-m64} and on x86_64-linux.  Committing
to trunk.


Segher


2018-07-18  Segher Boessenkool  <segher@kernel.crashing.org>

	PR rtl-optimization/81423
	* combine.c (make_compound_operation_int): Don't try to optimize
	the AND of a SUBREG of an LSHIFTRT if that SUBREG is paradoxical.

---
 gcc/combine.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/gcc/combine.c b/gcc/combine.c
index c5200db..c486f12 100644
--- a/gcc/combine.c
+++ b/gcc/combine.c
@@ -7990,18 +7990,9 @@ make_compound_operation_int (machine_mode mode, rtx *x_ptr,
 				     XEXP (inner_x0, 1),
 				     i, 1, 0, in_code == COMPARE);
 
-	  if (new_rtx)
-	    {
-	      /* If we narrowed the mode when dropping the subreg, then
-		 we must zero-extend to keep the semantics of the AND.  */
-	      if (GET_MODE_SIZE (inner_mode) >= GET_MODE_SIZE (mode))
-		;
-	      else if (SCALAR_INT_MODE_P (inner_mode))
-		new_rtx = simplify_gen_unary (ZERO_EXTEND, mode,
-					      new_rtx, inner_mode);
-	      else
-		new_rtx = NULL;
-	    }
+	  /* If we narrowed the mode when dropping the subreg, then we lose.  */
+	  if (GET_MODE_SIZE (inner_mode) < GET_MODE_SIZE (mode))
+	    new_rtx = NULL;
 
 	  /* If that didn't give anything, see if the AND simplifies on
 	     its own.  */
-- 
1.9.3

  reply	other threads:[~2017-07-18 19:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-18 19:36 [PATCH 1/2] simplify-rtx: The truncation of an IOR can have all bits set (PR81423) Segher Boessenkool
2017-07-18 19:36 ` Segher Boessenkool [this message]
2017-07-19  6:19 ` Jeff Law
2017-07-19 19:03   ` Segher Boessenkool
2017-07-24  8:56   ` Segher Boessenkool
2017-07-24 22:06     ` Jeff Law
2017-07-25 11:25       ` Segher Boessenkool
2017-08-07 22:33         ` Segher Boessenkool
2017-08-08 16:27           ` Jeff Law
2017-07-25 11:31     ` Kyrill Tkachov
2017-07-25 22:11       ` Segher Boessenkool
2017-07-26 20:50         ` Mike Stump

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=88deb3d1417e3567a750980dd23c8e1dd67f94e1.1500380707.git.segher@kernel.crashing.org \
    --to=segher@kernel.crashing.org \
    --cc=gcc-patches@gcc.gnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).