public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jeffrey A Law <law@cygnus.com>
To: Bill Currie <bcurrie@tssc.co.nz>
Cc: Joern Rennecke <amylaar@cygnus.co.uk>, ak@muc.de, egcs@cygnus.com
Subject: Re: Feature request: ability to describe x86 register halves as contraints.
Date: Thu, 02 Jul 1998 01:39:00 -0000	[thread overview]
Message-ID: <24030.899359722@hurl.cygnus.com> (raw)
In-Reply-To: <359AFFE1.26F8@tssc.co.nz>

  In message < 359AFFE1.26F8@tssc.co.nz >you write:
  > However, I get a successfull stage3 build and compare.  Does that count?
Not really :-)  You wouldn't believe the things I've seen pass 3-stage
the testsuite, commercial testsuites, etc.


  > In that case, should I submit my patches anyway so at least they won't
  > get lost?  Also, I would like feedback on what I've done from
  > knowledgable people.
Yes they would be greatly appreciated.  If at all possible you should
send multiple patches -- one for each problem you encountered.  Since
few of us know the i860 all that well, it would be quite helpful if
you could describe the problem and how your solution fixes the problem
so that we can better evaluate the change.

It may also be the case that we'll need a copyright assignment from you
to use the changes -- depends on how big they are as a whole.

  > > However, I'm curious how you deal with memory subregs or register
  > > subregs that get spilled, then loaded from memory.
  > 
  > Hmm... now, I could have missed something, but the existing i860 md file
  > has relatively few references to subregs.  The only time I had any real
  > problems was getting MULSI3 to work cleanly.  This required hacking in
  > use of strict_low_part, probably to get around this very issue.  I might
  > even find a cleaner solution.
References to subregs mostly created by the compiler totally outside
the control of the backend.  Furthermore, if you have predicates that
accept a "register_operand", then they also accept subregs.  As would
"general_operand".

So consider a AND operation of two DImode registers (call them X & Y))
The compiler may generate code like this:

(set (reg:SI 0) (subreg:SI (reg:DI source1) 0)))
(set (reg:SI 1) (subreg:SI (reg:DI source1) 1)))
(set (reg:SI 2) (subreg:SI (reg:DI source2) 0)))
(set (reg:SI 3) (subreg:SI (reg:DI source2) 1)))

(set (subreg:SI (reg:DI target) 0)) (and:SI (reg:SI 0) (reg:SI 2))
(set (subreg:SI (reg:DI target) 1)) (and:SI (reg:SI 1) (reg:SI 4))

In this case word order doesn't matter.  In other cases it will
(consider addition) and if some of the regs get spilled to memory
you'll change the meaning of the code because the meaning of the
subreg changes.

  > Also, I could be very wrong (especially because I'm not too sure what
  > spilling is), but how often do subregs get spilled?
Not sure how to answer that. :-)  They do get spilled.  Since there's
generally fewer subregs than regs the total number of spills is smaller.
However, I suspect the percentage of subregs that gets spilled is high.

  > Hmm, just realised
  > you may be referring to when reload.c strips the subreg info if the
  > subreg is 0. I told push_reload (? bloody big functions) not to strip
  > the subreg info if REG_WORDS_BIG_ENDIAN != WORDS_BIG_ENDIAN.
It's more than that.   :-)

For example the compiler could have (subreg:SI (reg:DI) 1); then consider
what happens in the reg gets spilled to the stack -- you'll end up
with (subreg:SI (mem:DI) 1) which has a different meaning.

reload can (and will) perform direct replacements of a REG with a MEM
expression.  Other passes may do this too, but the register alloctors
and reload do it more than other passes.  When this happens the meaning
of the code changes because the meaning of SUBREG changes depending on
what item is inside the SUBREG.


  > > impression that how the word of a subreg is interpreted changes based
  > > on what the inner object is.
  > 
  > Do you mean whether it's a REG or a MEM object?  Yes, that's exactly
  > what I do in final.c as it is selecting the register name.
Ouch!  Danger.  Danger.  Danger.  This is not safe.  See above about
replacement of REG with MEM expressions.


jeff

  reply	other threads:[~1998-07-02  1:39 UTC|newest]

Thread overview: 26+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <359ABD84.2FC4@tssc.co.nz>
1998-07-02  1:39 ` Jeffrey A Law
1998-07-02  1:39   ` Bill Currie
1998-07-02  1:39     ` Jeffrey A Law [this message]
1998-07-03  0:12       ` Bill Currie
1998-07-02 11:02     ` Joern Rennecke
1998-07-02 15:15       ` Bill Currie
1998-07-02 15:15         ` Joern Rennecke
1998-07-01 13:20 Michael Meissner
1998-07-01 20:15 ` Joern Rennecke
  -- strict thread matches above, loose matches on Subject: below --
1998-06-29 20:41 ak
1998-06-30  0:42 ` Richard Henderson
1998-06-30  4:50   ` ak
1998-06-30 19:49     ` Alan Modra
1998-06-30 19:49       ` Andreas Kleen
1998-06-30 14:08   ` Jeffrey A Law
1998-06-30  9:24     ` Richard Henderson
1998-06-30  1:02 ` Jeffrey A Law
1998-06-30 11:53   ` Joern Rennecke
1998-06-30 11:53     ` Jeffrey A Law
1998-07-01  3:42       ` Richard Henderson
1998-06-30 15:15   ` Bill Currie
1998-06-30 15:26     ` Jeffrey A Law
1998-06-30 23:15       ` Bill Currie
1998-06-30 19:49         ` Jeffrey A Law
1998-07-01 10:51           ` Joern Rennecke
1998-07-01 10:51             ` Jeffrey A Law

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=24030.899359722@hurl.cygnus.com \
    --to=law@cygnus.com \
    --cc=ak@muc.de \
    --cc=amylaar@cygnus.co.uk \
    --cc=bcurrie@tssc.co.nz \
    --cc=egcs@cygnus.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).