mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Matti Aarnio <matti.aarnio@zmailer.org>
To: Bernardo Innocenti <bernie@develer.com>
Cc: Linus Torvalds <torvalds@osdl.org>,
	Andrew Morton <akpm@digeo.com>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] Kill div64.h dupes, parenthesize do_div() macro params
Date: Wed, 2 Jul 2003 10:54:38 +0300	[thread overview]
Message-ID: <20030702075438.GO28900@mea-ext.zmailer.org> (raw)
In-Reply-To: <200307020902.05522.bernie@develer.com>

On Wed, Jul 02, 2003 at 09:02:05AM +0200, Bernardo Innocenti wrote:
> On Wednesday 02 July 2003 07:09, Linus Torvalds wrote:
>  > > Why 64-bit divides in particular were victimised in this manner is a
>  > > matter for speculation ;)
>  >
>  > Because gcc historically _cannot_ generate an efficient 64/32->64
>  > divide. It ends up doing a full 64/64 divide thing.
> 
>  You're right here. I've been too quick in putting my faith in gcc ;-)
> 
>  Shouldn't we complain to the gcc people? The 64/32 division is a
> rather common operation in many applications besides the kernel, so
> you'd expect gcc to get it right without polluting every single
> project with reimplementations of do_div().

The thinking behind there has been:
 a) arbitrary 64/32 division is _rare_, and shall be used only
    in places that are non-critical to system speed
 b) all places in filesystems, etc. should handle things by
    doing these things with  >>  operators, which of course,
    requires divisor to be power of two, and given as log2()
    of the divisor.
 c) to see usage of sub-optimal speed things, linkage against
    libgcc is expressly forbidden in kernel.

Thus when you see that  _divxyz3()  can not be linked in, the
bug is in its _need_, and thus the code, not in lack of library
to supply it!   The  do_div64()  is there to supply those non-
speed-critical rare uses.

At some platforms there is no way around this rule, but Linux's
primary platform is i386, and there those enforcements are shown.

To an extent, for example  Alpha  platform got several libgcc
functions copied in its arch library, to solve some unavoidable
builtin function needs, while still not blindly linking with
libgcc.

> -- 
>   // Bernardo Innocenti - Develer S.r.l., R&D dept.
> \X/  http://www.develer.com/

/Matti Aarnio

  reply	other threads:[~2003-07-02  7:40 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2003-07-02  0:32 Bernardo Innocenti
     [not found] ` <20030701173612.280d1296.akpm@digeo.com>
2003-07-02  2:24   ` Bernardo Innocenti
2003-07-02  2:32     ` Andrew Morton
2003-07-02  3:15       ` Bernardo Innocenti
2003-07-02  5:12         ` Linus Torvalds
2003-07-02  7:53         ` Russell King
2003-07-02  8:14           ` Ian Molton
2003-07-02  5:09       ` Linus Torvalds
2003-07-02  7:02         ` Bernardo Innocenti
2003-07-02  7:54           ` Matti Aarnio [this message]
2003-07-02  3:36     ` Peter Chubb
2003-07-02  4:37       ` Bernardo Innocenti
2003-07-02  5:57       ` Andrea Arcangeli
2003-07-02  6:52         ` Bernardo Innocenti
2003-07-02  7:19           ` Andrea Arcangeli
2003-07-02  7:28             ` Bernardo Innocenti
2003-07-02  8:38               ` Andrea Arcangeli
2003-07-02 16:16           ` Linus Torvalds
2003-07-03 10:43             ` [PATCH] Fix do_div() for all architectures Bernardo Innocenti
2003-07-02  7:56         ` [PATCH] Kill div64.h dupes, parenthesize do_div() macro params Russell King
2003-07-02  5:06     ` Linus Torvalds
2003-07-02 14:23       ` Geert Uytterhoeven

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=20030702075438.GO28900@mea-ext.zmailer.org \
    --to=matti.aarnio@zmailer.org \
    --cc=akpm@digeo.com \
    --cc=bernie@develer.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=torvalds@osdl.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

all inboxes | Powered by JetHome®