From: Jan-Benedict Glaw <jbglaw@lug-owl.de>
To: Mateusz Berezecki <mateuszb@gmail.com>
Cc: linux-kernel@vger.kernel.org
Subject: Re: __udivdi3 and linux kernel u64 division question [x86]
Date: Tue, 24 May 2005 15:08:37 +0200 [thread overview]
Message-ID: <20050524130837.GR2417@lug-owl.de> (raw)
In-Reply-To: <42931E38.6030403@gmail.com>
[-- Attachment #1: Type: text/plain, Size: 1535 bytes --]
On Tue, 2005-05-24 14:29:44 +0200, Mateusz Berezecki <mateuszb@gmail.com> wrote:
> u64 mconst = somebig64bitvalue;
> u64 tmp = some32bitvalue;
> u64 r = mconst / tmp;
>
> I encounter compilation error and gcc reporting __udivdi3 has not been
> found!
> After firing up cscope I found that this function has never(?) been
> implemented for
> x86 architecture. How is it possible that during compilation process of
> some module
> make system tries to link with nonexisting function?
>
> I've also found a do_div() and it was sufficent for my purposes but Im
> still curious about
> __udivdi3. Can someone explain this issue to me?
In some cases, gcc decides that a given division is too complicated to
do it in one assembler instruction. That's especially true for things
that newer CPUs support but older lack. In these cases, gcc emits a
function call instead of the actual division and normally, libgcc would
provide these functions.
However, it's each architecture's decision to link-in libgcc or not,
because it can open another can of worms. Alternatively, you can
implement these little functions on your own and put them somewhere in
some library file.
MfG, JBG
--
Jan-Benedict Glaw jbglaw@lug-owl.de . +49-172-7608481 _ O _
"Eine Freie Meinung in einem Freien Kopf | Gegen Zensur | Gegen Krieg _ _ O
fuer einen Freien Staat voll Freier Bürger" | im Internet! | im Irak! O O O
ret = do_actions((curr | FREE_SPEECH) & ~(NEW_COPYRIGHT_LAW | DRM | TCPA));
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]
prev parent reply other threads:[~2005-05-24 13:08 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-05-24 12:29 __udivdi3 and linux kernel u64 division question [x86] Mateusz Berezecki
2005-05-24 12:37 ` Arjan van de Ven
2005-05-24 13:08 ` Jan-Benedict Glaw [this message]
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=20050524130837.GR2417@lug-owl.de \
--to=jbglaw@lug-owl.de \
--cc=linux-kernel@vger.kernel.org \
--cc=mateuszb@gmail.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.