public inbox for gcc@gcc.gnu.org
 help / color / mirror / Atom feed
From: Martin Guy <martinwguy@gmail.com>
To: "gcc@gcc.gnu.org" <gcc@gcc.gnu.org>
Subject: How to make ARM->MaverickCrunch register transfers schedulable?
Date: Sun, 16 Aug 2009 11:24:00 -0000	[thread overview]
Message-ID: <56d259a00908151450w16c9df68yca8f2ca0a52841ca@mail.gmail.com> (raw)

Hi!
  I'd appreciate some input on how to get the pipeline scheduler to
know about the bizarre MaverickCrunch timing characteristics.

  Brief: Crunch is an asynchronous ARM coprocessor which has internal
operations from/to its own register set, transfers between its own
registers and the ARM integer registers, and transfers directly
to/from memory.
  Softfp is the current favourite ABI, where double arguments are
passed in ARM register pairs, same as softfloat, and a typical double
float function transfers its arguments from ARM registers to the FPU,
does some munging between the FPU registers, then transfers the result
back to ARM regs for the return(). It has to do this 32 bits at a
time:

double adddf(double a, double b) {return (a+b);}

adddf:
        cfmv64lr        mvdx0, r0
        cfmv64hr        mvdx0, r1
        cfmv64lr        mvdx1, r2
        cfmv64hr        mvdx1, r3
        cfaddd          mvdx1, mvdx1, mvdx0
        cfmvr64l        r0, mvdx1
        cfmvr64h        r1, mvdx1
        bx      lr

Although you can do one transfer per cycle between the two units, two
consecutive transfers to the same Crunch register incur a delay of
four cycles, so each transfers to crunch registers takes 4 cycles. A
better sequence would be:

        cfmv64lr        mvdx0, r0
        cfmv64lr        mvdx1, r2
        cfmv64hr        mvdx0, r1
        cfmv64hr        mvdx1, r3

My questions are two:

- can I model the fact that two consecutive writes to the same
register have a latency of four cycles (whereas writes to different
registers can be one per cycle)?

- am I right in thinking to define two new register modes, MAVHI and
MAVLO for the two kinds of writes to the maverick registers, then turn
the movdf (and movdi) definitions for moves to/from ARM registers into
define_split's using the two new modes?

Thanks, sorry it's a bit osbcure!

   M

"An expert is someone who knows more and more about less and less:

                 reply	other threads:[~2009-08-15 21:50 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=56d259a00908151450w16c9df68yca8f2ca0a52841ca@mail.gmail.com \
    --to=martinwguy@gmail.com \
    --cc=gcc@gcc.gnu.org \
    /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).