public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Georg-Johann Lay <avr@gjlay.de>
To: srimeruva@cse.iitb.ac.in
Cc: gcc-help@gcc.gnu.org
Subject: Re: match_dup as internal operands
Date: Sat, 04 Feb 2012 12:02:00 -0000	[thread overview]
Message-ID: <4F2D1E00.30702@gjlay.de> (raw)
In-Reply-To: <ab38551f74fe0b1a415229dc537655db.squirrel@www.cse.iitb.ac.in>

srimeruva@cse.iitb.ac.in schrieb:
> what is the advantage of using match_dup for internal operands as
> 
> (define_expand "zero_extendhisi2"
>  [(set (match_operand:SI 0 "register_operand" "")
>  (and:SI (subreg:SI
>  (match_operand:HI 1 "register_operand" "")
>  0)
>  (match_dup 2)))]
>  ""
>  "operands[2]
>     = force_reg (SImode, GEN_INT (65535)); ")

zero_extendhisi2 is a standard insn name that gets 2 operands,
see "Standard Pattern Names For Generation" in the internals documentation.

Operand 2 is just a placeholder to add a 3rd operand that is
needed for (const_int 65535). Look at the generated code in 
insn-emit.c:gen_zero_extendhisi2 and it will be clear:

That function gets two rtx parameters. The C-snip allocates an array 
rtx[3] which is initialized with the arguments and the match_dup value. 
These rtx'es are then used to emit RTL as specified by the expander.

Notice that usage in insns, splits, peepholes etc. is different and 
serves as reference to an other operand when matching, for example in recog.

Johann


      parent reply	other threads:[~2012-02-04 12:02 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1324405305.17587.ezmlm@gcc.gnu.org>
2011-12-20 21:15 ` srimeruva
2011-12-21  0:02   ` Ian Lance Taylor
2012-02-04  7:06   ` constraints validation in reload pass srimeruva
2012-02-04 11:49     ` Georg-Johann Lay
2012-02-04 12:02   ` Georg-Johann Lay [this message]

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=4F2D1E00.30702@gjlay.de \
    --to=avr@gjlay.de \
    --cc=gcc-help@gcc.gnu.org \
    --cc=srimeruva@cse.iitb.ac.in \
    /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).