public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Richard Sandiford <rsandifo@redhat.com>
To: James E Wilson <wilson@specifixinc.com>
Cc: gcc@gcc.gnu.org
Subject: Re: RFC: Using mode and code macros in *.md files
Date: Sun, 08 Aug 2004 08:43:00 -0000	[thread overview]
Message-ID: <87isbudtfu.fsf@redhat.com> (raw)
In-Reply-To: <411574A9.4000704@specifixinc.com> (James E. Wilson's message of "Sat, 07 Aug 2004 17:32:41 -0700")

Thanks for the feedback.

James E Wilson <wilson@specifixinc.com> writes:
> My first question would be how this affects debugging gcc.  Being able
> to match rtl insns to the md pattern for them is important.  These
> macros obscure the connection.  If I have a insn that has been
> recognized, and claims to match the slesi pattern, then I will be
> confused if I can't find such a pattern.  How am I supposed to know to
> look for the s<floatcond><mode> pattern instead?  The port maintainer
> would know this, but someone else wouldn't.  Maybe it would help to
> print md file line numbers instead of or in addition to pattern names
> when dumping rtl.

Sound like a good idea.

> If I have an insn that hasn't been recognized, then I have a similar but
> slightly different problem.  If I try grepping for the operator (le:SI I
> am not going to find it.  How I am supposed to know to search for
> (<floatcond>:<mode> instead?

I can see that could be a problem.  I guess it depends on the habits
of the coder.

FWIW, I tend to use '\ble\b' (within emacs) when searching for an
operator name, and the first hit for that would be the macro definition.
(I mostly use '\b' because I can never remember which re syntaxes use
'(' as a grouping operator and which use '\(').

>> For example, code macros allow us to combine 7 of the c.cond.fmt patterns:
>
> You can already do this via match_operator.  Just define a predicate
> that accepts the 7 comparison codes you care about, and you can write a
> single pattern to patch all 7.  This gives a somewhat different affect
> though, as your macro approach gives 7 patterns whereas we only have one
> pattern if we use match_operator.

For matching, yes, but the point is that these are named patterns.
OK, so at the moment, only gen_slt_sf() is actually used (by one
of the reload patterns), but match_operator gives a less friendly
gen_*() interface.  If you have:

    (set (match_operand:SF 0 "register_operand" "=f")
         (match_operator:SF 1 "float_cmp_operator"
            [(match_operand:SF 2 "register_operand" "f")
             (match_operand:SF 2 "register_operand" "f")]))

then the gen_*() function will have four arguments.  From memory,
arguments 2 and 3 are ignored, and you need to pass gen_rtx_LT (...)
for argument 1.

In practice, we'd probably end up adding a new expander specifically for
"slt_sf", or perhaps just synthesising it directly using gen_rtx_*()
functions.

> We should consider whether we need or want two different mechanisms that
> do the same thing.

Well, match_operator is a bit more general, in that it can (if necessary)
match codes with different formats.  I don't know how important that is
in practice.

Richard

  reply	other threads:[~2004-08-08  6:39 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-08-07 18:38 Richard Sandiford
2004-08-08  4:30 ` James E Wilson
2004-08-08  8:43   ` Richard Sandiford [this message]
2004-08-09 18:29     ` James E Wilson
2004-08-09  9:02   ` Michael Matz
2004-08-09 18:09     ` James E Wilson
2004-08-10  8:57 ` Segher Boessenkool
2004-08-23 10:32 ` Zack Weinberg
2004-08-26 21:08   ` Richard Sandiford
2004-08-31 18:19     ` Steve Ellcey
2004-08-31 18:37       ` Richard Sandiford
2004-08-31 19:27         ` Joern Rennecke
2004-08-31 21:04         ` Steve Ellcey
2004-09-01 12:20           ` Joern Rennecke
2004-09-01 18:33             ` Steve Ellcey
2004-09-01 19:00               ` James E Wilson
2004-09-02 10:37               ` Joern Rennecke

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=87isbudtfu.fsf@redhat.com \
    --to=rsandifo@redhat.com \
    --cc=gcc@gcc.gnu.org \
    --cc=wilson@specifixinc.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).