Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: "Måns Rullgård" <mans@mansr.com>
To: David Daney <ddaney.cavm@gmail.com>
Cc: Ralf Baechle <ralf@linux-mips.org>, linux-mips@linux-mips.org
Subject: Re: [RFC PATCH] MIPS: optimise 32-bit do_div() with constant divisor
Date: Sat, 08 Nov 2014 02:18:33 +0000	[thread overview]
Message-ID: <yw1xtx2aigee.fsf@unicorn.mansr.com> (raw)
In-Reply-To: <545D10DE.5000804@gmail.com> (David Daney's message of "Fri, 07 Nov 2014 10:35:10 -0800")

David Daney <ddaney.cavm@gmail.com> writes:

> On 11/07/2014 07:00 AM, Måns Rullgård wrote:
> [...]
>>
>>> As for access to hi/lo, I tried to explicitly put a variable in the lo
>>> register.  Which sort of works for very simple cases but as expected it's
>>> easy to get GCC to spill its RTL guts because it runs out of spill
>>> registers.  It maybe can be made to work but I'd feel nervous about its
>>> stability unless a GCC guru approved this method.
>>
>> The "x" constraint can be used to move a double-word to/from the hi/lo
>> registers.  On DSP targets, the "ka" constraint provides access to the
>> three additional hi/lo pairs while on a non-DSP targets it degenerates
>> to "x".  The "ka" constraint is available since gcc 4.3.0.  I see no
>> reason not to allow this extra flexibility.
>
> What would the performance penalty be to hand code the assembly so
> that only mips32 instructions are used (i.e. no MADD), and transfers
> from hi/lo were all explicitly coded so that there were no hi/lo
> register constraints, but only clobbers of "hi", "lo"?

It's hard to say in absolute numbers.  However, the pre-mips32
equivalent of MADDU looks something like this:

        multu   $4, $5
        mflo    $6
        mfhi    $7
        addu    $8, $8, $6
        addu    $9, $9, $7
        sltu    $6, $8, $6
        addu    $9, $9, $6

-- 
Måns Rullgård
mans@mansr.com

  reply	other threads:[~2014-11-08  2:18 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-11-06 16:23 [RFC PATCH] MIPS: optimise 32-bit do_div() with constant divisor Mans Rullgard
2014-11-06 17:08 ` David Daney
2014-11-06 17:42   ` Måns Rullgård
2014-11-07  0:50 ` Ralf Baechle
2014-11-07  2:20   ` Måns Rullgård
2014-11-07 11:35     ` Ralf Baechle
2014-11-07 15:00       ` Måns Rullgård
2014-11-07 18:35         ` David Daney
2014-11-08  2:18           ` Måns Rullgård [this message]
2015-01-11  5:05 ` Maciej W. Rozycki

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=yw1xtx2aigee.fsf@unicorn.mansr.com \
    --to=mans@mansr.com \
    --cc=ddaney.cavm@gmail.com \
    --cc=linux-mips@linux-mips.org \
    --cc=ralf@linux-mips.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