public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: "Ulrich Weigand" <uweigand@de.ibm.com>
To: paulo@matos-sorge.com (Paulo J. Matos)
Cc: gcc@gcc.gnu.org
Subject: Re: IRA changes rules of the game
Date: Thu, 20 Oct 2011 16:21:00 -0000	[thread overview]
Message-ID: <201110201525.p9KFPixB010921@d06av02.portsmouth.uk.ibm.com> (raw)
In-Reply-To: <j7pbu4$e9i$1@dough.gmane.org> from "Paulo J. Matos" at Oct 20, 2011 03:41:07 PM

Paulo J. Matos wrote:

> (define_insn_and_split "neghi_internal"
>     [(set (match_operand:QI 0 "register_operand" "=c")
>           (neg:QI (match_dup 0)))
>      (set (match_operand:QI 1 "register_operand" "=c")
>           (plus:QI
>             (plus:QI
>               (ltu:QI (neg:QI (match_dup 0)) (const_int 0))
>               (match_dup 1))
>             (const_int 0)))
>      (clobber (reg:CC RCC))]

> Am I missing something or something here is broken?

When reload looks at the above pattern, it will see just
two operands, both of which are output-only.  So when it
decides to reload one of the operands, it will only provide
an output reload, no input reload.

For operands that are actually used for both input and
output, you need to provide two match_operand clauses,
and tie them using a matching constraint.  Simply using
match_dup doesn't accomplish that.

Something along the lines of:

 (define_insn_and_split "neghi_internal"
     [(set (match_operand:QI 0 "register_operand" "=c")
           (neg:QI (match_operand:QI 1 "register_operand" "0")))
      (set (match_operand:QI 2 "register_operand" "=c")
           (plus:QI
             (plus:QI
               (ltu:QI (neg:QI (match_dup 1)) (const_int 0))
               (match_operand:QI 3 "register_operand" "2"))
             (const_int 0)))
      (clobber (reg:CC RCC))]

ought to work as expected.

(The remaining match_dup is fine, since reload already knows
operand 1 is used as input, so the dup doesn't introduce a
new type of use.)

Bye,
Ulrich

-- 
  Dr. Ulrich Weigand
  GNU Toolchain for Linux on System z and Cell BE
  Ulrich.Weigand@de.ibm.com

  reply	other threads:[~2011-10-20 15:26 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-20 14:58 Paulo J. Matos
2011-10-20 16:21 ` Ulrich Weigand [this message]
2011-10-20 17:50   ` Joern Rennecke
2011-10-20 18:18     ` Paulo J. Matos
2011-10-21 13:11       ` Paolo Bonzini
2011-10-21 14:15         ` Paulo J. Matos
2011-10-21 14:32           ` Joern Rennecke
2011-10-20 18:18   ` Paulo J. Matos
2011-10-21 17:15 ` 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=201110201525.p9KFPixB010921@d06av02.portsmouth.uk.ibm.com \
    --to=uweigand@de.ibm.com \
    --cc=gcc@gcc.gnu.org \
    --cc=paulo@matos-sorge.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).