public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* Postreload and STRICT_LOW_PART
@ 2009-09-20 16:10 Andreas Schwab
  2009-09-20 16:31 ` Richard Guenther
  0 siblings, 1 reply; 3+ messages in thread
From: Andreas Schwab @ 2009-09-20 16:10 UTC (permalink / raw)
  To: gcc

Why is postreload converting (set (REGX) (CONST_INT A)) ... (set (REGX)
(CONST_INT B)) into (set (STRICT_LOW_PART (REGX)) (CONST_INT B))?  That
looks like a pessimisation especially if the constants are small, since
STRICT_LOW_PART must not touch the high part.  Is there a way for the
backend to stop postreload from doing this if the constants are in some
range?  On the m68k, loading a constant in the range -128..127 in SI
mode is better than loading it in strict QI mode.

Andreas.

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
"And now for something completely different."

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Postreload and STRICT_LOW_PART
  2009-09-20 16:10 Postreload and STRICT_LOW_PART Andreas Schwab
@ 2009-09-20 16:31 ` Richard Guenther
  2009-09-20 17:25   ` Paolo Bonzini
  0 siblings, 1 reply; 3+ messages in thread
From: Richard Guenther @ 2009-09-20 16:31 UTC (permalink / raw)
  To: Andreas Schwab; +Cc: gcc

On Sun, Sep 20, 2009 at 6:10 PM, Andreas Schwab <schwab@linux-m68k.org> wrote:
> Why is postreload converting (set (REGX) (CONST_INT A)) ... (set (REGX)
> (CONST_INT B)) into (set (STRICT_LOW_PART (REGX)) (CONST_INT B))?  That
> looks like a pessimisation especially if the constants are small, since
> STRICT_LOW_PART must not touch the high part.  Is there a way for the
> backend to stop postreload from doing this if the constants are in some
> range?  On the m68k, loading a constant in the range -128..127 in SI
> mode is better than loading it in strict QI mode.

It's probably an omission of a check if A & ~GET_MODE_MASK (narrow_mode)
is equal to zero.  And of course a cost check is completely missing.

Richard.

> Andreas.
>
> --
> Andreas Schwab, schwab@linux-m68k.org
> GPG Key fingerprint = 58CA 54C7 6D53 942B 1756  01D3 44D5 214B 8276 4ED5
> "And now for something completely different."
>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: Postreload and STRICT_LOW_PART
  2009-09-20 16:31 ` Richard Guenther
@ 2009-09-20 17:25   ` Paolo Bonzini
  0 siblings, 0 replies; 3+ messages in thread
From: Paolo Bonzini @ 2009-09-20 17:25 UTC (permalink / raw)
  To: Richard Guenther; +Cc: Andreas Schwab, gcc

On 09/20/2009 06:31 PM, Richard Guenther wrote:
> On Sun, Sep 20, 2009 at 6:10 PM, Andreas Schwab<schwab@linux-m68k.org>  wrote:
>> Why is postreload converting (set (REGX) (CONST_INT A)) ... (set (REGX)
>> (CONST_INT B)) into (set (STRICT_LOW_PART (REGX)) (CONST_INT B))?  That
>> looks like a pessimisation especially if the constants are small, since
>> STRICT_LOW_PART must not touch the high part.  Is there a way for the
>> backend to stop postreload from doing this if the constants are in some
>> range?  On the m68k, loading a constant in the range -128..127 in SI
>> mode is better than loading it in strict QI mode.
>
> It's probably an omission of a check if A&  ~GET_MODE_MASK (narrow_mode)
> is equal to zero.

Actually it is (A^B) & ~GET_MODE_MASK(narrow_mode) that has to be 0.

> And of course a cost check is completely missing.

I think that adding a cost check would be the right thing to do.  For 
size, a QImode move is probably better (it is on i386 for example).

Paolo

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2009-09-20 17:25 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2009-09-20 16:10 Postreload and STRICT_LOW_PART Andreas Schwab
2009-09-20 16:31 ` Richard Guenther
2009-09-20 17:25   ` Paolo Bonzini

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).