public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: "H.J. Lu" <hongjiu.lu@intel.com>
To: gcc-patches@gcc.gnu.org
Subject: PATCH [4/n]: Prepare x32: Permute the conversion and addition if one operand is a constant
Date: Sat, 11 Jun 2011 16:06:00 -0000	[thread overview]
Message-ID: <20110611155859.GA20007@intel.com> (raw)

Hi,

convert_memory_address_addr_space has a special PLUS/MULT case for
POINTERS_EXTEND_UNSIGNED < 0.  It turns out that it is also needed
for all Pmode != ptr_mode cases.  OK for trunk?

Thanks.


H.J.
---
2011-06-11  H.J. Lu  <hongjiu.lu@intel.com>

	PR middle-end/47727
	* explow.c (convert_memory_address_addr_space): Permute the
	conversion and addition if one operand is a constant.

diff --git a/gcc/explow.c b/gcc/explow.c
index 7387dad..b343bf8 100644
--- a/gcc/explow.c
+++ b/gcc/explow.c
@@ -383,18 +383,13 @@ convert_memory_address_addr_space (enum machine_mode to_mode ATTRIBUTE_UNUSED,
 
     case PLUS:
     case MULT:
-      /* For addition we can safely permute the conversion and addition
-	 operation if one operand is a constant and converting the constant
-	 does not change it or if one operand is a constant and we are
-	 using a ptr_extend instruction  (POINTERS_EXTEND_UNSIGNED < 0).
-	 We can always safely permute them if we are making the address
-	 narrower.  */
+      /* For addition we safely permute the conversion and addition
+	 operation if one operand is a constant since we can't generate
+	 new instructions.  We can always safely permute them if we are
+	 making the address narrower.  */
       if (GET_MODE_SIZE (to_mode) < GET_MODE_SIZE (from_mode)
 	  || (GET_CODE (x) == PLUS
-	      && CONST_INT_P (XEXP (x, 1))
-	      && (XEXP (x, 1) == convert_memory_address_addr_space
-				   (to_mode, XEXP (x, 1), as)
-                 || POINTERS_EXTEND_UNSIGNED < 0)))
+	      && CONST_INT_P (XEXP (x, 1))))
 	return gen_rtx_fmt_ee (GET_CODE (x), to_mode,
 			       convert_memory_address_addr_space
 				 (to_mode, XEXP (x, 0), as),

                 reply	other threads:[~2011-06-11 15:59 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20110611155859.GA20007@intel.com \
    --to=hongjiu.lu@intel.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=hjl.tools@gmail.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).