public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Tom de Vries <Tom_deVries@mentor.com>
To: Richard Henderson <rth@redhat.com>
Cc: Steve Ellcey <sellcey@mips.com>,
	Andrew Pinski <pinskia@gmail.com>,
	"gcc-patches@gcc.gnu.org" <gcc-patches@gcc.gnu.org>
Subject: Re: [PATCH] Fix PR55876 - Make generation of paradoxical subreg in widen_operand more robust
Date: Mon, 14 Jan 2013 14:44:00 -0000	[thread overview]
Message-ID: <50F3C179.1030705@mentor.com> (raw)
In-Reply-To: <50EB0A5D.1000302@redhat.com>

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

On 07/01/13 18:48, Richard Henderson wrote:
> On 01/07/2013 02:16 AM, Tom de Vries wrote:
>> -  /* If MODE is no wider than a single word, we return a paradoxical
>> -     SUBREG.  */
>> +  /* If MODE is no wider than a single word, we return a
>> +     lowpart or paradoxical SUBREG.  */
>>    if (GET_MODE_SIZE (mode) <= UNITS_PER_WORD)
>> -    return gen_rtx_SUBREG (mode, force_reg (GET_MODE (op), op), 0);
>> +    {
>> +      if (GET_MODE_SIZE (mode) < GET_MODE_SIZE (GET_MODE (op)))
>> +       return gen_lowpart_SUBREG (mode, op);
>> +      else
>> +       return gen_rtx_SUBREG (mode, force_reg (GET_MODE (op), op), 0);
>> +    }
> 
> Is there any good reason we're using gen_rtx_SUBREG directly here?
> Seems like this sort of logic would be present in plain gen_lowpart,
> generating the paradoxical subreg that we want.
> 

Ah, didn't realize that. Attached patch uses gen_lowpart.

Bootstrapped and reg-tested on x86_64.

Build and reg-tested on mips64, -mabi=n32 and -mabi=64.

OK for trunk?

Thanks,
- Tom

2013-01-14  Tom de Vries  <tom@codesourcery.com>

	PR target/55876
	* optabs.c (widen_operand): Use gen_lowpart instead of gen_rtx_SUBREG.
	Update comment.


[-- Attachment #2: widen_operand-paradoxical-subreg.4.patch --]
[-- Type: text/x-patch, Size: 778 bytes --]

Index: gcc/optabs.c
===================================================================
--- gcc/optabs.c (revision 194898)
+++ gcc/optabs.c (working copy)
@@ -327,10 +327,10 @@ widen_operand (rtx op, enum machine_mode
 	  && SUBREG_PROMOTED_UNSIGNED_P (op) == unsignedp))
     return convert_modes (mode, oldmode, op, unsignedp);
 
-  /* If MODE is no wider than a single word, we return a paradoxical
+  /* If MODE is no wider than a single word, we return a lowpart or paradoxical
      SUBREG.  */
   if (GET_MODE_SIZE (mode) <= UNITS_PER_WORD)
-    return gen_rtx_SUBREG (mode, force_reg (GET_MODE (op), op), 0);
+    return gen_lowpart (mode, force_reg (GET_MODE (op), op));
 
   /* Otherwise, get an object of MODE, clobber it, and set the low-order
      part to OP.  */

  reply	other threads:[~2013-01-14 14:44 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <50EA9FDD.6000803@mentor.com>
2013-01-07 10:16 ` Tom de Vries
2013-01-07 17:48   ` Richard Henderson
2013-01-14 14:44     ` Tom de Vries [this message]
2013-01-15 17:12       ` Richard Henderson

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=50F3C179.1030705@mentor.com \
    --to=tom_devries@mentor.com \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=pinskia@gmail.com \
    --cc=rth@redhat.com \
    --cc=sellcey@mips.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).