public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Alan Modra <amodra@gmail.com>
To: Jeff Law <law@redhat.com>
Cc: Thomas Preud'homme <thomas.preudhomme@arm.com>,
	'Andrew Pinski' <pinskia@gmail.com>,
	Eric Botcazou <ebotcazou@adacore.com>,
	GCC Patches <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH 1/2, combine] Try REG_EQUAL for nonzero_bits
Date: Thu, 12 Feb 2015 08:35:00 -0000	[thread overview]
Message-ID: <20150212083449.GM4274@bubble.grove.modra.org> (raw)
In-Reply-To: <54DAF0CD.9030701@redhat.com>

On Tue, Feb 10, 2015 at 11:03:57PM -0700, Jeff Law wrote:
> On 02/09/15 19:19, Thomas Preud'homme wrote:
> >>From: Andrew Pinski [mailto:pinskia@gmail.com]
> >>Sent: Tuesday, February 10, 2015 9:57 AM
> >
> >>>+#ifdef SHORT_IMMEDIATES_SIGN_EXTEND
> >>>+/* If MODE has a precision lower than PREC and SRC is a non-negative
> >>constant
> >>>+   that would appear negative in MODE, sign-extend SRC for use in
> >>nonzero_bits
> >>>+   because some machines (maybe most) will actually do the sign-
> >>extension and
> >>>+   this is the conservative approach.
> >>>+
> >>>+   ??? For 2.5, try to tighten up the MD files in this regard instead of
> >>this
> >>>+   kludge.  */
> >>
> >>I don't know if this has been mentioned and even though you are just
> >>copying a comment from below but would it make sense to look fixing
> >>what the comment says we should look at after GCC 2.5 (which was over
> >>20 years ago)? Or maybe just remove the comment if it no longer
> >>applies.
> >
> >Actually this bit seems unnecessary as there is already some logic in
> >nonzero_bits1 for the CONST_INT case. So I guess the code can be
> >removed and the comment be moved there at the very least but
> >I'd prefer people from one of the affected target to test it.

I can tell you that the following doesn't trigger on an
--enable-targets=all,go powerpc64-linux bootstrap.  (Ada not built due
to lack of gnat on the machine I used.)  So for powerpc it looks like
the combine SHORT_IMMEDIATES_SIGN_EXTEND code can disappear.  The
rtlanal.c occurrence *is* executed.

Index: gcc/combine.c
===================================================================
--- gcc/combine.c	(revision 220611)
+++ gcc/combine.c	(working copy)
@@ -1742,7 +1742,7 @@ set_nonzero_bits_and_sign_copies (rtx x, const_rtx
 	      && CONST_INT_P (src)
 	      && INTVAL (src) > 0
 	      && val_signbit_known_set_p (GET_MODE (x), INTVAL (src)))
-	    src = GEN_INT (INTVAL (src) | ~GET_MODE_MASK (GET_MODE (x)));
+	    gcc_unreachable ();
 #endif
 
 	  /* Don't call nonzero_bits if it cannot change anything.  */
@@ -9802,7 +9802,7 @@ reg_nonzero_bits_for_combine (const_rtx x, machine
 	  && CONST_INT_P (tem)
 	  && INTVAL (tem) > 0
 	  && val_signbit_known_set_p (GET_MODE (x), INTVAL (tem)))
-	tem = GEN_INT (INTVAL (tem) | ~GET_MODE_MASK (GET_MODE (x)));
+	gcc_unreachable ();
 #endif
       return tem;
     }

-- 
Alan Modra
Australia Development Lab, IBM

  parent reply	other threads:[~2015-02-12  8:35 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-02-10  1:52 Thomas Preud'homme
2015-02-10  1:57 ` Andrew Pinski
2015-02-10  2:19   ` Thomas Preud'homme
2015-02-11  6:04     ` Jeff Law
2015-02-11  6:43       ` Thomas Preud'homme
2015-02-11  6:48         ` Jeff Law
2015-02-11  6:56           ` Thomas Preud'homme
2015-04-24 10:43             ` Thomas Preud'homme
2015-02-12  8:35       ` Alan Modra [this message]
2015-02-13  9:40         ` Thomas Preud'homme
2015-04-24 18:57 ` Jeff Law
2015-04-27 11:03   ` Thomas Preud'homme

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=20150212083449.GM4274@bubble.grove.modra.org \
    --to=amodra@gmail.com \
    --cc=ebotcazou@adacore.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=law@redhat.com \
    --cc=pinskia@gmail.com \
    --cc=thomas.preudhomme@arm.com \
    /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).