All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ralf Baechle <ralf@linux-mips.org>
To: Mans Rullgard <mans@mansr.com>
Cc: linux-mips@linux-mips.org
Subject: Re: [RFC PATCH] MIPS: optimise 32-bit do_div() with constant divisor
Date: Fri, 7 Nov 2014 01:50:32 +0100	[thread overview]
Message-ID: <20141107005031.GA22697@linux-mips.org> (raw)
In-Reply-To: <1415290998-10328-1-git-send-email-mans@mansr.com>

On Thu, Nov 06, 2014 at 04:23:18PM +0000, Mans Rullgard wrote:

> This is an adaptation of the optimised do_div() for ARM by
> Nicolas Pitre implementing division by a constant using a
> multiplication by the inverse.  Ideally, the compiler would
> do this internally as it does for 32-bit operands, but it
> doesn't.
> 
> This version of the code requires an assembler with support
> for the DSP ASE syntax since accessing the hi/lo registers
> sanely from inline asm is impossible without this.  Building
> for a CPU without this extension still works, however.
> 
> It also does not protect against the WAR hazards for the
> hi/lo registers present on CPUs prior to MIPS IV.
> 
> I have only tested it as far as booting and light use with
> the BUG_ON enabled wihtout encountering any issues.
> 
> The inverse computation code is a straight copy from ARM,
> so this should probably be moved to a shared location.

Can you explain why you need __div64_fls()?  There's __fls() which on
MIPS is carefully written to make use of the CLZ rsp. DCLZ instructions
where available; the fallback implementation is looking fairly similar
to your code.

MADD is named MAD on some older CPUs; yet other CPUs don't have it
at all.  I take it you tried to make GCC emit the instruction but it
doesn't?

  Ralf

  parent reply	other threads:[~2014-11-07  0:50 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 [this message]
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
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=20141107005031.GA22697@linux-mips.org \
    --to=ralf@linux-mips.org \
    --cc=linux-mips@linux-mips.org \
    --cc=mans@mansr.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.