public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Andrew Pinski <pinskia@gmail.com>
To: Tom de Vries <tom@codesourcery.com>
Cc: gcc-patches@gcc.gnu.org, Bernd Schmidt <bernds@codesourcery.com>
Subject: Re: new sign/zero extension elimination pass
Date: Thu, 28 Oct 2010 21:00:00 -0000	[thread overview]
Message-ID: <AANLkTi==BHdr3ZZNt_99tu4tbGWqz8xJQf1m4FkDMxz4@mail.gmail.com> (raw)
In-Reply-To: <AANLkTik3umTLD4-EFgpgemZZX0gNmhO+2qU_gr+EEyAc@mail.gmail.com>

[-- Attachment #1: Type: text/plain, Size: 672 bytes --]

On Thu, Oct 28, 2010 at 12:03 PM, Andrew Pinski <pinskia@gmail.com> wrote:
> On Mon, Oct 18, 2010 at 8:36 AM, Tom de Vries <tom@codesourcery.com> wrote:
>> I created a new sign/zero extension elimination pass.
>>
>> The motivating example for this pass is:
>
> In the above case fwprop could do the majority of the work.  In fact
> it simplifies the (subreg (zero_extend (subreg))) into (subreg) but
> does not replace it.  I think you could extend fwprop to the correct
> thing.

Something like the attached patch.  I have not bootstrap/tested it yet
but it works for your simple example.
This allows us not to add another pass.

Thanks,
Andrew Pinski

[-- Attachment #2: fixsubreg.diff.txt --]
[-- Type: text/plain, Size: 706 bytes --]

Index: fwprop.c
===================================================================
--- fwprop.c	(revision 166031)
+++ fwprop.c	(working copy)
@@ -543,8 +543,14 @@ propagate_rtx_1 (rtx *px, rtx old_rtx, r
 	  valid_ops &= propagate_rtx_1 (&op0, old_rtx, new_rtx, flags);
           if (op0 == XEXP (x, 0))
 	    return true;
-	  tem = simplify_gen_subreg (mode, op0, GET_MODE (SUBREG_REG (x)),
-				     SUBREG_BYTE (x));
+	  tem = simplify_subreg (mode, op0, GET_MODE (SUBREG_REG (x)),
+				 SUBREG_BYTE (x));
+	  if (!tem)
+	    return false;
+	  else if (GET_CODE (tem) == SUBREG && REG_P (SUBREG_REG (tem)))
+	    valid_ops = true;
+	  else if (REG_P (tem))
+	    valid_ops = true;
 	}
       break;
 

  reply	other threads:[~2010-10-28 19:19 UTC|newest]

Thread overview: 43+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-10-18 15:54 Tom de Vries
2010-10-18 16:03 ` Andrew Pinski
2010-10-18 16:59   ` Richard Guenther
2010-10-21 10:06     ` Tom de Vries
2010-10-21 10:44   ` Paolo Bonzini
2010-10-21 11:00     ` Paolo Bonzini
2010-10-21 17:21     ` Paolo Bonzini
2010-10-22  9:05       ` Tom de Vries
2010-10-22  9:24         ` Paolo Bonzini
2010-10-22  9:15 ` Eric Botcazou
2010-10-28 20:45   ` Tom de Vries
2010-10-29  2:11     ` Paolo Bonzini
2010-10-29  2:42       ` Paolo Bonzini
2010-10-31 19:30       ` Tom de Vries
2010-10-31 20:58         ` Joseph S. Myers
2010-10-31 21:11         ` Paolo Bonzini
2010-11-03 18:49           ` Eric Botcazou
2010-10-29  1:04   ` Paolo Bonzini
2010-10-29  1:33     ` Paolo Bonzini
2010-11-03 18:50     ` Eric Botcazou
2010-11-08 21:29     ` Tom de Vries
2010-11-08 22:11       ` Paolo Bonzini
2010-11-12  8:29         ` Tom de Vries
2010-11-13 10:41           ` Eric Botcazou
2012-07-11 10:31             ` Tom de Vries
2012-07-11 11:42               ` Jakub Jelinek
2012-07-11 13:01                 ` Tom de Vries
2012-07-12  1:52               ` Kenneth Zadeck
     [not found]               ` <4FFE2ADF.2060806@naturalbridge.com>
     [not found]                 ` <4FFE9346.2070806@mentor.com>
2012-07-12  9:21                   ` Tom de Vries
2012-07-12 12:05                     ` Kenneth Zadeck
2012-07-13  7:54                       ` Tom de Vries
2012-07-13 11:39                         ` Kenneth Zadeck
2012-07-13 12:58                           ` Tom de Vries
2012-07-17 15:17                         ` Kenneth Zadeck
2012-07-20 18:41                           ` Tom de Vries
2012-08-20 13:40               ` Tom de Vries
2010-10-28 20:55 ` Andrew Pinski
2010-10-28 21:00   ` Andrew Pinski [this message]
2010-10-28 21:12     ` Tom de Vries
2010-10-28 22:58       ` Andrew Pinski
2010-10-29 15:06         ` Tom de Vries
2010-10-29  0:34     ` Paolo Bonzini
2010-11-08 21:32 ` Andrew Pinski

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='AANLkTi==BHdr3ZZNt_99tu4tbGWqz8xJQf1m4FkDMxz4@mail.gmail.com' \
    --to=pinskia@gmail.com \
    --cc=bernds@codesourcery.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=tom@codesourcery.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).