From: Bernardo Innocenti <bernie@develer.com>
To: Andrea Arcangeli <andrea@suse.de>
Cc: Richard Henderson <rth@twiddle.net>,
Linus Torvalds <torvalds@osdl.org>,
linux-kernel@vger.kernel.org,
Peter Chubb <peter@chubb.wattle.id.au>,
Andrew Morton <akpm@digeo.com>, Ian Molton <spyro@f2s.com>,
gcc@gcc.gnu.org
Subject: Re: [PATCH] Fix do_div() for all architectures
Date: Fri, 11 Jul 2003 00:58:58 +0200 [thread overview]
Message-ID: <200307110058.59212.bernie@develer.com> (raw)
In-Reply-To: <20030710201939.GQ16313@dualathlon.random>
On Thursday 10 July 2003 22:19, Andrea Arcangeli wrote:
> > Without type based alias analysis, the compiler is forced to flush
> > all registers containing copies of memory objects before function
> > call and reloading values from memory afterwards.
>
> the kernel isn't complaint with the alias analysis, that's why it has
> to be turned off (-fnostrict-aliasing) or stuff would break.
Yeah, I noticed. Writing low-level code without breaking strict aliasing
rules can be quite difficult if you don't want to give up any of your clever
tricks. I have a set of macros for handling linked lists that I can't get to
compile without those damn alias warnings with the latest GCC versions.
Besides, pushing our philosophycal discussion forward, what the generic
do_div() is doing might be vary bad for performance. After extracting the
address of n, the compiler must conservatively assume that any following
pointer dereference or function call could alter the contents of n.
Since strict aliasing is turned off, access to the divisor will become
slow as hell. Almost as if it was declared volatile.
Ok, as Richard said, it's just the generic version for those who don't
care enough to write their own optimized version.
> > Boy, that's ugly! It's too bad C can't do it the Perl way:
> >
> > (n,rem) = __div64_32(n, base);
>
> or the python way:
>
> n, rem = __div64_32(n, base)
>
> ;)
You beat me!
--
// Bernardo Innocenti - Develer S.r.l., R&D dept.
\X/ http://www.develer.com/
Please don't send Word attachments - http://www.gnu.org/philosophy/no-word-attachments.html
next prev parent reply other threads:[~2003-07-10 22:45 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2003-07-05 23:33 [PATCH] Fix do_div() for all architectures Bernardo Innocenti
2003-07-06 7:47 ` Russell King
2003-07-06 15:40 ` Ian Molton
2003-07-07 4:26 ` Bernardo Innocenti
2003-07-08 18:27 ` Bernardo Innocenti
2003-07-08 18:31 ` Andrew Morton
2003-07-08 20:56 ` Bernardo Innocenti
2003-07-10 15:40 ` Richard Henderson
2003-07-10 16:18 ` Andrea Arcangeli
2003-07-10 16:39 ` Richard Henderson
2003-07-10 19:31 ` Bernardo Innocenti
2003-07-10 19:53 ` Dale Johannesen
2003-07-10 20:19 ` Andrea Arcangeli
2003-07-10 22:58 ` Bernardo Innocenti [this message]
2003-07-10 22:04 ` Richard Henderson
2003-07-10 23:13 ` Bernardo Innocenti
-- strict thread matches above, loose matches on Subject: below --
2003-07-02 16:16 [PATCH] Kill div64.h dupes, parenthesize do_div() macro params Linus Torvalds
2003-07-03 10:43 ` [PATCH] Fix do_div() for all architectures Bernardo Innocenti
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=200307110058.59212.bernie@develer.com \
--to=bernie@develer.com \
--cc=akpm@digeo.com \
--cc=andrea@suse.de \
--cc=gcc@gcc.gnu.org \
--cc=linux-kernel@vger.kernel.org \
--cc=peter@chubb.wattle.id.au \
--cc=rth@twiddle.net \
--cc=spyro@f2s.com \
--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