public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
* combiner and paradoxical subreg question....
@ 2002-05-02  6:52 Marcus Shawcroft
  2002-05-02 13:24 ` Richard Henderson
  0 siblings, 1 reply; 2+ messages in thread
From: Marcus Shawcroft @ 2002-05-02  6:52 UTC (permalink / raw)
  To: gcc

I'm working on a new target port currently based on 3.0.4. I'm looking
into a problem in which a sign extension is inappropriately optimised
away.I suspect the problem originates in the combiner, can anyone shed
some light on whats going on here??? This is what I have so far:

The combiner eventually gets around to expanding {sign,zero}_extends in:

combine.c:expand_compound_operation ()

In this scenario it performs the following rewrite:

(sign_extend:SI (mem:QI (reg/f:SI 168) 0)) => (subreg:SI (mem:QI
(reg/f:SI 168) 0) 0)

The relevant code fragment is something like:

combine.c:9662ish:gen_lowpart_for_combine ()

      /* If we want to refer to something bigger than the original
memref,
      generate a perverse subreg instead.  That will force a reload
      of the original memref X.  */
      if (GET_MODE_SIZE (GET_MODE (x)) < GET_MODE_SIZE (mode))
     return gen_rtx_SUBREG (mode, x, 0);

I'm slightly confused by this, my understanding of paradoxical subreg's
is that they are used to refer to something in  a wider mode where we
don;t care about the value of the additional bits. Are there situations
where a paradoxical subreg implies zero or sign extension rather than
undefined???

Subsequently when we get around to 'splitting' the above fragment, back
in:
combine.c:2277ish:do_try_combine ()

#ifdef INSN_SCHEDULING
   /* If *SPLIT is a paradoxical SUBREG, when we split it, it should
      be written as a ZERO_EXTEND.  */
   if (split_code == SUBREG && GET_CODE (SUBREG_REG (*split)) == MEM)
     SUBST (*split, gen_rtx_combine (ZERO_EXTEND, split_mode,
         XEXP (*split, 0)));
#endif

This performs the rewrite:
(subreg:SI (mem:QI (reg/f:SI 168) 0) 0) => (zero_extend:SI (mem:QI
(reg/f:SI 168) 0))

This code fragment switches the paradoxical subreg for a zero_extend, so
the combiner has now managed the overall rewrite:

(sign_extend:SI (mem:QI (reg/f:SI 168) 0))
=>
(subreg:SI (mem:QI (reg/f:SI 168) 0) 0)
=>
(zero_extend:SI (mem:QI (reg/f:SI 168) 0))

So can someone explain:
* What does a paradoxial subreg really represent.
* Is it ever safe to rewrite a sign_extend to a paradoxical subreg.

Thanks
/Marcus

--
----------------------------------------------------------------------
ms@siroyan.com,                                Marcus Shawcroft
200 Brook Drive, Green Park,                   Siroyan Limited
Reading, RG2 6UB, United Kingdom               0118 925 6374/Fx949 7228





**********************************************************************
This email and any files transmitted with it are confidential and
intended solely for the use of the individual or entity to whom they
are addressed. If you have received this email in error please notify
the system manager.

This footnote also confirms that this email message has been swept by
MIMEsweeper for the presence of computer viruses.

www.mimesweeper.com
**********************************************************************

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

* Re: combiner and paradoxical subreg question....
  2002-05-02  6:52 combiner and paradoxical subreg question Marcus Shawcroft
@ 2002-05-02 13:24 ` Richard Henderson
  0 siblings, 0 replies; 2+ messages in thread
From: Richard Henderson @ 2002-05-02 13:24 UTC (permalink / raw)
  To: Marcus Shawcroft; +Cc: gcc

On Thu, May 02, 2002 at 02:52:10PM +0100, Marcus Shawcroft wrote:
> * What does a paradoxial subreg really represent.
> * Is it ever safe to rewrite a sign_extend to a paradoxical subreg.

http://gcc.gnu.org/ml/gcc/2002-01/msg01830.html


r~

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

end of thread, other threads:[~2002-05-02 20:24 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-05-02  6:52 combiner and paradoxical subreg question Marcus Shawcroft
2002-05-02 13:24 ` Richard Henderson

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