public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Peter Barada <peter@the-baradas.com>
To: ian@wasabisystems.com
Cc: gcc@gcc.gnu.org
Subject: Re: gcc-3.4.0 fails for ColdFire(does not satisfy constraints)
Date: Tue, 27 Apr 2004 16:34:00 -0000	[thread overview]
Message-ID: <20040427143120.700C6990F4@baradas.org> (raw)
In-Reply-To: <m3smep1pse.fsf@gossamer.airs.com> (message from Ian Lance Taylor on 27 Apr 2004 10:03:29 -0400)


>That's not quite what I was thinking of.  I was thinking that would
>match constants which moveq can handle, which is the reverse of the
>constraints 'K' (if you can't use moveq for the constant, this
>optimization doesn't really help, as far as I can see).  Also, you
>don't need to check symbolic_operand condition, because the constraint
>'K' will only match a CONST_INT anyhow.  I would try something like
>this:
>
>(define_peephole2
>  [(match_scratch:SI 2 "d")
>   (set (match_operand:SI 0 "register_or_memory_operand" "rm")
>        (plus:SI (match_dup 0)
>                 (match_operand:SI 1 "immediate_operand" "J")))]
>  "INTVAL (operand[1]) >= -0x80 && INTVAL (operand[1]) < 0x80"
>  [(set (match_dup 2) (match_dup 1))
>   (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))]
>  "")

I need to ingest more caffeine before I try to write RTL :)  I fat-fingered the 'J'.

For ColdFire(at least on the newer cores), the immediate add is
faster(but larger) than the moveq/add.  If there are data registers
available, will this peephole(if matched multiple times in a block for
the *same* constant), create more than one constant register loaded
with moveq, or is the compiler smart enough to coalesce them together?

I'll give the following a whirl and see what happens:

(define_peephole2
  [(match_scratch:SI 2 "d")
   (set (match_operand:SI 0 "register_or_memory_operand" "rm")
        (plus:SI (match_dup 0)
                 (match_operand:SI 1 "immediate_operand" "J")))]
  "optimize_size && INTVAL (operand[1]) >= -0x80 && INTVAL (operand[1]) < 0x80"
  [(set (match_dup 2) (match_dup 1))
   (set (match_dup 0) (plus:SI (match_dup 0) (match_dup 2)))]
  "")


-- 
Peter Barada
peter@the-baradas.com

  reply	other threads:[~2004-04-27 14:31 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-04-26 20:23 Peter Barada
2004-04-26 20:34 ` Ian Lance Taylor
2004-04-26 21:06   ` Peter Barada
2004-04-26 21:10     ` Ian Lance Taylor
2004-04-26 21:24       ` Peter Barada
2004-04-26 22:17         ` Ian Lance Taylor
2004-04-27  0:53           ` Peter Barada
2004-04-27  4:20             ` Ian Lance Taylor
2004-04-27  8:46               ` Jim Wilson
2004-04-27 14:57               ` Peter Barada
2004-04-27 15:10                 ` Ian Lance Taylor
2004-04-27 16:34                   ` Peter Barada [this message]
2004-04-27 16:35                     ` Ian Lance Taylor
2004-04-27 16:45                       ` Peter Barada
2004-04-27 17:32                         ` Ian Lance Taylor

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=20040427143120.700C6990F4@baradas.org \
    --to=peter@the-baradas.com \
    --cc=gcc@gcc.gnu.org \
    --cc=ian@wasabisystems.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).